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

Unified Diff: ui/wm/core/user_activity_detector.cc

Issue 693643004: Make UserActivityDetector a singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@athena_do_not_use_ash45
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « ui/wm/core/user_activity_detector.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/user_activity_detector.cc
diff --git a/ui/wm/core/user_activity_detector.cc b/ui/wm/core/user_activity_detector.cc
index 56bf563b3d032f11b34b87a5af295b78f11c4b7e..6b06743bc004cc315eb9de9f6a4c88833fdb09aa 100644
--- a/ui/wm/core/user_activity_detector.cc
+++ b/ui/wm/core/user_activity_detector.cc
@@ -14,6 +14,8 @@ namespace wm {
namespace {
+UserActivityDetector* g_instance = nullptr;
+
// Returns a string describing |event|.
std::string GetEventDebugString(const ui::Event* event) {
std::string details = base::StringPrintf(
@@ -44,9 +46,17 @@ const int UserActivityDetector::kNotifyIntervalMs = 200;
const int UserActivityDetector::kDisplayPowerChangeIgnoreMouseMs = 1000;
UserActivityDetector::UserActivityDetector() {
+ CHECK(!g_instance);
+ g_instance = this;
}
UserActivityDetector::~UserActivityDetector() {
+ g_instance = nullptr;
+}
+
+// static
+UserActivityDetector* UserActivityDetector::Get() {
+ return g_instance;
}
bool UserActivityDetector::HasObserver(UserActivityObserver* observer) const {
« no previous file with comments | « ui/wm/core/user_activity_detector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698