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 content { | 18 namespace content { |
| 19 class MediaStreamManager; |
19 | 20 |
20 // MediaStreamDispatcherHost is a delegate for Media Stream API messages used by | 21 // MediaStreamDispatcherHost is a delegate for Media Stream API messages used by |
21 // MediaStreamImpl. It's the complement of MediaStreamDispatcher | 22 // MediaStreamImpl. It's the complement of MediaStreamDispatcher |
22 // (owned by RenderView). | 23 // (owned by RenderView). |
23 class CONTENT_EXPORT MediaStreamDispatcherHost : public BrowserMessageFilter, | 24 class CONTENT_EXPORT MediaStreamDispatcherHost : public BrowserMessageFilter, |
24 public MediaStreamRequester { | 25 public MediaStreamRequester { |
25 public: | 26 public: |
26 explicit MediaStreamDispatcherHost(int render_process_id); | 27 MediaStreamDispatcherHost(int render_process_id, |
| 28 MediaStreamManager* media_stream_manager); |
27 | 29 |
28 // MediaStreamRequester implementation. | 30 // MediaStreamRequester implementation. |
29 virtual void StreamGenerated( | 31 virtual void StreamGenerated( |
30 const std::string& label, | 32 const std::string& label, |
31 const StreamDeviceInfoArray& audio_devices, | 33 const StreamDeviceInfoArray& audio_devices, |
32 const StreamDeviceInfoArray& video_devices) OVERRIDE; | 34 const StreamDeviceInfoArray& video_devices) OVERRIDE; |
33 virtual void StreamGenerationFailed(const std::string& label) OVERRIDE; | 35 virtual void StreamGenerationFailed(const std::string& label) OVERRIDE; |
34 virtual void DevicesEnumerated(const std::string& label, | 36 virtual void DevicesEnumerated(const std::string& label, |
35 const StreamDeviceInfoArray& devices) OVERRIDE; | 37 const StreamDeviceInfoArray& devices) OVERRIDE; |
36 virtual void DeviceOpened(const std::string& label, | 38 virtual void DeviceOpened(const std::string& label, |
(...skipping 22 matching lines...) Expand all Loading... |
59 int page_request_id, | 61 int page_request_id, |
60 MediaStreamType type, | 62 MediaStreamType type, |
61 const GURL& security_origin); | 63 const GURL& security_origin); |
62 | 64 |
63 void OnOpenDevice(int render_view_id, | 65 void OnOpenDevice(int render_view_id, |
64 int page_request_id, | 66 int page_request_id, |
65 const std::string& device_id, | 67 const std::string& device_id, |
66 MediaStreamType type, | 68 MediaStreamType type, |
67 const GURL& security_origin); | 69 const GURL& security_origin); |
68 | 70 |
69 // Returns the media stream manager to forward events to, | |
70 // creating one if needed. It is a virtual function so that the unit tests | |
71 // can inject their own MediaStreamManager. | |
72 virtual MediaStreamManager* GetManager(); | |
73 | |
74 int render_process_id_; | 71 int render_process_id_; |
| 72 MediaStreamManager* media_stream_manager_; |
75 | 73 |
76 struct StreamRequest; | 74 struct StreamRequest; |
77 typedef std::map<std::string, StreamRequest> StreamMap; | 75 typedef std::map<std::string, StreamRequest> StreamMap; |
78 // Streams generated for this host. | 76 // Streams generated for this host. |
79 StreamMap streams_; | 77 StreamMap streams_; |
80 | 78 |
81 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost); | 79 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost); |
82 }; | 80 }; |
83 | 81 |
84 } // namespace content | 82 } // namespace content |
85 | 83 |
86 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ | 84 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ |
OLD | NEW |