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

Unified Diff: content/browser/wake_lock/wake_lock_web_contents_observer.cc

Issue 406483004: Initial implementation of API WakeLock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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/wake_lock/wake_lock_web_contents_observer.cc
diff --git a/content/browser/wake_lock/wake_lock_web_contents_observer.cc b/content/browser/wake_lock/wake_lock_web_contents_observer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e90a18e51070978c32d282267f5342b7522d2ca5
--- /dev/null
+++ b/content/browser/wake_lock/wake_lock_web_contents_observer.cc
@@ -0,0 +1,29 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/wake_lock/wake_lock_web_contents_observer.h"
+
+#include "content/browser/wake_lock/wake_lock_manager.h"
+#include "content/public/browser/render_process_host.h"
+#include "content/public/browser/web_contents.h"
+
+namespace content {
+
+WakeLockWebContentsObserver::WakeLockWebContentsObserver(
+ content::WebContents* webContent)
+ : content::WebContentsObserver(webContent) {
+}
+
+void WakeLockWebContentsObserver::WasShown() {
+ WakeLockManager::GetInstance()->tabWasShown(
+ web_contents()->GetRenderProcessHost()->GetID(),
+ web_contents()->GetRoutingID());
+}
+
+void WakeLockWebContentsObserver::WasHidden() {
+ WakeLockManager::GetInstance()->tabWasHidden(
+ web_contents()->GetRenderProcessHost()->GetID(),
+ web_contents()->GetRoutingID());
+}
+}

Powered by Google App Engine
This is Rietveld 408576698