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

Side by Side Diff: ui/wm/core/user_activity_detector.cc

Issue 697953002: ObserverList::HasObserver now takes a const pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile errors (ChromeOS unit tests). Created 6 years, 1 month 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/wm/core/user_activity_detector.h ('k') | no next file » | 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/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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 UserActivityDetector::~UserActivityDetector() { 53 UserActivityDetector::~UserActivityDetector() {
54 g_instance = nullptr; 54 g_instance = nullptr;
55 } 55 }
56 56
57 // static 57 // static
58 UserActivityDetector* UserActivityDetector::Get() { 58 UserActivityDetector* UserActivityDetector::Get() {
59 return g_instance; 59 return g_instance;
60 } 60 }
61 61
62 bool UserActivityDetector::HasObserver(UserActivityObserver* observer) const { 62 bool UserActivityDetector::HasObserver(
63 const UserActivityObserver* observer) const {
63 return observers_.HasObserver(observer); 64 return observers_.HasObserver(observer);
64 } 65 }
65 66
66 void UserActivityDetector::AddObserver(UserActivityObserver* observer) { 67 void UserActivityDetector::AddObserver(UserActivityObserver* observer) {
67 observers_.AddObserver(observer); 68 observers_.AddObserver(observer);
68 } 69 }
69 70
70 void UserActivityDetector::RemoveObserver(UserActivityObserver* observer) { 71 void UserActivityDetector::RemoveObserver(UserActivityObserver* observer) {
71 observers_.RemoveObserver(observer); 72 observers_.RemoveObserver(observer);
72 } 73 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 (now - last_observer_notification_time_).InMillisecondsF() >= 114 (now - last_observer_notification_time_).InMillisecondsF() >=
114 kNotifyIntervalMs) { 115 kNotifyIntervalMs) {
115 if (VLOG_IS_ON(1)) 116 if (VLOG_IS_ON(1))
116 VLOG(1) << "Reporting user activity: " << GetEventDebugString(event); 117 VLOG(1) << "Reporting user activity: " << GetEventDebugString(event);
117 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event)); 118 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event));
118 last_observer_notification_time_ = now; 119 last_observer_notification_time_ = now;
119 } 120 }
120 } 121 }
121 122
122 } // namespace wm 123 } // namespace wm
OLDNEW
« no previous file with comments | « ui/wm/core/user_activity_detector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698