Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: ui/base/user_activity/user_activity_detector.cc

Issue 2422073002: Reduce FOR_EACH_OBSERVER usage in ui/ (Closed)
Patch Set: remove space Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/ime/mock_input_method.cc ('k') | ui/base/win/osk_display_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 last_activity_name_ = event->name();
121 if (last_observer_notification_time_.is_null() || 121 if (last_observer_notification_time_.is_null() ||
122 (now - last_observer_notification_time_).InMillisecondsF() >= 122 (now - last_observer_notification_time_).InMillisecondsF() >=
123 kNotifyIntervalMs) { 123 kNotifyIntervalMs) {
124 if (VLOG_IS_ON(1)) 124 if (VLOG_IS_ON(1))
125 VLOG(1) << "Reporting user activity: " << GetEventDebugString(event); 125 VLOG(1) << "Reporting user activity: " << GetEventDebugString(event);
126 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event)); 126 for (UserActivityObserver& observer : observers_)
127 observer.OnUserActivity(event);
127 last_observer_notification_time_ = now; 128 last_observer_notification_time_ = now;
128 } 129 }
129 } 130 }
130 131
131 } // namespace ui 132 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/ime/mock_input_method.cc ('k') | ui/base/win/osk_display_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698