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

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 review + rebase 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 2198 matching lines...) Expand 10 before | Expand all | Expand 10 after
2310 // this object and destruction of any GeolocationServicesImpls created via 2311 // this object and destruction of any GeolocationServicesImpls created via
2311 // the below service registry, the reason being that the destruction of the 2312 // the below service registry, the reason being that the destruction of the
2312 // latter is triggered by receiving a message that the pipe was closed from 2313 // latter is triggered by receiving a message that the pipe was closed from
2313 // the renderer side. Hence, supply the reference to this object as a weak 2314 // the renderer side. Hence, supply the reference to this object as a weak
2314 // pointer. 2315 // pointer.
2315 GetInterfaceRegistry()->AddInterface( 2316 GetInterfaceRegistry()->AddInterface(
2316 base::Bind(&device::GeolocationServiceContext::CreateService, 2317 base::Bind(&device::GeolocationServiceContext::CreateService,
2317 base::Unretained(geolocation_service_context))); 2318 base::Unretained(geolocation_service_context)));
2318 } 2319 }
2319 2320
2320 device::WakeLockServiceContext* wake_lock_service_context = 2321 device::mojom::WakeLockContext* wake_lock_service_context =
2321 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; 2322 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr;
2322 if (wake_lock_service_context) { 2323 if (wake_lock_service_context) {
2323 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive 2324 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive
2324 // this RenderFrameHostImpl, hence a raw pointer can be bound to service 2325 // this RenderFrameHostImpl, hence a raw pointer can be bound to service
2325 // factory callback. 2326 // factory callback.
2326 GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>( 2327 GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>(
2327 base::Bind(&device::WakeLockServiceContext::CreateService, 2328 base::Bind(&device::mojom::WakeLockContext::GetWakeLock,
2328 base::Unretained(wake_lock_service_context))); 2329 base::Unretained(wake_lock_service_context)));
2329 } 2330 }
2330 2331
2331 if (!permission_service_context_) 2332 if (!permission_service_context_)
2332 permission_service_context_.reset(new PermissionServiceContext(this)); 2333 permission_service_context_.reset(new PermissionServiceContext(this));
2333 2334
2334 GetInterfaceRegistry()->AddInterface( 2335 GetInterfaceRegistry()->AddInterface(
2335 base::Bind(&PermissionServiceContext::CreateService, 2336 base::Bind(&PermissionServiceContext::CreateService,
2336 base::Unretained(permission_service_context_.get()))); 2337 base::Unretained(permission_service_context_.get())));
2337 2338
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
3498 GetUserData(kRenderFrameHostAndroidKey)); 3499 GetUserData(kRenderFrameHostAndroidKey));
3499 if (!render_frame_host_android) { 3500 if (!render_frame_host_android) {
3500 render_frame_host_android = new RenderFrameHostAndroid(this); 3501 render_frame_host_android = new RenderFrameHostAndroid(this);
3501 SetUserData(kRenderFrameHostAndroidKey, render_frame_host_android); 3502 SetUserData(kRenderFrameHostAndroidKey, render_frame_host_android);
3502 } 3503 }
3503 return render_frame_host_android->GetJavaObject(); 3504 return render_frame_host_android->GetJavaObject();
3504 } 3505 }
3505 #endif 3506 #endif
3506 3507
3507 } // namespace content 3508 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698