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

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: 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 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after
2320 // this object and destruction of any GeolocationServicesImpls created via 2321 // this object and destruction of any GeolocationServicesImpls created via
2321 // the below service registry, the reason being that the destruction of the 2322 // the below service registry, the reason being that the destruction of the
2322 // latter is triggered by receiving a message that the pipe was closed from 2323 // latter is triggered by receiving a message that the pipe was closed from
2323 // the renderer side. Hence, supply the reference to this object as a weak 2324 // the renderer side. Hence, supply the reference to this object as a weak
2324 // pointer. 2325 // pointer.
2325 GetInterfaceRegistry()->AddInterface( 2326 GetInterfaceRegistry()->AddInterface(
2326 base::Bind(&device::GeolocationServiceContext::CreateService, 2327 base::Bind(&device::GeolocationServiceContext::CreateService,
2327 base::Unretained(geolocation_service_context))); 2328 base::Unretained(geolocation_service_context)));
2328 } 2329 }
2329 2330
2330 device::WakeLockServiceContext* wake_lock_service_context = 2331 device::mojom::WakeLockContext* wake_lock_service_context =
2331 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr; 2332 delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr;
2332 if (wake_lock_service_context) { 2333 if (wake_lock_service_context) {
2333 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive 2334 // WakeLockServiceContext is owned by WebContentsImpl so it will outlive
2334 // this RenderFrameHostImpl, hence a raw pointer can be bound to service 2335 // this RenderFrameHostImpl, hence a raw pointer can be bound to service
2335 // factory callback. 2336 // factory callback.
2336 GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>( 2337 GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>(
2337 base::Bind(&device::WakeLockServiceContext::CreateService, 2338 base::Bind(&device::mojom::WakeLockContext::GetWakeLock,
2338 base::Unretained(wake_lock_service_context))); 2339 base::Unretained(wake_lock_service_context)));
2339 } 2340 }
2340 2341
2341 if (!permission_service_context_) 2342 if (!permission_service_context_)
2342 permission_service_context_.reset(new PermissionServiceContext(this)); 2343 permission_service_context_.reset(new PermissionServiceContext(this));
2343 2344
2344 GetInterfaceRegistry()->AddInterface( 2345 GetInterfaceRegistry()->AddInterface(
2345 base::Bind(&PermissionServiceContext::CreateService, 2346 base::Bind(&PermissionServiceContext::CreateService,
2346 base::Unretained(permission_service_context_.get()))); 2347 base::Unretained(permission_service_context_.get())));
2347 2348
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
3514 service_manager::mojom::InterfaceProviderPtr provider; 3515 service_manager::mojom::InterfaceProviderPtr provider;
3515 BindInterfaceRegistryForRenderFrameHost(mojo::MakeRequest(&provider), this); 3516 BindInterfaceRegistryForRenderFrameHost(mojo::MakeRequest(&provider), this);
3516 java_interfaces_.reset(new service_manager::InterfaceProvider); 3517 java_interfaces_.reset(new service_manager::InterfaceProvider);
3517 java_interfaces_->Bind(std::move(provider)); 3518 java_interfaces_->Bind(std::move(provider));
3518 } 3519 }
3519 return java_interfaces_.get(); 3520 return java_interfaces_.get();
3520 } 3521 }
3521 #endif 3522 #endif
3522 3523
3523 } // namespace content 3524 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698