diff options
Diffstat (limited to 'content/browser/renderer_host')
17 files changed, 192 insertions, 222 deletions
diff --git a/content/browser/renderer_host/media/DEPS b/content/browser/renderer_host/media/DEPS index c3a5b96..21fd0fd9 100644 --- a/content/browser/renderer_host/media/DEPS +++ b/content/browser/renderer_host/media/DEPS @@ -1,3 +1,11 @@ include_rules = [ "+media", ] + +specific_include_rules = { + # TODO(miu): Need to relocate MediaStreamManager/DispatcherHost/UIProxy and + # friends to somewhere more appropriate. Perhaps content/browser/media? + "media_stream_ui_proxy(_unittest)?\.cc": [ + "+content/browser/frame_host", + ], +} diff --git a/content/browser/renderer_host/media/device_request_message_filter.cc b/content/browser/renderer_host/media/device_request_message_filter.cc index db0d175..d15039d 100644 --- a/content/browser/renderer_host/media/device_request_message_filter.cc +++ b/content/browser/renderer_host/media/device_request_message_filter.cc @@ -53,7 +53,7 @@ struct DeviceRequestMessageFilter::DeviceRequest { }; void DeviceRequestMessageFilter::DevicesEnumerated( - int render_view_id, + int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfoArray& new_devices) { diff --git a/content/browser/renderer_host/media/device_request_message_filter.h b/content/browser/renderer_host/media/device_request_message_filter.h index 2ec54cc..4bf30aa 100644 --- a/content/browser/renderer_host/media/device_request_message_filter.h +++ b/content/browser/renderer_host/media/device_request_message_filter.h @@ -32,22 +32,22 @@ class CONTENT_EXPORT DeviceRequestMessageFilter : public BrowserMessageFilter, // we don't have to override all these callbacks we don't care about. // (crbug.com/249476) virtual void StreamGenerated( - int render_view_id, int page_request_id, const std::string& label, + int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfoArray& audio_devices, const StreamDeviceInfoArray& video_devices) OVERRIDE {} virtual void StreamGenerationFailed( - int render_view_id, + int render_frame_id, int page_request_id, content::MediaStreamRequestResult result) OVERRIDE {} - virtual void DeviceStopped(int render_view_id, + virtual void DeviceStopped(int render_frame_id, const std::string& label, const StreamDeviceInfo& device) OVERRIDE {} - virtual void DeviceOpened(int render_view_id, + virtual void DeviceOpened(int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfo& video_device) OVERRIDE {} // DevicesEnumerated() is the only callback we're interested in. - virtual void DevicesEnumerated(int render_view_id, + virtual void DevicesEnumerated(int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfoArray& devices) OVERRIDE; diff --git a/content/browser/renderer_host/media/device_request_message_filter_unittest.cc b/content/browser/renderer_host/media/device_request_message_filter_unittest.cc index 6d6a9e3..628bd19 100644 --- a/content/browser/renderer_host/media/device_request_message_filter_unittest.cc +++ b/content/browser/renderer_host/media/device_request_message_filter_unittest.cc @@ -28,7 +28,7 @@ class MockMediaStreamManager : public MediaStreamManager { MOCK_METHOD8(EnumerateDevices, std::string(MediaStreamRequester* requester, int render_process_id, - int render_view_id, + int render_frame_id, const ResourceContext::SaltCallback& rc, int page_request_id, MediaStreamType type, @@ -37,7 +37,7 @@ class MockMediaStreamManager : public MediaStreamManager { std::string DoEnumerateDevices(MediaStreamRequester* requester, int render_process_id, - int render_view_id, + int render_frame_id, const ResourceContext::SaltCallback& rc, int page_request_id, MediaStreamType type, diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host.cc index 91fad34..327efce 100644 --- a/content/browser/renderer_host/media/media_stream_dispatcher_host.cc +++ b/content/browser/renderer_host/media/media_stream_dispatcher_host.cc @@ -26,7 +26,7 @@ MediaStreamDispatcherHost::MediaStreamDispatcherHost( } void MediaStreamDispatcherHost::StreamGenerated( - int render_view_id, + int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfoArray& audio_devices, @@ -36,12 +36,11 @@ void MediaStreamDispatcherHost::StreamGenerated( << ", {label = " << label << "})"; Send(new MediaStreamMsg_StreamGenerated( - render_view_id, page_request_id, label, audio_devices, - video_devices)); + render_frame_id, page_request_id, label, audio_devices, video_devices)); } void MediaStreamDispatcherHost::StreamGenerationFailed( - int render_view_id, + int render_frame_id, int page_request_id, content::MediaStreamRequestResult result) { DCHECK_CURRENTLY_ON(BrowserThread::IO); @@ -50,12 +49,12 @@ void MediaStreamDispatcherHost::StreamGenerationFailed( << ", { result= " << result << "})"; - Send(new MediaStreamMsg_StreamGenerationFailed(render_view_id, + Send(new MediaStreamMsg_StreamGenerationFailed(render_frame_id, page_request_id, result)); } -void MediaStreamDispatcherHost::DeviceStopped(int render_view_id, +void MediaStreamDispatcherHost::DeviceStopped(int render_frame_id, const std::string& label, const StreamDeviceInfo& device) { DCHECK_CURRENTLY_ON(BrowserThread::IO); @@ -64,11 +63,11 @@ void MediaStreamDispatcherHost::DeviceStopped(int render_view_id, << "{type = " << device.device.type << "}, " << "{device_id = " << device.device.id << "})"; - Send(new MediaStreamMsg_DeviceStopped(render_view_id, label, device)); + Send(new MediaStreamMsg_DeviceStopped(render_frame_id, label, device)); } void MediaStreamDispatcherHost::DevicesEnumerated( - int render_view_id, + int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfoArray& devices) { @@ -76,12 +75,12 @@ void MediaStreamDispatcherHost::DevicesEnumerated( DVLOG(1) << "MediaStreamDispatcherHost::DevicesEnumerated(" << ", {page_request_id = " << page_request_id << "})"; - Send(new MediaStreamMsg_DevicesEnumerated(render_view_id, page_request_id, + Send(new MediaStreamMsg_DevicesEnumerated(render_frame_id, page_request_id, devices)); } void MediaStreamDispatcherHost::DeviceOpened( - int render_view_id, + int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfo& video_device) { @@ -90,7 +89,7 @@ void MediaStreamDispatcherHost::DeviceOpened( << ", {page_request_id = " << page_request_id << "})"; Send(new MediaStreamMsg_DeviceOpened( - render_view_id, page_request_id, label, video_device)); + render_frame_id, page_request_id, label, video_device)); } bool MediaStreamDispatcherHost::OnMessageReceived(const IPC::Message& message) { @@ -125,13 +124,13 @@ MediaStreamDispatcherHost::~MediaStreamDispatcherHost() { } void MediaStreamDispatcherHost::OnGenerateStream( - int render_view_id, + int render_frame_id, int page_request_id, const StreamOptions& components, const GURL& security_origin, bool user_gesture) { DVLOG(1) << "MediaStreamDispatcherHost::OnGenerateStream(" - << render_view_id << ", " + << render_frame_id << ", " << page_request_id << ", [" << " audio:" << components.audio_requested << " video:" << components.video_requested @@ -143,37 +142,37 @@ void MediaStreamDispatcherHost::OnGenerateStream( return; media_stream_manager_->GenerateStream( - this, render_process_id_, render_view_id, salt_callback_, + this, render_process_id_, render_frame_id, salt_callback_, page_request_id, components, security_origin, user_gesture); } -void MediaStreamDispatcherHost::OnCancelGenerateStream(int render_view_id, +void MediaStreamDispatcherHost::OnCancelGenerateStream(int render_frame_id, int page_request_id) { DVLOG(1) << "MediaStreamDispatcherHost::OnCancelGenerateStream(" - << render_view_id << ", " + << render_frame_id << ", " << page_request_id << ")"; - media_stream_manager_->CancelRequest(render_process_id_, render_view_id, + media_stream_manager_->CancelRequest(render_process_id_, render_frame_id, page_request_id); } void MediaStreamDispatcherHost::OnStopStreamDevice( - int render_view_id, + int render_frame_id, const std::string& device_id) { DVLOG(1) << "MediaStreamDispatcherHost::OnStopStreamDevice(" - << render_view_id << ", " + << render_frame_id << ", " << device_id << ")"; - media_stream_manager_->StopStreamDevice(render_process_id_, render_view_id, + media_stream_manager_->StopStreamDevice(render_process_id_, render_frame_id, device_id); } void MediaStreamDispatcherHost::OnEnumerateDevices( - int render_view_id, + int render_frame_id, int page_request_id, MediaStreamType type, const GURL& security_origin, bool hide_labels_if_no_access) { DVLOG(1) << "MediaStreamDispatcherHost::OnEnumerateDevices(" - << render_view_id << ", " + << render_frame_id << ", " << page_request_id << ", " << type << ", " << security_origin.spec() << ")"; @@ -194,28 +193,28 @@ void MediaStreamDispatcherHost::OnEnumerateDevices( } media_stream_manager_->EnumerateDevices( - this, render_process_id_, render_view_id, salt_callback_, + this, render_process_id_, render_frame_id, salt_callback_, page_request_id, type, security_origin, have_permission); } void MediaStreamDispatcherHost::OnCancelEnumerateDevices( - int render_view_id, + int render_frame_id, int page_request_id) { DVLOG(1) << "MediaStreamDispatcherHost::OnCancelEnumerateDevices(" - << render_view_id << ", " + << render_frame_id << ", " << page_request_id << ")"; - media_stream_manager_->CancelRequest(render_process_id_, render_view_id, + media_stream_manager_->CancelRequest(render_process_id_, render_frame_id, page_request_id); } void MediaStreamDispatcherHost::OnOpenDevice( - int render_view_id, + int render_frame_id, int page_request_id, const std::string& device_id, MediaStreamType type, const GURL& security_origin) { DVLOG(1) << "MediaStreamDispatcherHost::OnOpenDevice(" - << render_view_id << ", " + << render_frame_id << ", " << page_request_id << ", device_id: " << device_id.c_str() << ", type: " << type << ", " @@ -225,15 +224,15 @@ void MediaStreamDispatcherHost::OnOpenDevice( return; media_stream_manager_->OpenDevice( - this, render_process_id_, render_view_id, salt_callback_, + this, render_process_id_, render_frame_id, salt_callback_, page_request_id, device_id, type, security_origin); } void MediaStreamDispatcherHost::OnCloseDevice( - int render_view_id, + int render_frame_id, const std::string& label) { DVLOG(1) << "MediaStreamDispatcherHost::OnCloseDevice(" - << render_view_id << ", " + << render_frame_id << ", " << label << ")"; media_stream_manager_->CancelRequest(label); diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host.h b/content/browser/renderer_host/media/media_stream_dispatcher_host.h index b599c39..d467718 100644 --- a/content/browser/renderer_host/media/media_stream_dispatcher_host.h +++ b/content/browser/renderer_host/media/media_stream_dispatcher_host.h @@ -22,8 +22,8 @@ class MediaStreamManager; class ResourceContext; // MediaStreamDispatcherHost is a delegate for Media Stream API messages used by -// MediaStreamImpl. It's the complement of MediaStreamDispatcher -// (owned by RenderView). +// MediaStreamImpl. There is one MediaStreamDispatcherHost per +// RenderProcessHost, the former owned by the latter. class CONTENT_EXPORT MediaStreamDispatcherHost : public BrowserMessageFilter, public MediaStreamRequester { public: @@ -35,23 +35,23 @@ class CONTENT_EXPORT MediaStreamDispatcherHost : public BrowserMessageFilter, // MediaStreamRequester implementation. virtual void StreamGenerated( - int render_view_id, + int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfoArray& audio_devices, const StreamDeviceInfoArray& video_devices) OVERRIDE; virtual void StreamGenerationFailed( - int render_view_id, + int render_frame_id, int page_request_id, content::MediaStreamRequestResult result) OVERRIDE; - virtual void DeviceStopped(int render_view_id, + virtual void DeviceStopped(int render_frame_id, const std::string& label, const StreamDeviceInfo& device) OVERRIDE; - virtual void DevicesEnumerated(int render_view_id, + virtual void DevicesEnumerated(int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfoArray& devices) OVERRIDE; - virtual void DeviceOpened(int render_view_id, + virtual void DeviceOpened(int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfo& video_device) OVERRIDE; @@ -66,35 +66,35 @@ class CONTENT_EXPORT MediaStreamDispatcherHost : public BrowserMessageFilter, private: friend class MockMediaStreamDispatcherHost; - void OnGenerateStream(int render_view_id, + void OnGenerateStream(int render_frame_id, int page_request_id, const StreamOptions& components, const GURL& security_origin, bool user_gesture); - void OnCancelGenerateStream(int render_view_id, + void OnCancelGenerateStream(int render_frame_id, int page_request_id); - void OnStopStreamDevice(int render_view_id, + void OnStopStreamDevice(int render_frame_id, const std::string& device_id); - void OnEnumerateDevices(int render_view_id, + void OnEnumerateDevices(int render_frame_id, int page_request_id, MediaStreamType type, const GURL& security_origin, bool hide_labels_if_no_access); - void OnCancelEnumerateDevices(int render_view_id, + void OnCancelEnumerateDevices(int render_frame_id, int page_request_id); - void OnOpenDevice(int render_view_id, + void OnOpenDevice(int render_frame_id, int page_request_id, const std::string& device_id, MediaStreamType type, const GURL& security_origin); - void OnCloseDevice(int render_view_id, + void OnCloseDevice(int render_frame_id, const std::string& label); - void StoreRequest(int render_view_id, + void StoreRequest(int render_frame_id, int page_request_id, const std::string& label); diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc index a7edd38..24366a5 100644 --- a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc @@ -70,22 +70,22 @@ class MockMediaStreamDispatcherHost : public MediaStreamDispatcherHost, MOCK_METHOD2(OnDeviceOpened, void(int routing_id, int request_id)); // Accessor to private functions. - void OnGenerateStream(int render_view_id, + void OnGenerateStream(int render_frame_id, int page_request_id, const StreamOptions& components, const GURL& security_origin, const base::Closure& quit_closure) { quit_closures_.push(quit_closure); MediaStreamDispatcherHost::OnGenerateStream( - render_view_id, page_request_id, components, security_origin, false); + render_frame_id, page_request_id, components, security_origin, false); } - void OnStopStreamDevice(int render_view_id, + void OnStopStreamDevice(int render_frame_id, const std::string& device_id) { - MediaStreamDispatcherHost::OnStopStreamDevice(render_view_id, device_id); + MediaStreamDispatcherHost::OnStopStreamDevice(render_frame_id, device_id); } - void OnOpenDevice(int render_view_id, + void OnOpenDevice(int render_frame_id, int page_request_id, const std::string& device_id, MediaStreamType type, @@ -93,10 +93,10 @@ class MockMediaStreamDispatcherHost : public MediaStreamDispatcherHost, const base::Closure& quit_closure) { quit_closures_.push(quit_closure); MediaStreamDispatcherHost::OnOpenDevice( - render_view_id, page_request_id, device_id, type, security_origin); + render_frame_id, page_request_id, device_id, type, security_origin); } - void OnEnumerateDevices(int render_view_id, + void OnEnumerateDevices(int render_frame_id, int page_request_id, MediaStreamType type, const GURL& security_origin, @@ -104,7 +104,7 @@ class MockMediaStreamDispatcherHost : public MediaStreamDispatcherHost, const base::Closure& quit_closure) { quit_closures_.push(quit_closure); MediaStreamDispatcherHost::OnEnumerateDevices( - render_view_id, page_request_id, type, security_origin, + render_frame_id, page_request_id, type, security_origin, hide_labels_if_no_access); } @@ -279,7 +279,7 @@ class MediaStreamDispatcherHostTest : public testing::Test { stream_ui.PassAs<FakeMediaStreamUIProxy>()); } - void GenerateStreamAndWaitForResult(int render_view_id, + void GenerateStreamAndWaitForResult(int render_frame_id, int page_request_id, const StreamOptions& options) { base::RunLoop run_loop; @@ -289,10 +289,11 @@ class MediaStreamDispatcherHostTest : public testing::Test { int expected_video_array_size = (options.video_requested && physical_video_devices_.size() > 0) ? 1 : 0; - EXPECT_CALL(*host_.get(), OnStreamGenerated(render_view_id, page_request_id, + EXPECT_CALL(*host_.get(), OnStreamGenerated(render_frame_id, + page_request_id, expected_audio_array_size, expected_video_array_size)); - host_->OnGenerateStream(render_view_id, page_request_id, options, origin_, + host_->OnGenerateStream(render_frame_id, page_request_id, options, origin_, run_loop.QuitClosure()); run_loop.Run(); EXPECT_FALSE(DoesContainRawIds(host_->audio_devices_)); @@ -302,25 +303,25 @@ class MediaStreamDispatcherHostTest : public testing::Test { } void GenerateStreamAndWaitForFailure( - int render_view_id, + int render_frame_id, int page_request_id, const StreamOptions& options, MediaStreamRequestResult expected_result) { base::RunLoop run_loop; EXPECT_CALL(*host_.get(), - OnStreamGenerationFailed(render_view_id, + OnStreamGenerationFailed(render_frame_id, page_request_id, expected_result)); - host_->OnGenerateStream(render_view_id, page_request_id, options, origin_, - run_loop.QuitClosure()); + host_->OnGenerateStream(render_frame_id, page_request_id, options, + origin_, run_loop.QuitClosure()); run_loop.Run(); } - void OpenVideoDeviceAndWaitForResult(int render_view_id, + void OpenVideoDeviceAndWaitForResult(int render_frame_id, int page_request_id, const std::string& device_id) { base::RunLoop run_loop; - host_->OnOpenDevice(render_view_id, page_request_id, device_id, + host_->OnOpenDevice(render_frame_id, page_request_id, device_id, MEDIA_DEVICE_VIDEO_CAPTURE, origin_, run_loop.QuitClosure()); run_loop.Run(); @@ -328,12 +329,12 @@ class MediaStreamDispatcherHostTest : public testing::Test { EXPECT_TRUE(DoesEveryDeviceMapToRawId(host_->video_devices_, origin_)); } - void EnumerateDevicesAndWaitForResult(int render_view_id, + void EnumerateDevicesAndWaitForResult(int render_frame_id, int page_request_id, MediaStreamType type, bool hide_labels_if_no_access) { base::RunLoop run_loop; - host_->OnEnumerateDevices(render_view_id, page_request_id, type, origin_, + host_->OnEnumerateDevices(render_frame_id, page_request_id, type, origin_, hide_labels_if_no_access, run_loop.QuitClosure()); run_loop.Run(); ASSERT_FALSE(host_->enumerated_devices_.empty()); @@ -470,8 +471,8 @@ TEST_F(MediaStreamDispatcherHostTest, GenerateStreamWithAudioAndVideo) { EXPECT_EQ(host_->video_devices_.size(), 1u); } -// This test generates two streams with video only using the same render view -// id. The same capture device with the same device and session id is expected +// This test generates two streams with video only using the same render frame +// id. The same capture device with the same device and session id is expected // to be used. TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsFromSameRenderId) { StreamOptions options(false, true); @@ -530,7 +531,7 @@ TEST_F(MediaStreamDispatcherHostTest, // This test generates two streams with video only using two separate render -// view ids. The same device id but different session ids are expected. +// frame ids. The same device id but different session ids are expected. TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsDifferentRenderId) { StreamOptions options(false, true); @@ -545,7 +546,7 @@ TEST_F(MediaStreamDispatcherHostTest, GenerateStreamsDifferentRenderId) { const std::string device_id1 = host_->video_devices_.front().device.id; const int session_id1 = host_->video_devices_.front().session_id; - // Generate second stream from another render view. + // Generate second stream from another render frame. SetupFakeUI(true); GenerateStreamAndWaitForResult(kRenderId+1, kPageRequestId + 1, options); diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc index 2b337ca..21d2aa4 100644 --- a/content/browser/renderer_host/media/media_stream_manager.cc +++ b/content/browser/renderer_host/media/media_stream_manager.cc @@ -183,7 +183,7 @@ class MediaStreamManager::DeviceRequest { public: DeviceRequest(MediaStreamRequester* requester, int requesting_process_id, - int requesting_view_id, + int requesting_frame_id, int page_request_id, const GURL& security_origin, bool have_permission, @@ -193,7 +193,7 @@ class MediaStreamManager::DeviceRequest { const ResourceContext::SaltCallback& salt_callback) : requester(requester), requesting_process_id(requesting_process_id), - requesting_view_id(requesting_view_id), + requesting_frame_id(requesting_frame_id), page_request_id(page_request_id), security_origin(security_origin), have_permission(have_permission), @@ -230,7 +230,7 @@ class MediaStreamManager::DeviceRequest { const std::string& requested_video_device_id) { DCHECK(!ui_request_); ui_request_.reset(new MediaStreamRequest(requesting_process_id, - requesting_view_id, + requesting_frame_id, page_request_id, security_origin, user_gesture, @@ -243,12 +243,12 @@ class MediaStreamManager::DeviceRequest { // Creates a tab capture specific MediaStreamRequest object that is used by // this request when UI is asked for permission and device selection. - void CreateTabCatureUIRequest(int target_render_process_id, - int target_render_view_id, - const std::string& tab_capture_id) { + void CreateTabCaptureUIRequest(int target_render_process_id, + int target_render_frame_id, + const std::string& tab_capture_id) { DCHECK(!ui_request_); ui_request_.reset(new MediaStreamRequest(target_render_process_id, - target_render_view_id, + target_render_frame_id, page_request_id, security_origin, user_gesture, @@ -283,17 +283,10 @@ class MediaStreamManager::DeviceRequest { if (!ui_request_) return; - // If we appended a device_id scheme, we want to remove it when notifying - // observers which may be in different modules since this scheme is only - // used internally within the content module. - std::string device_id = - WebContentsCaptureUtil::StripWebContentsDeviceScheme( - ui_request_->tab_capture_device_id); - media_observer->OnMediaRequestStateChanged( - ui_request_->render_process_id, ui_request_->render_view_id, + ui_request_->render_process_id, ui_request_->render_frame_id, ui_request_->page_request_id, ui_request_->security_origin, - MediaStreamDevice(stream_type, device_id, device_id), new_state); + stream_type, new_state); } MediaRequestState state(MediaStreamType stream_type) const { @@ -309,13 +302,13 @@ class MediaStreamManager::DeviceRequest { // specifies the target renderer from which audio and video is captured. const int requesting_process_id; - // The render view id that requested this stream to be generated and that + // The render frame id that requested this stream to be generated and that // will receive a handle to the MediaStream. This may be different from - // MediaStreamRequest::render_view_id which in the tab capture case + // MediaStreamRequest::render_frame_id which in the tab capture case // specifies the target renderer from which audio and video is captured. - const int requesting_view_id; + const int requesting_frame_id; - // An ID the render view provided to identify this request. + // An ID the render frame provided to identify this request. const int page_request_id; const GURL security_origin; @@ -414,7 +407,7 @@ AudioInputDeviceManager* MediaStreamManager::audio_input_device_manager() { std::string MediaStreamManager::MakeMediaAccessRequest( int render_process_id, - int render_view_id, + int render_frame_id, int page_request_id, const StreamOptions& options, const GURL& security_origin, @@ -425,7 +418,7 @@ std::string MediaStreamManager::MakeMediaAccessRequest( // suggests that this is the wrong design. Can this be refactored? DeviceRequest* request = new DeviceRequest(NULL, render_process_id, - render_view_id, + render_frame_id, page_request_id, security_origin, true, @@ -451,7 +444,7 @@ std::string MediaStreamManager::MakeMediaAccessRequest( void MediaStreamManager::GenerateStream(MediaStreamRequester* requester, int render_process_id, - int render_view_id, + int render_frame_id, const ResourceContext::SaltCallback& sc, int page_request_id, const StreamOptions& options, @@ -466,7 +459,7 @@ void MediaStreamManager::GenerateStream(MediaStreamRequester* requester, DeviceRequest* request = new DeviceRequest(requester, render_process_id, - render_view_id, + render_frame_id, page_request_id, security_origin, true, @@ -489,13 +482,13 @@ void MediaStreamManager::GenerateStream(MediaStreamRequester* requester, } void MediaStreamManager::CancelRequest(int render_process_id, - int render_view_id, + int render_frame_id, int page_request_id) { for (DeviceRequests::const_iterator request_it = requests_.begin(); request_it != requests_.end(); ++request_it) { const DeviceRequest* request = request_it->second; if (request->requesting_process_id == render_process_id && - request->requesting_view_id == render_view_id && + request->requesting_frame_id == render_frame_id && request->page_request_id == page_request_id) { CancelRequest(request_it->first); return; @@ -557,19 +550,19 @@ void MediaStreamManager::CancelAllRequests(int render_process_id) { } void MediaStreamManager::StopStreamDevice(int render_process_id, - int render_view_id, + int render_frame_id, const std::string& device_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - DVLOG(1) << "StopStreamDevice({render_view_id = " << render_view_id << "} " + DVLOG(1) << "StopStreamDevice({render_frame_id = " << render_frame_id << "} " << ", {device_id = " << device_id << "})"; - // Find the first request for this |render_process_id| and |render_view_id| + // Find the first request for this |render_process_id| and |render_frame_id| // of type MEDIA_GENERATE_STREAM that has requested to use |device_id| and // stop it. for (DeviceRequests::iterator request_it = requests_.begin(); - request_it != requests_.end(); ++request_it) { + request_it != requests_.end(); ++request_it) { DeviceRequest* request = request_it->second; if (request->requesting_process_id != render_process_id || - request->requesting_view_id != render_view_id || + request->requesting_frame_id != render_frame_id || request->request_type != MEDIA_GENERATE_STREAM) { continue; } @@ -648,7 +641,7 @@ void MediaStreamManager::CloseDevice(MediaStreamType type, int session_id) { std::string MediaStreamManager::EnumerateDevices( MediaStreamRequester* requester, int render_process_id, - int render_view_id, + int render_frame_id, const ResourceContext::SaltCallback& sc, int page_request_id, MediaStreamType type, @@ -662,7 +655,7 @@ std::string MediaStreamManager::EnumerateDevices( DeviceRequest* request = new DeviceRequest(requester, render_process_id, - render_view_id, + render_frame_id, page_request_id, security_origin, have_permission, @@ -733,8 +726,7 @@ void MediaStreamManager::DoEnumerateDevices(const std::string& label) { DVLOG(1) << "Enumerate Devices ({label = " << label << "})"; } -void MediaStreamManager::EnumerateAudioOutputDevices( - const std::string& label) { +void MediaStreamManager::EnumerateAudioOutputDevices(const std::string& label) { DCHECK(device_task_runner_->BelongsToCurrentThread()); scoped_ptr<media::AudioDeviceNames> device_names( @@ -786,7 +778,7 @@ void MediaStreamManager::AudioOutputDevicesEnumerated( void MediaStreamManager::OpenDevice(MediaStreamRequester* requester, int render_process_id, - int render_view_id, + int render_frame_id, const ResourceContext::SaltCallback& sc, int page_request_id, const std::string& device_id, @@ -810,7 +802,7 @@ void MediaStreamManager::OpenDevice(MediaStreamRequester* requester, } DeviceRequest* request = new DeviceRequest(requester, render_process_id, - render_view_id, + render_frame_id, page_request_id, security_origin, true, @@ -910,7 +902,7 @@ void MediaStreamManager::StopRemovedDevice(const MediaStreamDevice& device) { session_ids.push_back(device_it->session_id); if (it->second->requester) { it->second->requester->DeviceStopped( - it->second->requesting_view_id, + it->second->requesting_frame_id, it->first, *device_it); } @@ -1295,17 +1287,10 @@ bool MediaStreamManager::SetupTabCaptureRequest(DeviceRequest* request) { // Customize options for a WebContents based capture. int target_render_process_id = 0; - int target_render_view_id = 0; - - // TODO(justinlin): Can't plumb audio mirroring using stream type right - // now, so plumbing by device_id. Will revisit once it's refactored. - // http://crbug.com/163100 - std::string tab_capture_device_id = - WebContentsCaptureUtil::AppendWebContentsDeviceScheme(capture_device_id); + int target_render_frame_id = 0; bool has_valid_device_id = WebContentsCaptureUtil::ExtractTabCaptureTarget( - tab_capture_device_id, &target_render_process_id, - &target_render_view_id); + capture_device_id, &target_render_process_id, &target_render_frame_id); if (!has_valid_device_id || (request->audio_type() != MEDIA_TAB_AUDIO_CAPTURE && request->audio_type() != MEDIA_NO_SERVICE) || @@ -1314,15 +1299,15 @@ bool MediaStreamManager::SetupTabCaptureRequest(DeviceRequest* request) { return false; } - request->CreateTabCatureUIRequest(target_render_process_id, - target_render_view_id, - tab_capture_device_id); + request->CreateTabCaptureUIRequest(target_render_process_id, + target_render_frame_id, + capture_device_id); DVLOG(3) << "SetupTabCaptureRequest " - << ", {tab_capture_device_id = " << tab_capture_device_id << "}" + << ", {capture_device_id = " << capture_device_id << "}" << ", {target_render_process_id = " << target_render_process_id << "}" - << ", {target_render_view_id = " << target_render_view_id << "}"; + << ", {target_render_frame_id = " << target_render_frame_id << "}"; return true; } @@ -1394,7 +1379,7 @@ bool MediaStreamManager::FindExistingRequestedDeviceInfo( it != requests_.end() ; ++it) { const DeviceRequest* request = it->second; if (request->requesting_process_id == new_request.requesting_process_id && - request->requesting_view_id == new_request.requesting_view_id && + request->requesting_frame_id == new_request.requesting_frame_id && request->request_type == new_request.request_type) { for (StreamDeviceInfoArray::const_iterator device_it = request->devices.begin(); @@ -1431,7 +1416,7 @@ void MediaStreamManager::FinalizeGenerateStream(const std::string& label, } request->requester->StreamGenerated( - request->requesting_view_id, + request->requesting_frame_id, request->page_request_id, label, audio_devices, video_devices); } @@ -1442,7 +1427,7 @@ void MediaStreamManager::FinalizeRequestFailed( content::MediaStreamRequestResult result) { if (request->requester) request->requester->StreamGenerationFailed( - request->requesting_view_id, + request->requesting_frame_id, request->page_request_id, result); @@ -1457,7 +1442,7 @@ void MediaStreamManager::FinalizeRequestFailed( void MediaStreamManager::FinalizeOpenDevice(const std::string& label, DeviceRequest* request) { const StreamDeviceInfoArray& requested_devices = request->devices; - request->requester->DeviceOpened(request->requesting_view_id, + request->requester->DeviceOpened(request->requesting_frame_id, request->page_request_id, label, requested_devices.front()); } @@ -1480,7 +1465,7 @@ void MediaStreamManager::FinalizeEnumerateDevices(const std::string& label, ClearDeviceLabels(&request->devices); request->requester->DevicesEnumerated( - request->requesting_view_id, + request->requesting_frame_id, request->page_request_id, label, request->devices); @@ -1817,8 +1802,6 @@ void MediaStreamManager::HandleAccessRequestResponse( StreamDeviceInfo device_info; device_info.device = *device_it; - // TODO(justinlin): Nicer way to do this? - // Re-append the device's id since we lost it when posting request to UI. if (device_info.device.type == content::MEDIA_TAB_VIDEO_CAPTURE || device_info.device.type == content::MEDIA_TAB_AUDIO_CAPTURE) { device_info.device.id = request->UIRequest()->tab_capture_device_id; @@ -1847,7 +1830,7 @@ void MediaStreamManager::HandleAccessRequestResponse( } // If this is request for a new MediaStream, a device is only opened once - // per render view. This is so that the permission to use a device can be + // per render frame. This is so that the permission to use a device can be // revoked by a single call to StopStreamDevice regardless of how many // MediaStreams it is being used in. if (request->request_type == MEDIA_GENERATE_STREAM) { @@ -1900,7 +1883,7 @@ void MediaStreamManager::StopMediaStreamFromBrowser(const std::string& label) { if (request->requester) { for (StreamDeviceInfoArray::iterator device_it = request->devices.begin(); device_it != request->devices.end(); ++device_it) { - request->requester->DeviceStopped(request->requesting_view_id, + request->requester->DeviceStopped(request->requesting_frame_id, label, *device_it); } diff --git a/content/browser/renderer_host/media/media_stream_manager.h b/content/browser/renderer_host/media/media_stream_manager.h index 1de659c..4125b39 100644 --- a/content/browser/renderer_host/media/media_stream_manager.h +++ b/content/browser/renderer_host/media/media_stream_manager.h @@ -81,13 +81,13 @@ class CONTENT_EXPORT MediaStreamManager // Creates a new media access request which is identified by a unique string // that's returned to the caller. This will trigger the infobar and ask users - // for access to the device. |render_process_id| and |render_view_id| refer - // to the view where the infobar will appear to the user. |callback| is + // for access to the device. |render_process_id| and |render_frame_id| are + // used to determine where the infobar will appear to the user. |callback| is // used to send the selected device to the clients. An empty list of device // will be returned if the users deny the access. std::string MakeMediaAccessRequest( int render_process_id, - int render_view_id, + int render_frame_id, int page_request_id, const StreamOptions& options, const GURL& security_origin, @@ -95,11 +95,11 @@ class CONTENT_EXPORT MediaStreamManager // GenerateStream opens new media devices according to |components|. It // creates a new request which is identified by a unique string that's - // returned to the caller. |render_process_id| and |render_view_id| refer to - // the view where the infobar will appear to the user. + // returned to the caller. |render_process_id| and |render_frame_id| are used + // to determine where the infobar will appear to the user. void GenerateStream(MediaStreamRequester* requester, int render_process_id, - int render_view_id, + int render_frame_id, const ResourceContext::SaltCallback& sc, int page_request_id, const StreamOptions& components, @@ -107,7 +107,7 @@ class CONTENT_EXPORT MediaStreamManager bool user_gesture); void CancelRequest(int render_process_id, - int render_view_id, + int render_frame_id, int page_request_id); // Cancel an open request identified by |label|. @@ -116,10 +116,10 @@ class CONTENT_EXPORT MediaStreamManager // Cancel all requests for the given |render_process_id|. void CancelAllRequests(int render_process_id); - // Closes the stream device for a certain render view. The stream must have + // Closes the stream device for a certain render frame. The stream must have // been opened by a call to GenerateStream. void StopStreamDevice(int render_process_id, - int render_view_id, + int render_frame_id, const std::string& device_id); // Gets a list of devices of |type|, which must be MEDIA_DEVICE_AUDIO_CAPTURE @@ -132,7 +132,7 @@ class CONTENT_EXPORT MediaStreamManager // If |have_permission| is false, we remove the device label from the result. virtual std::string EnumerateDevices(MediaStreamRequester* requester, int render_process_id, - int render_view_id, + int render_frame_id, const ResourceContext::SaltCallback& sc, int page_request_id, MediaStreamType type, @@ -144,7 +144,7 @@ class CONTENT_EXPORT MediaStreamManager // The request is identified using string returned to the caller. void OpenDevice(MediaStreamRequester* requester, int render_process_id, - int render_view_id, + int render_frame_id, const ResourceContext::SaltCallback& sc, int page_request_id, const std::string& device_id, @@ -301,7 +301,7 @@ class CONTENT_EXPORT MediaStreamManager // needed. void PostRequestToUI(const std::string& label, DeviceRequest* request); // Returns true if a device with |device_id| has already been requested with - // a render procecss_id and render_view_id and type equal to the the values + // a render procecss_id and render_frame_id and type equal to the the values // in |request|. If it has been requested, |device_info| contain information // about the device. bool FindExistingRequestedDeviceInfo( diff --git a/content/browser/renderer_host/media/media_stream_manager_unittest.cc b/content/browser/renderer_host/media/media_stream_manager_unittest.cc index e01b945..cc19af2 100644 --- a/content/browser/renderer_host/media/media_stream_manager_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_manager_unittest.cc @@ -99,7 +99,7 @@ class MediaStreamManagerTest : public ::testing::Test { protected: std::string MakeMediaAccessRequest(int index) { const int render_process_id = 1; - const int render_view_id = 1; + const int render_frame_id = 1; const int page_request_id = 1; const GURL security_origin; MediaStreamManager::MediaRequestResponseCallback callback = @@ -107,7 +107,7 @@ class MediaStreamManagerTest : public ::testing::Test { base::Unretained(this), index); StreamOptions options(true, true); return media_stream_manager_->MakeMediaAccessRequest(render_process_id, - render_view_id, + render_frame_id, page_request_id, options, security_origin, @@ -146,7 +146,7 @@ TEST_F(MediaStreamManagerTest, MakeMultipleRequests) { // Second request. int render_process_id = 2; - int render_view_id = 2; + int render_frame_id = 2; int page_request_id = 2; GURL security_origin; StreamOptions options(true, true); @@ -155,7 +155,7 @@ TEST_F(MediaStreamManagerTest, MakeMultipleRequests) { base::Unretained(this), 1); std::string label2 = media_stream_manager_->MakeMediaAccessRequest( render_process_id, - render_view_id, + render_frame_id, page_request_id, options, security_origin, diff --git a/content/browser/renderer_host/media/media_stream_requester.h b/content/browser/renderer_host/media/media_stream_requester.h index 337effa..c36f166 100644 --- a/content/browser/renderer_host/media/media_stream_requester.h +++ b/content/browser/renderer_host/media/media_stream_requester.h @@ -18,29 +18,29 @@ namespace content { class CONTENT_EXPORT MediaStreamRequester { public: // Called as a reply of a successful call to GenerateStream. - virtual void StreamGenerated(int render_view_id, + virtual void StreamGenerated(int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfoArray& audio_devices, const StreamDeviceInfoArray& video_devices) = 0; // Called if GenerateStream failed. virtual void StreamGenerationFailed( - int render_view_id, + int render_frame_id, int page_request_id, content::MediaStreamRequestResult result) = 0; // Called if a device has been stopped by a user from UI or the device - // has become unavailable. |render_view_id| is the render view that requested - // the device and |label| is the label of the request|. - virtual void DeviceStopped(int render_view_id, + // has become unavailable. |render_frame_id| is the render frame that + // requested the device and |label| is the label of the request. + virtual void DeviceStopped(int render_frame_id, const std::string& label, const StreamDeviceInfo& device) = 0; // Called as a reply of a successful call to EnumerateDevices. - virtual void DevicesEnumerated(int render_view_id, + virtual void DevicesEnumerated(int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfoArray& devices) = 0; // Called as a reply of a successful call to OpenDevice. - virtual void DeviceOpened(int render_view_id, + virtual void DeviceOpened(int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfo& device_info) = 0; diff --git a/content/browser/renderer_host/media/media_stream_ui_proxy.cc b/content/browser/renderer_host/media/media_stream_ui_proxy.cc index 1c92424..122bfa2 100644 --- a/content/browser/renderer_host/media/media_stream_ui_proxy.cc +++ b/content/browser/renderer_host/media/media_stream_ui_proxy.cc @@ -5,8 +5,8 @@ #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" #include "base/command_line.h" -#include "content/browser/renderer_host/render_view_host_delegate.h" -#include "content/browser/renderer_host/render_view_host_impl.h" +#include "content/browser/frame_host/render_frame_host_delegate.h" +#include "content/browser/frame_host/render_frame_host_impl.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_switches.h" #include "media/video/capture/fake_video_capture_device.h" @@ -16,7 +16,7 @@ namespace content { class MediaStreamUIProxy::Core { public: explicit Core(const base::WeakPtr<MediaStreamUIProxy>& proxy, - RenderViewHostDelegate* test_render_delegate); + RenderFrameHostDelegate* test_render_delegate); ~Core(); void RequestAccess(const MediaStreamRequest& request); @@ -31,7 +31,7 @@ class MediaStreamUIProxy::Core { base::WeakPtr<MediaStreamUIProxy> proxy_; scoped_ptr<MediaStreamUI> ui_; - RenderViewHostDelegate* const test_render_delegate_; + RenderFrameHostDelegate* const test_render_delegate_; // WeakPtr<> is used to RequestMediaAccessPermission() because there is no way // cancel media requests. @@ -41,7 +41,7 @@ class MediaStreamUIProxy::Core { }; MediaStreamUIProxy::Core::Core(const base::WeakPtr<MediaStreamUIProxy>& proxy, - RenderViewHostDelegate* test_render_delegate) + RenderFrameHostDelegate* test_render_delegate) : proxy_(proxy), test_render_delegate_(test_render_delegate), weak_factory_(this) { @@ -55,24 +55,22 @@ void MediaStreamUIProxy::Core::RequestAccess( const MediaStreamRequest& request) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - RenderViewHostDelegate* render_delegate; - + RenderFrameHostDelegate* render_delegate; if (test_render_delegate_) { render_delegate = test_render_delegate_; } else { - RenderViewHostImpl* host = RenderViewHostImpl::FromID( - request.render_process_id, request.render_view_id); - - // Tab may have gone away. - if (!host || !host->GetDelegate()) { - ProcessAccessRequestResponse( - MediaStreamDevices(), - MEDIA_DEVICE_INVALID_STATE, - scoped_ptr<MediaStreamUI>()); - return; - } + RenderFrameHostImpl* const host = RenderFrameHostImpl::FromID( + request.render_process_id, request.render_frame_id); + render_delegate = host ? host->delegate() : NULL; + } - render_delegate = host->GetDelegate(); + // Tab may have gone away, or has no delegate from which to request access. + if (!render_delegate) { + ProcessAccessRequestResponse( + MediaStreamDevices(), + MEDIA_DEVICE_INVALID_STATE, + scoped_ptr<MediaStreamUI>()); + return; } render_delegate->RequestMediaAccessPermission( @@ -116,13 +114,13 @@ scoped_ptr<MediaStreamUIProxy> MediaStreamUIProxy::Create() { // static scoped_ptr<MediaStreamUIProxy> MediaStreamUIProxy::CreateForTests( - RenderViewHostDelegate* render_delegate) { + RenderFrameHostDelegate* render_delegate) { return scoped_ptr<MediaStreamUIProxy>( new MediaStreamUIProxy(render_delegate)); } MediaStreamUIProxy::MediaStreamUIProxy( - RenderViewHostDelegate* test_render_delegate) + RenderFrameHostDelegate* test_render_delegate) : weak_factory_(this) { DCHECK_CURRENTLY_ON(BrowserThread::IO); core_.reset(new Core(weak_factory_.GetWeakPtr(), test_render_delegate)); diff --git a/content/browser/renderer_host/media/media_stream_ui_proxy.h b/content/browser/renderer_host/media/media_stream_ui_proxy.h index 01be166..fe1dde5 100644 --- a/content/browser/renderer_host/media/media_stream_ui_proxy.h +++ b/content/browser/renderer_host/media/media_stream_ui_proxy.h @@ -13,11 +13,11 @@ namespace content { -class RenderViewHostDelegate; +class RenderFrameHostDelegate; // MediaStreamUIProxy proxies calls to media stream UI between IO thread and UI // thread. One instance of this class is create per MediaStream object. It must -// be create, used and destroyed on IO thread. +// be created, used and destroyed on IO thread. class CONTENT_EXPORT MediaStreamUIProxy { public: typedef base::Callback< @@ -29,7 +29,7 @@ class CONTENT_EXPORT MediaStreamUIProxy { static scoped_ptr<MediaStreamUIProxy> Create(); static scoped_ptr<MediaStreamUIProxy> CreateForTests( - RenderViewHostDelegate* render_delegate); + RenderFrameHostDelegate* render_delegate); virtual ~MediaStreamUIProxy(); @@ -48,10 +48,10 @@ class CONTENT_EXPORT MediaStreamUIProxy { virtual void OnStarted(const base::Closure& stop_callback, const WindowIdCallback& window_id_callback); - void SetRenderViewHostDelegateForTests(RenderViewHostDelegate* delegate); + void SetRenderFrameHostDelegateForTests(RenderFrameHostDelegate* delegate); protected: - MediaStreamUIProxy(RenderViewHostDelegate* test_render_delegate); + explicit MediaStreamUIProxy(RenderFrameHostDelegate* test_render_delegate); private: class Core; diff --git a/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc b/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc index 4529b49..3bc1b06 100644 --- a/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc @@ -5,7 +5,7 @@ #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" #include "base/message_loop/message_loop.h" -#include "content/browser/renderer_host/render_view_host_delegate.h" +#include "content/browser/frame_host/render_frame_host_delegate.h" #include "content/public/common/renderer_preferences.h" #include "content/public/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" @@ -19,22 +19,11 @@ using testing::SaveArg; namespace content { namespace { -class MockRenderViewHostDelegate : public RenderViewHostDelegate { +class MockRenderFrameHostDelegate : public RenderFrameHostDelegate { public: MOCK_METHOD2(RequestMediaAccessPermission, void(const MediaStreamRequest& request, const MediaResponseCallback& callback)); - - // Stubs for pure virtual methods we don't care about. - virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE { - NOTREACHED(); - return gfx::Rect(); - } - virtual RendererPreferences GetRendererPrefs( - BrowserContext* browser_context) const OVERRIDE { - NOTREACHED(); - return RendererPreferences(); - } }; class MockResponseCallback { @@ -76,7 +65,7 @@ class MediaStreamUIProxyTest : public testing::Test { TestBrowserThread ui_thread_; TestBrowserThread io_thread_; - MockRenderViewHostDelegate delegate_; + MockRenderFrameHostDelegate delegate_; MockResponseCallback response_callback_; scoped_ptr<MediaStreamUIProxy> proxy_; }; @@ -84,7 +73,7 @@ class MediaStreamUIProxyTest : public testing::Test { MATCHER_P(SameRequest, expected, "") { return expected.render_process_id == arg.render_process_id && - expected.render_view_id == arg.render_view_id && + expected.render_frame_id == arg.render_frame_id && expected.tab_capture_device_id == arg.tab_capture_device_id && expected.security_origin == arg.security_origin && expected.request_type == arg.request_type && diff --git a/content/browser/renderer_host/media/mock_media_observer.h b/content/browser/renderer_host/media/mock_media_observer.h index 04678c9..ae4e7e6 100644 --- a/content/browser/renderer_host/media/mock_media_observer.h +++ b/content/browser/renderer_host/media/mock_media_observer.h @@ -21,9 +21,9 @@ class MockMediaObserver : public MediaObserver { virtual ~MockMediaObserver(); MOCK_METHOD6(OnMediaRequestStateChanged, - void(int render_process_id, int render_view_id, + void(int render_process_id, int render_frame_id, int page_request_id, const GURL& security_origin, - const MediaStreamDevice& device, + MediaStreamType stream_type, const MediaRequestState state)); }; diff --git a/content/browser/renderer_host/media/video_capture_host_unittest.cc b/content/browser/renderer_host/media/video_capture_host_unittest.cc index 6088081..1df72ba 100644 --- a/content/browser/renderer_host/media/video_capture_host_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_host_unittest.cc @@ -86,23 +86,23 @@ class MockMediaStreamRequester : public MediaStreamRequester { // MediaStreamRequester implementation. MOCK_METHOD5(StreamGenerated, - void(int render_view_id, + void(int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfoArray& audio_devices, const StreamDeviceInfoArray& video_devices)); MOCK_METHOD3(StreamGenerationFailed, - void(int render_view_id, + void(int render_frame_id, int page_request_id, content::MediaStreamRequestResult result)); - MOCK_METHOD3(DeviceStopped, void(int render_view_id, + MOCK_METHOD3(DeviceStopped, void(int render_frame_id, const std::string& label, const StreamDeviceInfo& device)); - MOCK_METHOD4(DevicesEnumerated, void(int render_view_id, + MOCK_METHOD4(DevicesEnumerated, void(int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfoArray& devices)); - MOCK_METHOD4(DeviceOpened, void(int render_view_id, + MOCK_METHOD4(DeviceOpened, void(int render_frame_id, int page_request_id, const std::string& label, const StreamDeviceInfo& device_info)); @@ -319,7 +319,7 @@ class VideoCaptureHostTest : public testing::Test { void OpenSession() { const int render_process_id = 1; - const int render_view_id = 1; + const int render_frame_id = 1; const int page_request_id = 1; const GURL security_origin("http://test.com"); @@ -332,13 +332,13 @@ class VideoCaptureHostTest : public testing::Test { std::string label = media_stream_manager_->EnumerateDevices( &stream_requester_, render_process_id, - render_view_id, + render_frame_id, browser_context_.GetResourceContext()->GetMediaDeviceIDSalt(), page_request_id, MEDIA_DEVICE_VIDEO_CAPTURE, security_origin, true); - EXPECT_CALL(stream_requester_, DevicesEnumerated(render_view_id, + EXPECT_CALL(stream_requester_, DevicesEnumerated(render_frame_id, page_request_id, label, _)) @@ -359,13 +359,13 @@ class VideoCaptureHostTest : public testing::Test { media_stream_manager_->OpenDevice( &stream_requester_, render_process_id, - render_view_id, + render_frame_id, browser_context_.GetResourceContext()->GetMediaDeviceIDSalt(), page_request_id, devices[0].device.id, MEDIA_DEVICE_VIDEO_CAPTURE, security_origin); - EXPECT_CALL(stream_requester_, DeviceOpened(render_view_id, + EXPECT_CALL(stream_requester_, DeviceOpened(render_frame_id, page_request_id, _, _)) diff --git a/content/browser/renderer_host/render_view_host_delegate.h b/content/browser/renderer_host/render_view_host_delegate.h index 6c87b7a..a9dea8b 100644 --- a/content/browser/renderer_host/render_view_host_delegate.h +++ b/content/browser/renderer_host/render_view_host_delegate.h @@ -13,7 +13,6 @@ #include "base/strings/string16.h" #include "content/browser/dom_storage/session_storage_namespace_impl.h" #include "content/common/content_export.h" -#include "content/public/common/media_stream_request.h" #include "content/public/common/page_transition_types.h" #include "net/base/load_states.h" #include "third_party/WebKit/public/web/WebPopupType.h" @@ -266,13 +265,6 @@ class CONTENT_EXPORT RenderViewHostDelegate { // Show the newly created full screen widget. Similar to above. virtual void ShowCreatedFullscreenWidget(int route_id) {} - // The render view has requested access to media devices listed in - // |request|, and the client should grant or deny that permission by - // calling |callback|. - virtual void RequestMediaAccessPermission( - const MediaStreamRequest& request, - const MediaResponseCallback& callback) {} - // Returns the SessionStorageNamespace the render view should use. Might // create the SessionStorageNamespace on the fly. virtual SessionStorageNamespace* GetSessionStorageNamespace( |