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/wm/core/user_activity_detector.h" | 5 #include "ui/wm/core/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 "ui/events/event.h" | 10 #include "ui/events/event.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // will be reported as user activity and turn the screen back on; too high | 42 // will be reported as user activity and turn the screen back on; too high |
43 // and we'll ignore legitimate activity. | 43 // and we'll ignore legitimate activity. |
44 const int UserActivityDetector::kDisplayPowerChangeIgnoreMouseMs = 1000; | 44 const int UserActivityDetector::kDisplayPowerChangeIgnoreMouseMs = 1000; |
45 | 45 |
46 UserActivityDetector::UserActivityDetector() { | 46 UserActivityDetector::UserActivityDetector() { |
47 } | 47 } |
48 | 48 |
49 UserActivityDetector::~UserActivityDetector() { | 49 UserActivityDetector::~UserActivityDetector() { |
50 } | 50 } |
51 | 51 |
52 bool UserActivityDetector::HasObserver(UserActivityObserver* observer) const { | 52 bool UserActivityDetector::HasObserver( |
| 53 const UserActivityObserver* observer) const { |
53 return observers_.HasObserver(observer); | 54 return observers_.HasObserver(observer); |
54 } | 55 } |
55 | 56 |
56 void UserActivityDetector::AddObserver(UserActivityObserver* observer) { | 57 void UserActivityDetector::AddObserver(UserActivityObserver* observer) { |
57 observers_.AddObserver(observer); | 58 observers_.AddObserver(observer); |
58 } | 59 } |
59 | 60 |
60 void UserActivityDetector::RemoveObserver(UserActivityObserver* observer) { | 61 void UserActivityDetector::RemoveObserver(UserActivityObserver* observer) { |
61 observers_.RemoveObserver(observer); | 62 observers_.RemoveObserver(observer); |
62 } | 63 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 (now - last_observer_notification_time_).InMillisecondsF() >= | 104 (now - last_observer_notification_time_).InMillisecondsF() >= |
104 kNotifyIntervalMs) { | 105 kNotifyIntervalMs) { |
105 if (VLOG_IS_ON(1)) | 106 if (VLOG_IS_ON(1)) |
106 VLOG(1) << "Reporting user activity: " << GetEventDebugString(event); | 107 VLOG(1) << "Reporting user activity: " << GetEventDebugString(event); |
107 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event)); | 108 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event)); |
108 last_observer_notification_time_ = now; | 109 last_observer_notification_time_ = now; |
109 } | 110 } |
110 } | 111 } |
111 | 112 |
112 } // namespace wm | 113 } // namespace wm |
OLD | NEW |