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

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

Issue 10544011: chromeos: Notify power manager about user activity. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RootWindowEventFilter -> EnvEventFilter Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « ash/shell.cc ('k') | ash/wm/user_activity_detector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ASH_WM_USER_ACTIVITY_DETECTOR_H_
6 #define ASH_WM_USER_ACTIVITY_DETECTOR_H_
7 #pragma once
8
9 #include "ash/ash_export.h"
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/observer_list.h"
13 #include "base/time.h"
14 #include "ui/aura/event_filter.h"
15
16 namespace ash {
17
18 class UserActivityObserver;
19
20 // Watches for input events and notifies observers that the user is active.
21 class ASH_EXPORT UserActivityDetector : public aura::EventFilter {
22 public:
23 // Minimum amount of time between notifications to observers that a video is
24 // playing.
25 static const double kNotifyIntervalSec;
26
27 UserActivityDetector();
28 virtual ~UserActivityDetector();
29
30 void AddObserver(UserActivityObserver* observer);
31 void RemoveObserver(UserActivityObserver* observer);
32
33 // aura::EventFilter implementation.
34 virtual bool PreHandleKeyEvent(
35 aura::Window* target,
36 aura::KeyEvent* event) OVERRIDE;
37 virtual bool PreHandleMouseEvent(
38 aura::Window* target,
39 aura::MouseEvent* event) OVERRIDE;
40 virtual ui::TouchStatus PreHandleTouchEvent(
41 aura::Window* target,
42 aura::TouchEvent* event) OVERRIDE;
43 virtual ui::GestureStatus PreHandleGestureEvent(
44 aura::Window* target,
45 aura::GestureEvent* event) OVERRIDE;
46
47 private:
48 // Notifies observers if enough time has passed since the last notification.
49 void MaybeNotify();
50
51 ObserverList<UserActivityObserver> observers_;
52
53 // Last time at which we notified observers that the user was active.
54 base::TimeTicks last_observer_notification_time_;
55
56 DISALLOW_COPY_AND_ASSIGN(UserActivityDetector);
57 };
58
59 } // namespace ash
60
61 #endif // ASH_WM_USER_ACTIVITY_DETECTOR_H_
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | ash/wm/user_activity_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698