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

Side by Side Diff: chrome/browser/chromeos/session_length_limiter.h

Issue 222383002: Move UserActivityDetector from ash/wm/ to ui/wm/core/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove an unneeded include Created 6 years, 8 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
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 #ifndef CHROME_BROWSER_CHROMEOS_SESSION_LENGTH_LIMITER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_SESSION_LENGTH_LIMITER_H_
6 #define CHROME_BROWSER_CHROMEOS_SESSION_LENGTH_LIMITER_H_ 6 #define CHROME_BROWSER_CHROMEOS_SESSION_LENGTH_LIMITER_H_
7 7
8 #include "ash/wm/user_activity_observer.h"
9 #include "base/basictypes.h" 8 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
12 #include "base/prefs/pref_change_registrar.h" 11 #include "base/prefs/pref_change_registrar.h"
13 #include "base/threading/thread_checker.h" 12 #include "base/threading/thread_checker.h"
14 #include "base/time/time.h" 13 #include "base/time/time.h"
15 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
15 #include "ui/wm/core/user_activity_observer.h"
16 16
17 class PrefService; 17 class PrefService;
18 class PrefRegistrySimple; 18 class PrefRegistrySimple;
19 19
20 namespace chromeos { 20 namespace chromeos {
21 21
22 // Enforces a session length limit by terminating the session when the limit is 22 // Enforces a session length limit by terminating the session when the limit is
23 // reached. 23 // reached.
24 class SessionLengthLimiter : public ash::UserActivityObserver { 24 class SessionLengthLimiter : public wm::UserActivityObserver {
25 public: 25 public:
26 class Delegate { 26 class Delegate {
27 public: 27 public:
28 virtual ~Delegate(); 28 virtual ~Delegate();
29 29
30 virtual const base::TimeTicks GetCurrentTime() const = 0; 30 virtual const base::TimeTicks GetCurrentTime() const = 0;
31 virtual void StopSession() = 0; 31 virtual void StopSession() = 0;
32 }; 32 };
33 33
34 // Registers preferences. 34 // Registers preferences.
35 static void RegisterPrefs(PrefRegistrySimple* registry); 35 static void RegisterPrefs(PrefRegistrySimple* registry);
36 36
37 SessionLengthLimiter(Delegate* delegate, bool browser_restarted); 37 SessionLengthLimiter(Delegate* delegate, bool browser_restarted);
38 virtual ~SessionLengthLimiter(); 38 virtual ~SessionLengthLimiter();
39 39
40 // ash::UserActivityObserver: 40 // wm::UserActivityObserver:
41 virtual void OnUserActivity(const ui::Event* event) OVERRIDE; 41 virtual void OnUserActivity(const ui::Event* event) OVERRIDE;
42 42
43 private: 43 private:
44 // Attempt to restore the session start time and the flag indicating user 44 // Attempt to restore the session start time and the flag indicating user
45 // activity from local state. Return |true| if the restore is successful. 45 // activity from local state. Return |true| if the restore is successful.
46 bool RestoreStateAfterCrash(); 46 bool RestoreStateAfterCrash();
47 47
48 // Update the session start time if possible: 48 // Update the session start time if possible:
49 // * If instructed to wait for initial user activity, the session start time 49 // * If instructed to wait for initial user activity, the session start time
50 // advances every time this method is called as long as no user activity has 50 // advances every time this method is called as long as no user activity has
(...skipping 15 matching lines...) Expand all
66 scoped_ptr<base::OneShotTimer<SessionLengthLimiter::Delegate> > timer_; 66 scoped_ptr<base::OneShotTimer<SessionLengthLimiter::Delegate> > timer_;
67 base::TimeTicks session_start_time_; 67 base::TimeTicks session_start_time_;
68 bool user_activity_seen_; 68 bool user_activity_seen_;
69 69
70 DISALLOW_COPY_AND_ASSIGN(SessionLengthLimiter); 70 DISALLOW_COPY_AND_ASSIGN(SessionLengthLimiter);
71 }; 71 };
72 72
73 } // namespace chromeos 73 } // namespace chromeos
74 74
75 #endif // CHROME_BROWSER_CHROMEOS_SESSION_LENGTH_LIMITER_H_ 75 #endif // CHROME_BROWSER_CHROMEOS_SESSION_LENGTH_LIMITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698