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

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

Issue 2734943003: Device Service: Decouple Wake Lock from //content (Closed)
Patch Set: Response to reviews Created 3 years, 9 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
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 #include "content/public/common/file_chooser_params.h" 91 #include "content/public/common/file_chooser_params.h"
92 #include "content/public/common/isolated_world_ids.h" 92 #include "content/public/common/isolated_world_ids.h"
93 #include "content/public/common/service_manager_connection.h" 93 #include "content/public/common/service_manager_connection.h"
94 #include "content/public/common/service_names.mojom.h" 94 #include "content/public/common/service_names.mojom.h"
95 #include "content/public/common/url_constants.h" 95 #include "content/public/common/url_constants.h"
96 #include "content/public/common/url_utils.h" 96 #include "content/public/common/url_utils.h"
97 #include "device/generic_sensor/sensor_provider_impl.h" 97 #include "device/generic_sensor/sensor_provider_impl.h"
98 #include "device/geolocation/geolocation_service_context.h" 98 #include "device/geolocation/geolocation_service_context.h"
99 #include "device/vibration/vibration_manager_impl.h" 99 #include "device/vibration/vibration_manager_impl.h"
100 #include "device/vr/features.h" 100 #include "device/vr/features.h"
101 #include "device/wake_lock/wake_lock_service_context.h" 101 #include "device/wake_lock/public/interfaces/wake_lock_context.mojom.h"
102 #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h"
102 #include "media/base/media_switches.h" 103 #include "media/base/media_switches.h"
103 #include "media/media_features.h" 104 #include "media/media_features.h"
104 #include "media/mojo/interfaces/media_service.mojom.h" 105 #include "media/mojo/interfaces/media_service.mojom.h"
105 #include "media/mojo/interfaces/remoting.mojom.h" 106 #include "media/mojo/interfaces/remoting.mojom.h"
106 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" 107 #include "mojo/public/cpp/bindings/associated_interface_ptr.h"
107 #include "mojo/public/cpp/bindings/strong_binding.h" 108 #include "mojo/public/cpp/bindings/strong_binding.h"
108 #include "services/service_manager/public/cpp/connector.h" 109 #include "services/service_manager/public/cpp/connector.h"
109 #include "services/service_manager/public/cpp/interface_provider.h" 110 #include "services/service_manager/public/cpp/interface_provider.h"
110 #include "ui/accessibility/ax_tree.h" 111 #include "ui/accessibility/ax_tree.h"
111 #include "ui/accessibility/ax_tree_id_registry.h" 112 #include "ui/accessibility/ax_tree_id_registry.h"
(...skipping 2207 matching lines...) Expand 10 before | Expand all | Expand 10 after
2319 // this object and destruction of any GeolocationServicesImpls created via 2320 // this object and destruction of any GeolocationServicesImpls created via
2320 // the below service registry, the reason being that the destruction of the 2321 // the below service registry, the reason being that the destruction of the
2321 // latter is triggered by receiving a message that the pipe was closed from 2322 // latter is triggered by receiving a message that the pipe was closed from
2322 // the renderer side. Hence, supply the reference to this object as a weak 2323 // the renderer side. Hence, supply the reference to this object as a weak
2323 // pointer. 2324 // pointer.
2324 GetInterfaceRegistry()->AddInterface( 2325 GetInterfaceRegistry()->AddInterface(
2325 base::Bind(&device::GeolocationServiceContext::CreateService, 2326 base::Bind(&device::GeolocationServiceContext::CreateService,
2326 base::Unretained(geolocation_service_context))); 2327 base::Unretained(geolocation_service_context)));
2327 } 2328 }
2328 2329
2329 device::WakeLockServiceContext* wake_lock_service_context = 2330 device::mojom::WakeLockContext* wake_lock_service_context =
2330 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; 2331 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr;
2331 if (wake_lock_service_context) { 2332 if (wake_lock_service_context) {
2332 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive 2333 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive
2333 // this RenderFrameHostImpl, hence a raw pointer can be bound to service 2334 // this RenderFrameHostImpl, hence a raw pointer can be bound to service
2334 // factory callback. 2335 // factory callback.
2335 GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>( 2336 GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>(
2336 base::Bind(&device::WakeLockServiceContext::CreateService, 2337 base::Bind(&device::mojom::WakeLockContext::GetWakeLock,
2337 base::Unretained(wake_lock_service_context))); 2338 base::Unretained(wake_lock_service_context)));
2338 } 2339 }
2339 2340
2340 if (!permission_service_context_) 2341 if (!permission_service_context_)
2341 permission_service_context_.reset(new PermissionServiceContext(this)); 2342 permission_service_context_.reset(new PermissionServiceContext(this));
2342 2343
2343 GetInterfaceRegistry()->AddInterface( 2344 GetInterfaceRegistry()->AddInterface(
2344 base::Bind(&PermissionServiceContext::CreateService, 2345 base::Bind(&PermissionServiceContext::CreateService,
2345 base::Unretained(permission_service_context_.get()))); 2346 base::Unretained(permission_service_context_.get())));
2346 2347
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
3503 GetUserData(kRenderFrameHostAndroidKey)); 3504 GetUserData(kRenderFrameHostAndroidKey));
3504 if (!render_frame_host_android) { 3505 if (!render_frame_host_android) {
3505 render_frame_host_android = new RenderFrameHostAndroid(this); 3506 render_frame_host_android = new RenderFrameHostAndroid(this);
3506 SetUserData(kRenderFrameHostAndroidKey, render_frame_host_android); 3507 SetUserData(kRenderFrameHostAndroidKey, render_frame_host_android);
3507 } 3508 }
3508 return render_frame_host_android->GetJavaObject(); 3509 return render_frame_host_android->GetJavaObject();
3509 } 3510 }
3510 #endif 3511 #endif
3511 3512
3512 } // namespace content 3513 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698