media_stream_requester.h revision 8bcbed890bc3ce4d7a057a8f32cab53fa534672e
1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_REQUESTER_H_
6#define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_REQUESTER_H_
7
8#include <string>
9
10#include "content/common/content_export.h"
11#include "content/common/media/media_stream_options.h"
12
13namespace content {
14
15// MediaStreamRequester must be implemented by the class requesting a new media
16// stream to be opened. MediaStreamManager will use this interface to signal
17// success and error for a request.
18class CONTENT_EXPORT MediaStreamRequester {
19 public:
20  // Called as a reply of a successful call to GenerateStream.
21  virtual void StreamGenerated(const std::string& label,
22                               const StreamDeviceInfoArray& audio_devices,
23                               const StreamDeviceInfoArray& video_devices) = 0;
24  // Called if GenerateStream failed.
25  virtual void StreamGenerationFailed(const std::string& label) = 0;
26
27  // Called if stream has been stopped by user request.
28  // TODO(perkj): StopGeneratedStream is used by screen capture in order to be
29  // able to stop screen capture from UI instead of from JS.
30  // This should also be refactored to be stopped per stream source instead of
31  // the complete stream.
32  virtual void StopGeneratedStream(int render_view_id,
33                                   const std::string& label) = 0;
34
35  // Called as a reply of a successful call to EnumerateDevices.
36  virtual void DevicesEnumerated(const std::string& label,
37                                 const StreamDeviceInfoArray& devices) = 0;
38  // Called as a reply of a successful call to OpenDevice.
39  virtual void DeviceOpened(const std::string& label,
40                            const StreamDeviceInfo& device_info) = 0;
41
42 protected:
43  virtual ~MediaStreamRequester() {
44  }
45};
46
47}  // namespace content
48
49#endif  // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_REQUESTER_H_
50