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

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1393203004: Reland of Wake Lock API implementation (Chromium part) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix presubmit errors Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
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 39e9fc5c4d805792d3c1c0e2739b5b8ac5143f44..2eb21629d8ac4060822dad4f9939517a3d872919 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -42,6 +42,7 @@
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
+#include "content/browser/wake_lock/wake_lock_service_context.h"
#include "content/common/accessibility_messages.h"
#include "content/common/frame_messages.h"
#include "content/common/input_messages.h"
@@ -1610,6 +1611,18 @@ void RenderFrameHostImpl::RegisterMojoServices() {
base::Unretained(this))));
}
+ WakeLockServiceContext* 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.
+ GetServiceRegistry()->AddService<WakeLockService>(
+ base::Bind(&WakeLockServiceContext::CreateService,
+ base::Unretained(wake_lock_service_context),
+ GetProcess()->GetID(), GetRoutingID()));
+ }
+
if (!permission_service_context_)
permission_service_context_.reset(new PermissionServiceContext(this));
« no previous file with comments | « content/browser/frame_host/render_frame_host_delegate.cc ('k') | content/browser/wake_lock/wake_lock_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698