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

Side by Side Diff: ash/wm/user_activity_detector.cc

Issue 11568006: events: Update scroll and touch handlers to not return EventResult. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: self-nit Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/user_activity_detector.h ('k') | ash/wm/user_activity_detector_unittest.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 (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 "ash/wm/user_activity_detector.h"
6 6
7 #include "ash/wm/property_util.h" 7 #include "ash/wm/property_util.h"
8 #include "ash/wm/user_activity_observer.h" 8 #include "ash/wm/user_activity_observer.h"
9 #include "ui/base/events/event.h" 9 #include "ui/base/events/event.h"
10 10
(...skipping 30 matching lines...) Expand all
41 41
42 ui::EventResult UserActivityDetector::OnMouseEvent(ui::MouseEvent* event) { 42 ui::EventResult UserActivityDetector::OnMouseEvent(ui::MouseEvent* event) {
43 VLOG_IF(1, ignore_next_mouse_event_) << "ignoring mouse event"; 43 VLOG_IF(1, ignore_next_mouse_event_) << "ignoring mouse event";
44 if (!(event->flags() & ui::EF_IS_SYNTHESIZED) && 44 if (!(event->flags() & ui::EF_IS_SYNTHESIZED) &&
45 !ignore_next_mouse_event_) 45 !ignore_next_mouse_event_)
46 MaybeNotify(); 46 MaybeNotify();
47 ignore_next_mouse_event_ = false; 47 ignore_next_mouse_event_ = false;
48 return ui::ER_UNHANDLED; 48 return ui::ER_UNHANDLED;
49 } 49 }
50 50
51 ui::EventResult UserActivityDetector::OnScrollEvent(ui::ScrollEvent* event) { 51 void UserActivityDetector::OnScrollEvent(ui::ScrollEvent* event) {
52 MaybeNotify(); 52 MaybeNotify();
53 return ui::ER_UNHANDLED;
54 } 53 }
55 54
56 ui::EventResult UserActivityDetector::OnTouchEvent(ui::TouchEvent* event) { 55 void UserActivityDetector::OnTouchEvent(ui::TouchEvent* event) {
57 MaybeNotify(); 56 MaybeNotify();
58 return ui::ER_UNHANDLED;
59 } 57 }
60 58
61 void UserActivityDetector::OnGestureEvent(ui::GestureEvent* event) { 59 void UserActivityDetector::OnGestureEvent(ui::GestureEvent* event) {
62 MaybeNotify(); 60 MaybeNotify();
63 } 61 }
64 62
65 void UserActivityDetector::MaybeNotify() { 63 void UserActivityDetector::MaybeNotify() {
66 base::TimeTicks now = 64 base::TimeTicks now =
67 !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now(); 65 !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now();
68 if (last_observer_notification_time_.is_null() || 66 if (last_observer_notification_time_.is_null() ||
69 (now - last_observer_notification_time_).InMillisecondsF() >= 67 (now - last_observer_notification_time_).InMillisecondsF() >=
70 kNotifyIntervalMs) { 68 kNotifyIntervalMs) {
71 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity()); 69 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity());
72 last_observer_notification_time_ = now; 70 last_observer_notification_time_ = now;
73 } 71 }
74 } 72 }
75 73
76 } // namespace ash 74 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/user_activity_detector.h ('k') | ash/wm/user_activity_detector_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698