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

Unified Diff: content/browser/wake_lock/wake_lock_manager.h

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_manager.h
diff --git a/content/browser/wake_lock/wake_lock_manager.h b/content/browser/wake_lock/wake_lock_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..6f8d3e6e5891eced0176c8a432eb9432d540fa50
--- /dev/null
+++ b/content/browser/wake_lock/wake_lock_manager.h
@@ -0,0 +1,43 @@
+// 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.
+
+#ifndef CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_MANAGER_H_
+#define CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_MANAGER_H_
+
+#include <set>
+#include "base/memory/singleton.h"
+
+namespace content {
+
+class Lock;
+
+class WakeLockManager {
+ public:
+ static WakeLockManager* GetInstance();
+
+ void createScreenLock(int render_process_id, int routed_id);
+ bool releaseScreenLock(int render_process_id, int routed_id);
+
+ // Used for both tab switching and minimizing/maximizing browser
+ void tabWasShown(int render_process_id, int routed_id);
+ void tabWasHidden(int render_process_id, int routed_id);
+
+ void createWebContentsObserver(int render_process_id, int routed_id);
+
+ virtual ~WakeLockManager();
+
+ private:
+ friend struct DefaultSingletonTraits<WakeLockManager>;
+ WakeLockManager();
+ void tabChangeVisibility(int render_process_id, int routed_id, bool visible);
+ Lock* getLock(int render_process_if, int routed_id);
+
+ // TODO(redchenko): need smart pointer
+ std::set<Lock*> locks_;
+
+ DISALLOW_COPY_AND_ASSIGN(WakeLockManager);
+};
+}
+
+#endif // CONTENT_BROWSER_WAKE_LOCK_WAKE_LOCK_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698