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()); |
+} |
+} |