OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "content/browser/renderer_host/media/media_stream_manager.h" | 12 #include "content/browser/renderer_host/media/media_stream_manager.h" |
13 #include "content/browser/renderer_host/media/media_stream_requester.h" | 13 #include "content/browser/renderer_host/media/media_stream_requester.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/common/media/media_stream_options.h" | 15 #include "content/common/media/media_stream_options.h" |
16 #include "content/public/browser/browser_message_filter.h" | 16 #include "content/public/browser/browser_message_filter.h" |
17 | 17 |
18 namespace media_stream { | 18 namespace content { |
19 | 19 |
20 // MediaStreamDispatcherHost is a delegate for Media Stream API messages used by | 20 // MediaStreamDispatcherHost is a delegate for Media Stream API messages used by |
21 // MediaStreamImpl. It's the complement of MediaStreamDispatcher | 21 // MediaStreamImpl. It's the complement of MediaStreamDispatcher |
22 // (owned by RenderView). | 22 // (owned by RenderView). |
23 class CONTENT_EXPORT MediaStreamDispatcherHost | 23 class CONTENT_EXPORT MediaStreamDispatcherHost |
24 : public content::BrowserMessageFilter, | 24 : public BrowserMessageFilter, |
tfarina
2012/10/29 17:41:34
nit: it does fits into the previous line.
jam
2012/10/29 18:14:45
Done.
| |
25 public MediaStreamRequester { | 25 public MediaStreamRequester { |
26 public: | 26 public: |
27 explicit MediaStreamDispatcherHost(int render_process_id); | 27 explicit MediaStreamDispatcherHost(int render_process_id); |
28 | 28 |
29 // MediaStreamRequester implementation. | 29 // MediaStreamRequester implementation. |
30 virtual void StreamGenerated( | 30 virtual void StreamGenerated( |
31 const std::string& label, | 31 const std::string& label, |
32 const StreamDeviceInfoArray& audio_devices, | 32 const StreamDeviceInfoArray& audio_devices, |
33 const StreamDeviceInfoArray& video_devices) OVERRIDE; | 33 const StreamDeviceInfoArray& video_devices) OVERRIDE; |
34 virtual void StreamGenerationFailed(const std::string& label) OVERRIDE; | 34 virtual void StreamGenerationFailed(const std::string& label) OVERRIDE; |
35 virtual void DevicesEnumerated(const std::string& label, | 35 virtual void DevicesEnumerated(const std::string& label, |
36 const StreamDeviceInfoArray& devices) OVERRIDE; | 36 const StreamDeviceInfoArray& devices) OVERRIDE; |
37 virtual void DeviceOpened(const std::string& label, | 37 virtual void DeviceOpened(const std::string& label, |
38 const StreamDeviceInfo& video_device) OVERRIDE; | 38 const StreamDeviceInfo& video_device) OVERRIDE; |
39 | 39 |
40 // content::BrowserMessageFilter implementation. | 40 // BrowserMessageFilter implementation. |
41 virtual bool OnMessageReceived(const IPC::Message& message, | 41 virtual bool OnMessageReceived(const IPC::Message& message, |
42 bool* message_was_ok) OVERRIDE; | 42 bool* message_was_ok) OVERRIDE; |
43 virtual void OnChannelClosing() OVERRIDE; | 43 virtual void OnChannelClosing() OVERRIDE; |
44 | 44 |
45 protected: | 45 protected: |
46 virtual ~MediaStreamDispatcherHost(); | 46 virtual ~MediaStreamDispatcherHost(); |
47 | 47 |
48 private: | 48 private: |
49 friend class MockMediaStreamDispatcherHost; | 49 friend class MockMediaStreamDispatcherHost; |
50 | 50 |
51 void OnGenerateStream(int render_view_id, | 51 void OnGenerateStream(int render_view_id, |
52 int page_request_id, | 52 int page_request_id, |
53 const StreamOptions& components, | 53 const StreamOptions& components, |
54 const GURL& security_origin); | 54 const GURL& security_origin); |
55 void OnGenerateStreamForDevice(int render_view_id, | 55 void OnGenerateStreamForDevice(int render_view_id, |
56 int page_request_id, | 56 int page_request_id, |
57 const StreamOptions& components, | 57 const StreamOptions& components, |
58 const std::string& device_id, | 58 const std::string& device_id, |
59 const GURL& security_origin); | 59 const GURL& security_origin); |
60 void OnCancelGenerateStream(int render_view_id, | 60 void OnCancelGenerateStream(int render_view_id, |
61 int page_request_id); | 61 int page_request_id); |
62 void OnStopGeneratedStream(int render_view_id, const std::string& label); | 62 void OnStopGeneratedStream(int render_view_id, const std::string& label); |
63 | 63 |
64 void OnEnumerateDevices(int render_view_id, | 64 void OnEnumerateDevices(int render_view_id, |
65 int page_request_id, | 65 int page_request_id, |
66 media_stream::MediaStreamType type, | 66 MediaStreamType type, |
67 const GURL& security_origin); | 67 const GURL& security_origin); |
68 | 68 |
69 void OnOpenDevice(int render_view_id, | 69 void OnOpenDevice(int render_view_id, |
70 int page_request_id, | 70 int page_request_id, |
71 const std::string& device_id, | 71 const std::string& device_id, |
72 media_stream::MediaStreamType type, | 72 MediaStreamType type, |
73 const GURL& security_origin); | 73 const GURL& security_origin); |
74 | 74 |
75 // Returns the media stream manager to forward events to, | 75 // Returns the media stream manager to forward events to, |
76 // creating one if needed. It is a virtual function so that the unit tests | 76 // creating one if needed. It is a virtual function so that the unit tests |
77 // can inject their own MediaStreamManager. | 77 // can inject their own MediaStreamManager. |
78 virtual MediaStreamManager* GetManager(); | 78 virtual MediaStreamManager* GetManager(); |
79 | 79 |
80 int render_process_id_; | 80 int render_process_id_; |
81 | 81 |
82 struct StreamRequest; | 82 struct StreamRequest; |
83 typedef std::map<std::string, StreamRequest> StreamMap; | 83 typedef std::map<std::string, StreamRequest> StreamMap; |
84 // Streams generated for this host. | 84 // Streams generated for this host. |
85 StreamMap streams_; | 85 StreamMap streams_; |
86 | 86 |
87 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost); | 87 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost); |
88 }; | 88 }; |
89 | 89 |
90 } // namespace media_stream | 90 } // namespace content |
91 | 91 |
92 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ | 92 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ |
OLD | NEW |