Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / content / browser / renderer_host / media / media_stream_requester.h
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
13 namespace 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.
18 class CONTENT_EXPORT MediaStreamRequester {
19  public:
20   // Called as a reply of a successful call to GenerateStream.
21   virtual void StreamGenerated(int render_frame_id,
22                                int page_request_id,
23                                const std::string& label,
24                                const StreamDeviceInfoArray& audio_devices,
25                                const StreamDeviceInfoArray& video_devices) = 0;
26   // Called if GenerateStream failed.
27   virtual void StreamGenerationFailed(
28       int render_frame_id,
29       int page_request_id,
30       content::MediaStreamRequestResult result) = 0;
31   // Called if a device has been stopped by a user from UI or the device
32   // has become unavailable.  |render_frame_id| is the render frame that
33   // requested the device and |label| is the label of the request.
34   virtual void DeviceStopped(int render_frame_id,
35                              const std::string& label,
36                              const StreamDeviceInfo& device) = 0;
37   // Called as a reply of a successful call to EnumerateDevices.
38   virtual void DevicesEnumerated(int render_frame_id,
39                                  int page_request_id,
40                                  const std::string& label,
41                                  const StreamDeviceInfoArray& devices) = 0;
42   // Called as a reply of a successful call to OpenDevice.
43   virtual void DeviceOpened(int render_frame_id,
44                             int page_request_id,
45                             const std::string& label,
46                             const StreamDeviceInfo& device_info) = 0;
47
48  protected:
49   virtual ~MediaStreamRequester() {
50   }
51 };
52
53 }  // namespace content
54
55 #endif  // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_REQUESTER_H_