| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/wm/user_activity_detector.h" | 5 #include "ui/wm/core/user_activity_detector.h" |
| 6 | 6 |
| 7 #include "ash/wm/user_activity_observer.h" | |
| 8 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 9 #include "base/logging.h" | 8 #include "base/logging.h" |
| 10 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 11 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
| 11 #include "ui/wm/core/user_activity_observer.h" |
| 12 | 12 |
| 13 namespace ash { | 13 namespace wm { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // Returns a string describing |event|. | 17 // Returns a string describing |event|. |
| 18 std::string GetEventDebugString(const ui::Event* event) { | 18 std::string GetEventDebugString(const ui::Event* event) { |
| 19 std::string details = base::StringPrintf( | 19 std::string details = base::StringPrintf( |
| 20 "type=%d name=%s flags=%d time=%" PRId64, | 20 "type=%d name=%s flags=%d time=%" PRId64, |
| 21 event->type(), event->name().c_str(), event->flags(), | 21 event->type(), event->name().c_str(), event->flags(), |
| 22 event->time_stamp().InMilliseconds()); | 22 event->time_stamp().InMilliseconds()); |
| 23 | 23 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 if (last_observer_notification_time_.is_null() || | 102 if (last_observer_notification_time_.is_null() || |
| 103 (now - last_observer_notification_time_).InMillisecondsF() >= | 103 (now - last_observer_notification_time_).InMillisecondsF() >= |
| 104 kNotifyIntervalMs) { | 104 kNotifyIntervalMs) { |
| 105 if (VLOG_IS_ON(1)) | 105 if (VLOG_IS_ON(1)) |
| 106 VLOG(1) << "Reporting user activity: " << GetEventDebugString(event); | 106 VLOG(1) << "Reporting user activity: " << GetEventDebugString(event); |
| 107 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event)); | 107 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event)); |
| 108 last_observer_notification_time_ = now; | 108 last_observer_notification_time_ = now; |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace ash | 112 } // namespace wm |
| OLD | NEW |