Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: content/renderer/pepper/pepper_media_device_manager.cc

Issue 2872913003: Do not pass the origin to MediaDevicesDispatcherHost. (Closed)
Patch Set: Add tests with unique origin Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/pepper/pepper_media_device_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "content/renderer/pepper/pepper_media_device_manager.h" 5 #include "content/renderer/pepper/pepper_media_device_manager.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 : RenderFrameObserver(render_frame), 74 : RenderFrameObserver(render_frame),
75 RenderFrameObserverTracker<PepperMediaDeviceManager>(render_frame), 75 RenderFrameObserverTracker<PepperMediaDeviceManager>(render_frame),
76 next_id_(1) {} 76 next_id_(1) {}
77 77
78 PepperMediaDeviceManager::~PepperMediaDeviceManager() { 78 PepperMediaDeviceManager::~PepperMediaDeviceManager() {
79 DCHECK(open_callbacks_.empty()); 79 DCHECK(open_callbacks_.empty());
80 } 80 }
81 81
82 void PepperMediaDeviceManager::EnumerateDevices( 82 void PepperMediaDeviceManager::EnumerateDevices(
83 PP_DeviceType_Dev type, 83 PP_DeviceType_Dev type,
84 const GURL& document_url,
85 const DevicesCallback& callback) { 84 const DevicesCallback& callback) {
86 #if BUILDFLAG(ENABLE_WEBRTC) 85 #if BUILDFLAG(ENABLE_WEBRTC)
87 bool request_audio_input = type == PP_DEVICETYPE_DEV_AUDIOCAPTURE; 86 bool request_audio_input = type == PP_DEVICETYPE_DEV_AUDIOCAPTURE;
88 bool request_video_input = type == PP_DEVICETYPE_DEV_VIDEOCAPTURE; 87 bool request_video_input = type == PP_DEVICETYPE_DEV_VIDEOCAPTURE;
89 bool request_audio_output = type == PP_DEVICETYPE_DEV_AUDIOOUTPUT; 88 bool request_audio_output = type == PP_DEVICETYPE_DEV_AUDIOOUTPUT;
90 CHECK(request_audio_input || request_video_input || request_audio_output); 89 CHECK(request_audio_input || request_video_input || request_audio_output);
91 GetMediaDevicesDispatcher()->EnumerateDevices( 90 GetMediaDevicesDispatcher()->EnumerateDevices(
92 request_audio_input, request_video_input, request_audio_output, 91 request_audio_input, request_video_input, request_audio_output,
93 url::Origin(document_url.GetOrigin()),
94 base::Bind(&PepperMediaDeviceManager::DevicesEnumerated, AsWeakPtr(), 92 base::Bind(&PepperMediaDeviceManager::DevicesEnumerated, AsWeakPtr(),
95 callback, ToMediaDeviceType(type))); 93 callback, ToMediaDeviceType(type)));
96 #else 94 #else
97 base::ThreadTaskRunnerHandle::Get()->PostTask( 95 base::ThreadTaskRunnerHandle::Get()->PostTask(
98 FROM_HERE, base::Bind(&PepperMediaDeviceManager::DevicesEnumerated, 96 FROM_HERE, base::Bind(&PepperMediaDeviceManager::DevicesEnumerated,
99 AsWeakPtr(), callback, ToMediaDeviceType(type), 97 AsWeakPtr(), callback, ToMediaDeviceType(type),
100 std::vector<MediaDeviceInfoArray>())); 98 std::vector<MediaDeviceInfoArray>()));
101 #endif 99 #endif
102 } 100 }
103 101
104 uint32_t PepperMediaDeviceManager::StartMonitoringDevices( 102 uint32_t PepperMediaDeviceManager::StartMonitoringDevices(
105 PP_DeviceType_Dev type, 103 PP_DeviceType_Dev type,
106 const GURL& document_url,
107 const DevicesCallback& callback) { 104 const DevicesCallback& callback) {
108 #if BUILDFLAG(ENABLE_WEBRTC) 105 #if BUILDFLAG(ENABLE_WEBRTC)
109 base::WeakPtr<MediaDevicesEventDispatcher> event_dispatcher = 106 base::WeakPtr<MediaDevicesEventDispatcher> event_dispatcher =
110 MediaDevicesEventDispatcher::GetForRenderFrame(render_frame()); 107 MediaDevicesEventDispatcher::GetForRenderFrame(render_frame());
111 return event_dispatcher->SubscribeDeviceChangeNotifications( 108 return event_dispatcher->SubscribeDeviceChangeNotifications(
112 ToMediaDeviceType(type), url::Origin(document_url.GetOrigin()), 109 ToMediaDeviceType(type),
113 base::Bind(&PepperMediaDeviceManager::DevicesChanged, AsWeakPtr(), 110 base::Bind(&PepperMediaDeviceManager::DevicesChanged, AsWeakPtr(),
114 callback)); 111 callback));
115 #else 112 #else
116 return 0; 113 return 0;
117 #endif 114 #endif
118 } 115 }
119 116
120 void PepperMediaDeviceManager::StopMonitoringDevices(PP_DeviceType_Dev type, 117 void PepperMediaDeviceManager::StopMonitoringDevices(PP_DeviceType_Dev type,
121 uint32_t subscription_id) { 118 uint32_t subscription_id) {
122 #if BUILDFLAG(ENABLE_WEBRTC) 119 #if BUILDFLAG(ENABLE_WEBRTC)
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 270 }
274 271
275 return media_devices_dispatcher_; 272 return media_devices_dispatcher_;
276 } 273 }
277 274
278 void PepperMediaDeviceManager::OnDestruct() { 275 void PepperMediaDeviceManager::OnDestruct() {
279 delete this; 276 delete this;
280 } 277 }
281 278
282 } // namespace content 279 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_media_device_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698