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

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

Issue 11364062: ui: Remove TouchStatus in favour of EventResult. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/user_activity_detector.h ('k') | ash/wm/window_cycle_controller.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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 bool UserActivityDetector::PreHandleMouseEvent(aura::Window* target, 43 bool UserActivityDetector::PreHandleMouseEvent(aura::Window* target,
44 ui::MouseEvent* event) { 44 ui::MouseEvent* event) {
45 VLOG_IF(1, ignore_next_mouse_event_) << "ignoring mouse event"; 45 VLOG_IF(1, ignore_next_mouse_event_) << "ignoring mouse event";
46 if (!(event->flags() & ui::EF_IS_SYNTHESIZED) && 46 if (!(event->flags() & ui::EF_IS_SYNTHESIZED) &&
47 !ignore_next_mouse_event_) 47 !ignore_next_mouse_event_)
48 MaybeNotify(); 48 MaybeNotify();
49 ignore_next_mouse_event_ = false; 49 ignore_next_mouse_event_ = false;
50 return false; 50 return false;
51 } 51 }
52 52
53 ui::TouchStatus UserActivityDetector::PreHandleTouchEvent( 53 ui::EventResult UserActivityDetector::PreHandleTouchEvent(
54 aura::Window* target, 54 aura::Window* target,
55 ui::TouchEvent* event) { 55 ui::TouchEvent* event) {
56 MaybeNotify(); 56 MaybeNotify();
57 return ui::TOUCH_STATUS_UNKNOWN; 57 return ui::ER_UNHANDLED;
58 } 58 }
59 59
60 ui::EventResult UserActivityDetector::PreHandleGestureEvent( 60 ui::EventResult UserActivityDetector::PreHandleGestureEvent(
61 aura::Window* target, 61 aura::Window* target,
62 ui::GestureEvent* event) { 62 ui::GestureEvent* event) {
63 MaybeNotify(); 63 MaybeNotify();
64 return ui::ER_UNHANDLED; 64 return ui::ER_UNHANDLED;
65 } 65 }
66 66
67 void UserActivityDetector::MaybeNotify() { 67 void UserActivityDetector::MaybeNotify() {
68 base::TimeTicks now = 68 base::TimeTicks now =
69 !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now(); 69 !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now();
70 if (last_observer_notification_time_.is_null() || 70 if (last_observer_notification_time_.is_null() ||
71 (now - last_observer_notification_time_).InMillisecondsF() >= 71 (now - last_observer_notification_time_).InMillisecondsF() >=
72 kNotifyIntervalMs) { 72 kNotifyIntervalMs) {
73 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity()); 73 FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity());
74 last_observer_notification_time_ = now; 74 last_observer_notification_time_ = now;
75 } 75 }
76 } 76 }
77 77
78 } // namespace ash 78 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/user_activity_detector.h ('k') | ash/wm/window_cycle_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698