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

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

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again, previous had unrelated broken win_rel test. 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
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_POWER_SESSION_LENGTH_LIMITER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POWER_SESSION_LENGTH_LIMITER_H_
6 #define CHROME_BROWSER_CHROMEOS_POWER_SESSION_LENGTH_LIMITER_H_ 6 #define CHROME_BROWSER_CHROMEOS_POWER_SESSION_LENGTH_LIMITER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/prefs/public/pref_change_registrar.h" 10 #include "base/prefs/public/pref_change_registrar.h"
11 #include "base/threading/thread_checker.h" 11 #include "base/threading/thread_checker.h"
12 #include "base/time.h" 12 #include "base/time.h"
13 #include "base/timer.h" 13 #include "base/timer.h"
14 14
15 class PrefService; 15 class PrefService;
16 class PrefServiceSimple;
16 17
17 namespace chromeos { 18 namespace chromeos {
18 19
19 // Enforces a session length limit by terminating the session when the limit is 20 // Enforces a session length limit by terminating the session when the limit is
20 // reached. 21 // reached.
21 class SessionLengthLimiter { 22 class SessionLengthLimiter {
22 public: 23 public:
23 class Delegate { 24 class Delegate {
24 public: 25 public:
25 virtual ~Delegate(); 26 virtual ~Delegate();
26 27
27 virtual const base::Time GetCurrentTime() const = 0; 28 virtual const base::Time GetCurrentTime() const = 0;
28 virtual void StopSession() = 0; 29 virtual void StopSession() = 0;
29 }; 30 };
30 31
31 // Registers preferences. 32 // Registers preferences.
32 static void RegisterPrefs(PrefService* local_state); 33 static void RegisterPrefs(PrefServiceSimple* local_state);
33 34
34 SessionLengthLimiter(Delegate* delegate, bool browser_restarted); 35 SessionLengthLimiter(Delegate* delegate, bool browser_restarted);
35 ~SessionLengthLimiter(); 36 ~SessionLengthLimiter();
36 37
37 private: 38 private:
38 void OnSessionLengthLimitChanged(); 39 void OnSessionLengthLimitChanged();
39 40
40 // Starts a timer that periodically checks whether the remaining time has 41 // Starts a timer that periodically checks whether the remaining time has
41 // reached zero. 42 // reached zero.
42 void StartTimer(); 43 void StartTimer();
(...skipping 13 matching lines...) Expand all
56 scoped_ptr<base::RepeatingTimer<SessionLengthLimiter> > repeating_timer_; 57 scoped_ptr<base::RepeatingTimer<SessionLengthLimiter> > repeating_timer_;
57 base::Time session_start_time_; 58 base::Time session_start_time_;
58 base::TimeDelta session_length_limit_; 59 base::TimeDelta session_length_limit_;
59 60
60 DISALLOW_COPY_AND_ASSIGN(SessionLengthLimiter); 61 DISALLOW_COPY_AND_ASSIGN(SessionLengthLimiter);
61 }; 62 };
62 63
63 } // namespace chromeos 64 } // namespace chromeos
64 65
65 #endif // CHROME_BROWSER_CHROMEOS_POWER_SESSION_LENGTH_LIMITER_H_ 66 #endif // CHROME_BROWSER_CHROMEOS_POWER_SESSION_LENGTH_LIMITER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller.cc ('k') | chrome/browser/chromeos/power/session_length_limiter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698