Chromium Code Reviews| 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..4921aeaca8bf905ea562b06bccbd66830d6801cc 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 = NULL; |
|
sky
2014/10/31 23:02:23
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 = NULL; |
| +} |
| + |
| +// static |
| +UserActivityDetector* UserActivityDetector::Get() { |
| + return g_instance; |
| } |
| bool UserActivityDetector::HasObserver(UserActivityObserver* observer) const { |