| Index: content/browser/frame_host/render_frame_host_impl.cc
|
| diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
|
| index e42f92e4629b55f300b2ab92866ee3d8d9284d9c..e4776bd49b7698599ca8a91c015218479c52ca97 100644
|
| --- a/content/browser/frame_host/render_frame_host_impl.cc
|
| +++ b/content/browser/frame_host/render_frame_host_impl.cc
|
| @@ -177,6 +177,16 @@ base::i18n::TextDirection WebTextDirectionToChromeTextDirection(
|
| }
|
| }
|
|
|
| +// Wrap the virtual function ConnectToBlinkWakeLock().
|
| +void ConnectToBlinkWakeLockWrapper(
|
| + RenderFrameHostDelegate* delegate,
|
| + device::mojom::WakeLockServiceRequest request) {
|
| + if (delegate) {
|
| + delegate->ConnectToBlinkWakeLock(std::move(request));
|
| + }
|
| + return;
|
| +}
|
| +
|
| // Ensure that we reset nav_entry_id_ in OnDidCommitProvisionalLoad if any of
|
| // the validations fail and lead to an early return. Call disable() once we
|
| // know the commit will be successful. Resetting nav_entry_id_ avoids acting on
|
| @@ -2582,15 +2592,12 @@ void RenderFrameHostImpl::RegisterMojoInterfaces() {
|
| base::Unretained(geolocation_service_context)));
|
| }
|
|
|
| - device::mojom::WakeLockContext* wake_lock_service_context =
|
| - delegate_ ? delegate_->GetWakeLockServiceContext() : nullptr;
|
| - if (wake_lock_service_context) {
|
| - // WakeLockServiceContext is owned by WebContentsImpl so it will outlive
|
| - // this RenderFrameHostImpl, hence a raw pointer can be bound to service
|
| - // factory callback.
|
| + if (delegate_) {
|
| + // Uses WebContentsImpl::ConnectToBlinkWakeLock() as a factory function
|
| + // for the WakeLockService mojo interface. Base::Bind the wrapper function
|
| + // so the ConnectToBlinkWakeLock can still run as a virtual function.
|
| GetInterfaceRegistry()->AddInterface<device::mojom::WakeLockService>(
|
| - base::Bind(&device::mojom::WakeLockContext::GetWakeLock,
|
| - base::Unretained(wake_lock_service_context)));
|
| + base::Bind(&ConnectToBlinkWakeLockWrapper, delegate_));
|
| }
|
|
|
| if (!permission_service_context_)
|
|
|