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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2603553002: Ports VRService to be hosted in the device service.
Patch Set: Ports VRService to be hosted in the device service. Created 3 years, 8 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/browser/DEPS ('k') | content/public/app/mojo/content_browser_manifest.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 #include "content/public/common/content_features.h" 89 #include "content/public/common/content_features.h"
90 #include "content/public/common/content_switches.h" 90 #include "content/public/common/content_switches.h"
91 #include "content/public/common/file_chooser_file_info.h" 91 #include "content/public/common/file_chooser_file_info.h"
92 #include "content/public/common/file_chooser_params.h" 92 #include "content/public/common/file_chooser_params.h"
93 #include "content/public/common/isolated_world_ids.h" 93 #include "content/public/common/isolated_world_ids.h"
94 #include "content/public/common/service_manager_connection.h" 94 #include "content/public/common/service_manager_connection.h"
95 #include "content/public/common/service_names.mojom.h" 95 #include "content/public/common/service_names.mojom.h"
96 #include "content/public/common/url_constants.h" 96 #include "content/public/common/url_constants.h"
97 #include "content/public/common/url_utils.h" 97 #include "content/public/common/url_utils.h"
98 #include "device/geolocation/geolocation_service_context.h" 98 #include "device/geolocation/geolocation_service_context.h"
99 #include "device/vr/features.h"
100 #include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h" 99 #include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h"
101 #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" 100 #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h"
102 #include "media/base/media_switches.h" 101 #include "media/base/media_switches.h"
103 #include "media/media_features.h" 102 #include "media/media_features.h"
104 #include "media/mojo/interfaces/media_service.mojom.h" 103 #include "media/mojo/interfaces/media_service.mojom.h"
105 #include "media/mojo/interfaces/remoting.mojom.h" 104 #include "media/mojo/interfaces/remoting.mojom.h"
106 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" 105 #include "mojo/public/cpp/bindings/associated_interface_ptr.h"
107 #include "mojo/public/cpp/bindings/strong_binding.h" 106 #include "mojo/public/cpp/bindings/strong_binding.h"
108 #include "mojo/public/cpp/system/data_pipe.h" 107 #include "mojo/public/cpp/system/data_pipe.h"
109 #include "services/service_manager/public/cpp/connector.h" 108 #include "services/service_manager/public/cpp/connector.h"
(...skipping 12 matching lines...) Expand all
122 #include "content/public/browser/android/java_interfaces.h" 121 #include "content/public/browser/android/java_interfaces.h"
123 #include "media/base/audio_renderer_sink.h" 122 #include "media/base/audio_renderer_sink.h"
124 #include "media/base/video_renderer_sink.h" 123 #include "media/base/video_renderer_sink.h"
125 #include "media/mojo/services/mojo_renderer_service.h" // nogncheck 124 #include "media/mojo/services/mojo_renderer_service.h" // nogncheck
126 #endif 125 #endif
127 126
128 #if defined(OS_MACOSX) 127 #if defined(OS_MACOSX)
129 #include "content/browser/frame_host/popup_menu_helper_mac.h" 128 #include "content/browser/frame_host/popup_menu_helper_mac.h"
130 #endif 129 #endif
131 130
132 #if BUILDFLAG(ENABLE_VR)
133 #include "device/vr/vr_service_impl.h" // nogncheck
134 #else
135 #include "device/vr/vr_service.mojom.h" // nogncheck
136 #endif
137
138 using base::TimeDelta; 131 using base::TimeDelta;
139 132
140 namespace content { 133 namespace content {
141 134
142 namespace { 135 namespace {
143 136
144 #if defined(OS_ANDROID) 137 #if defined(OS_ANDROID)
145 const void* const kRenderFrameHostAndroidKey = &kRenderFrameHostAndroidKey; 138 const void* const kRenderFrameHostAndroidKey = &kRenderFrameHostAndroidKey;
146 #endif // OS_ANDROID 139 #endif // OS_ANDROID
147 140
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 } 235 }
243 } 236 }
244 237
245 const int process_id_; 238 const int process_id_;
246 const int routing_id_; 239 const int routing_id_;
247 240
248 DISALLOW_COPY_AND_ASSIGN(RemoterFactoryImpl); 241 DISALLOW_COPY_AND_ASSIGN(RemoterFactoryImpl);
249 }; 242 };
250 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) 243 #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING)
251 244
252 template <typename Interface>
253 void IgnoreInterfaceRequest(mojo::InterfaceRequest<Interface> request) {
254 // Intentionally ignore the interface request.
255 }
256
257 // The following functions simplify code paths where the UI thread notifies the 245 // The following functions simplify code paths where the UI thread notifies the
258 // ResourceDispatcherHostImpl of information pertaining to loading behavior of 246 // ResourceDispatcherHostImpl of information pertaining to loading behavior of
259 // frame hosts. 247 // frame hosts.
260 void NotifyRouteChangesOnIO( 248 void NotifyRouteChangesOnIO(
261 base::Callback<void(ResourceDispatcherHostImpl*, 249 base::Callback<void(ResourceDispatcherHostImpl*,
262 const GlobalFrameRoutingId&)> frame_callback, 250 const GlobalFrameRoutingId&)> frame_callback,
263 std::unique_ptr<std::set<GlobalFrameRoutingId>> routing_ids) { 251 std::unique_ptr<std::set<GlobalFrameRoutingId>> routing_ids) {
264 DCHECK_CURRENTLY_ON(BrowserThread::IO); 252 DCHECK_CURRENTLY_ON(BrowserThread::IO);
265 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); 253 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get();
266 if (!rdh) 254 if (!rdh)
(...skipping 2238 matching lines...) Expand 10 before | Expand all | Expand 10 after
2505 GetInterfaceRegistry()->AddInterface<media::mojom::InterfaceFactory>(this); 2493 GetInterfaceRegistry()->AddInterface<media::mojom::InterfaceFactory>(this);
2506 2494
2507 // This is to support usage of WebSockets in cases in which there is an 2495 // This is to support usage of WebSockets in cases in which there is an
2508 // associated RenderFrame. This is important for showing the correct security 2496 // associated RenderFrame. This is important for showing the correct security
2509 // state of the page and also honoring user override of bad certificates. 2497 // state of the page and also honoring user override of bad certificates.
2510 GetInterfaceRegistry()->AddInterface( 2498 GetInterfaceRegistry()->AddInterface(
2511 base::Bind(&WebSocketManager::CreateWebSocket, 2499 base::Bind(&WebSocketManager::CreateWebSocket,
2512 process_->GetID(), 2500 process_->GetID(),
2513 routing_id_)); 2501 routing_id_));
2514 2502
2515 #if BUILDFLAG(ENABLE_VR)
2516 GetInterfaceRegistry()->AddInterface<device::mojom::VRService>(
2517 base::Bind(&device::VRServiceImpl::Create));
2518 #else
2519 GetInterfaceRegistry()->AddInterface<device::mojom::VRService>(
2520 base::Bind(&IgnoreInterfaceRequest<device::mojom::VRService>));
2521 #endif
2522
2523 #if BUILDFLAG(ENABLE_WEBRTC) 2503 #if BUILDFLAG(ENABLE_WEBRTC)
2524 // BrowserMainLoop::GetInstance() may be null on unit tests. 2504 // BrowserMainLoop::GetInstance() may be null on unit tests.
2525 if (BrowserMainLoop::GetInstance()) { 2505 if (BrowserMainLoop::GetInstance()) {
2526 // BrowserMainLoop, which owns MediaStreamManager, is alive for the lifetime 2506 // BrowserMainLoop, which owns MediaStreamManager, is alive for the lifetime
2527 // of Mojo communication (see BrowserMainLoop::ShutdownThreadsAndCleanUp(), 2507 // of Mojo communication (see BrowserMainLoop::ShutdownThreadsAndCleanUp(),
2528 // which shuts down Mojo). Hence, passing that MediaStreamManager instance 2508 // which shuts down Mojo). Hence, passing that MediaStreamManager instance
2529 // as a raw pointer here is safe. 2509 // as a raw pointer here is safe.
2530 MediaStreamManager* media_stream_manager = 2510 MediaStreamManager* media_stream_manager =
2531 BrowserMainLoop::GetInstance()->media_stream_manager(); 2511 BrowserMainLoop::GetInstance()->media_stream_manager();
2532 GetInterfaceRegistry()->AddInterface( 2512 GetInterfaceRegistry()->AddInterface(
(...skipping 1131 matching lines...) Expand 10 before | Expand all | Expand 10 after
3664 } 3644 }
3665 3645
3666 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame( 3646 void RenderFrameHostImpl::ForwardGetInterfaceToRenderFrame(
3667 const std::string& interface_name, 3647 const std::string& interface_name,
3668 mojo::ScopedMessagePipeHandle pipe) { 3648 mojo::ScopedMessagePipeHandle pipe) {
3669 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe)); 3649 GetRemoteInterfaces()->GetInterface(interface_name, std::move(pipe));
3670 } 3650 }
3671 #endif 3651 #endif
3672 3652
3673 } // namespace content 3653 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/DEPS ('k') | content/public/app/mojo/content_browser_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698