| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/base/user_activity/user_activity_detector.h" | 5 #include "ui/base/user_activity/user_activity_detector.h" |
| 6 | 6 |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 if (platform_event_source) | 64 if (platform_event_source) |
| 65 platform_event_source->RemovePlatformEventObserver(this); | 65 platform_event_source->RemovePlatformEventObserver(this); |
| 66 g_instance = nullptr; | 66 g_instance = nullptr; |
| 67 } | 67 } |
| 68 | 68 |
| 69 // static | 69 // static |
| 70 UserActivityDetector* UserActivityDetector::Get() { | 70 UserActivityDetector* UserActivityDetector::Get() { |
| 71 return g_instance; | 71 return g_instance; |
| 72 } | 72 } |
| 73 | 73 |
| 74 // static |
| 75 void UserActivityDetector::OnDisplayPowerChangingStatic() { |
| 76 if (g_instance) |
| 77 g_instance->OnDisplayPowerChanging(); |
| 78 } |
| 79 |
| 74 bool UserActivityDetector::HasObserver( | 80 bool UserActivityDetector::HasObserver( |
| 75 const UserActivityObserver* observer) const { | 81 const UserActivityObserver* observer) const { |
| 76 return observers_.HasObserver(observer); | 82 return observers_.HasObserver(observer); |
| 77 } | 83 } |
| 78 | 84 |
| 79 void UserActivityDetector::AddObserver(UserActivityObserver* observer) { | 85 void UserActivityDetector::AddObserver(UserActivityObserver* observer) { |
| 80 observers_.AddObserver(observer); | 86 observers_.AddObserver(observer); |
| 81 } | 87 } |
| 82 | 88 |
| 83 void UserActivityDetector::RemoveObserver(UserActivityObserver* observer) { | 89 void UserActivityDetector::RemoveObserver(UserActivityObserver* observer) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 kNotifyIntervalMs) { | 129 kNotifyIntervalMs) { |
| 124 if (VLOG_IS_ON(1)) | 130 if (VLOG_IS_ON(1)) |
| 125 VLOG(1) << "Reporting user activity: " << GetEventDebugString(event); | 131 VLOG(1) << "Reporting user activity: " << GetEventDebugString(event); |
| 126 for (UserActivityObserver& observer : observers_) | 132 for (UserActivityObserver& observer : observers_) |
| 127 observer.OnUserActivity(event); | 133 observer.OnUserActivity(event); |
| 128 last_observer_notification_time_ = now; | 134 last_observer_notification_time_ = now; |
| 129 } | 135 } |
| 130 } | 136 } |
| 131 | 137 |
| 132 } // namespace ui | 138 } // namespace ui |
| OLD | NEW |