| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  110         && GetCurrentTime() < honor_mouse_events_time_) |  110         && GetCurrentTime() < honor_mouse_events_time_) | 
|  111       return; |  111       return; | 
|  112   } |  112   } | 
|  113  |  113  | 
|  114   HandleActivity(event); |  114   HandleActivity(event); | 
|  115 } |  115 } | 
|  116  |  116  | 
|  117 void UserActivityDetector::HandleActivity(const ui::Event* event) { |  117 void UserActivityDetector::HandleActivity(const ui::Event* event) { | 
|  118   base::TimeTicks now = GetCurrentTime(); |  118   base::TimeTicks now = GetCurrentTime(); | 
|  119   last_activity_time_ = now; |  119   last_activity_time_ = now; | 
 |  120   last_activity_name_ = event->name(); | 
|  120   if (last_observer_notification_time_.is_null() || |  121   if (last_observer_notification_time_.is_null() || | 
|  121       (now - last_observer_notification_time_).InMillisecondsF() >= |  122       (now - last_observer_notification_time_).InMillisecondsF() >= | 
|  122       kNotifyIntervalMs) { |  123       kNotifyIntervalMs) { | 
|  123     if (VLOG_IS_ON(1)) |  124     if (VLOG_IS_ON(1)) | 
|  124       VLOG(1) << "Reporting user activity: " << GetEventDebugString(event); |  125       VLOG(1) << "Reporting user activity: " << GetEventDebugString(event); | 
|  125     FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event)); |  126     FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event)); | 
|  126     last_observer_notification_time_ = now; |  127     last_observer_notification_time_ = now; | 
|  127   } |  128   } | 
|  128 } |  129 } | 
|  129  |  130  | 
|  130 }  // namespace ui |  131 }  // namespace ui | 
| OLD | NEW |