| 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 #include <vector> |
| 11 | 12 |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/weak_ptr.h" |
| 13 #include "content/browser/renderer_host/media/media_stream_manager.h" | 15 #include "content/browser/renderer_host/media/media_stream_manager.h" |
| 14 #include "content/browser/renderer_host/media/media_stream_requester.h" | 16 #include "content/browser/renderer_host/media/media_stream_requester.h" |
| 15 #include "content/common/content_export.h" | 17 #include "content/common/content_export.h" |
| 16 #include "content/common/media/media_stream_options.h" | 18 #include "content/common/media/media_stream_options.h" |
| 17 #include "content/public/browser/browser_message_filter.h" | 19 #include "content/public/browser/browser_message_filter.h" |
| 18 #include "content/public/browser/resource_context.h" | 20 #include "content/public/browser/resource_context.h" |
| 19 | 21 #include "url/origin.h" |
| 20 namespace url { | |
| 21 class Origin; | |
| 22 } | |
| 23 | 22 |
| 24 namespace content { | 23 namespace content { |
| 25 | 24 |
| 26 class MediaStreamManager; | 25 class MediaStreamManager; |
| 26 class MediaStreamUIProxy; |
| 27 class ResourceContext; | 27 class ResourceContext; |
| 28 | 28 |
| 29 // MediaStreamDispatcherHost is a delegate for Media Stream API messages used by | 29 // MediaStreamDispatcherHost is a delegate for Media Stream API messages used by |
| 30 // MediaStreamImpl. There is one MediaStreamDispatcherHost per | 30 // MediaStreamImpl. There is one MediaStreamDispatcherHost per |
| 31 // RenderProcessHost, the former owned by the latter. | 31 // RenderProcessHost, the former owned by the latter. |
| 32 class CONTENT_EXPORT MediaStreamDispatcherHost : public BrowserMessageFilter, | 32 class CONTENT_EXPORT MediaStreamDispatcherHost : public BrowserMessageFilter, |
| 33 public MediaStreamRequester { | 33 public MediaStreamRequester { |
| 34 public: | 34 public: |
| 35 MediaStreamDispatcherHost( | 35 MediaStreamDispatcherHost(int render_process_id, |
| 36 int render_process_id, | 36 const ResourceContext::SaltCallback& salt_callback, |
| 37 const ResourceContext::SaltCallback& salt_callback, | 37 MediaStreamManager* media_stream_manager, |
| 38 MediaStreamManager* media_stream_manager); | 38 bool use_fake_ui = false); |
| 39 | 39 |
| 40 // MediaStreamRequester implementation. | 40 // MediaStreamRequester implementation. |
| 41 void StreamGenerated(int render_frame_id, | 41 void StreamGenerated(int render_frame_id, |
| 42 int page_request_id, | 42 int page_request_id, |
| 43 const std::string& label, | 43 const std::string& label, |
| 44 const StreamDeviceInfoArray& audio_devices, | 44 const StreamDeviceInfoArray& audio_devices, |
| 45 const StreamDeviceInfoArray& video_devices) override; | 45 const StreamDeviceInfoArray& video_devices) override; |
| 46 void StreamGenerationFailed( | 46 void StreamGenerationFailed( |
| 47 int render_frame_id, | 47 int render_frame_id, |
| 48 int page_request_id, | 48 int page_request_id, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 void OnOpenDevice(int render_frame_id, | 91 void OnOpenDevice(int render_frame_id, |
| 92 int page_request_id, | 92 int page_request_id, |
| 93 const std::string& device_id, | 93 const std::string& device_id, |
| 94 MediaStreamType type, | 94 MediaStreamType type, |
| 95 const url::Origin& security_origin); | 95 const url::Origin& security_origin); |
| 96 | 96 |
| 97 void OnCloseDevice(int render_frame_id, | 97 void OnCloseDevice(int render_frame_id, |
| 98 const std::string& label); | 98 const std::string& label); |
| 99 | 99 |
| 100 void OnSubscribeToDeviceChangeNotifications( |
| 101 int render_frame_id, |
| 102 const url::Origin& security_origin); |
| 103 |
| 104 void OnCancelDeviceChangeNotifications(int render_frame_id); |
| 105 |
| 100 void StoreRequest(int render_frame_id, | 106 void StoreRequest(int render_frame_id, |
| 101 int page_request_id, | 107 int page_request_id, |
| 102 const std::string& label); | 108 const std::string& label); |
| 103 | 109 |
| 110 std::unique_ptr<MediaStreamUIProxy> CreateMediaStreamUIProxy(); |
| 111 void HandleCheckAccessResponse(std::unique_ptr<MediaStreamUIProxy> ui_proxy, |
| 112 int render_frame_id, |
| 113 bool have_access); |
| 114 |
| 104 int render_process_id_; | 115 int render_process_id_; |
| 105 ResourceContext::SaltCallback salt_callback_; | 116 ResourceContext::SaltCallback salt_callback_; |
| 106 MediaStreamManager* media_stream_manager_; | 117 MediaStreamManager* media_stream_manager_; |
| 107 | 118 |
| 119 struct DeviceChangeSubscriberInfo { |
| 120 int render_frame_id; |
| 121 url::Origin security_origin; |
| 122 }; |
| 123 std::vector<DeviceChangeSubscriberInfo> device_change_subscribers_; |
| 124 bool use_fake_ui_; |
| 125 |
| 126 base::WeakPtrFactory<MediaStreamDispatcherHost> weak_factory_; |
| 127 |
| 108 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost); | 128 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcherHost); |
| 109 }; | 129 }; |
| 110 | 130 |
| 111 } // namespace content | 131 } // namespace content |
| 112 | 132 |
| 113 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ | 133 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_DISPATCHER_HOST_H_ |
| OLD | NEW |