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

Side by Side Diff: chrome/browser/chromeos/session_length_limiter_factory.cc

Issue 11499012: Add policy for limiting the session length (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Not sure why the patch is not applying - bot source out of sync with ToT? 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
(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 #include "chrome/browser/chromeos/session_length_limiter_factory.h"
6
7 #include "chrome/browser/chromeos/session_length_limiter.h"
8 #include "chrome/browser/prefs/pref_service.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_dependency_manager.h"
11 #include "chrome/common/pref_names.h"
12
13 namespace chromeos {
14
15 // static
16 SessionLengthLimiterFactory* SessionLengthLimiterFactory::GetInstance() {
17 return Singleton<SessionLengthLimiterFactory>::get();
18 }
19
20 SessionLengthLimiterFactory::SessionLengthLimiterFactory()
21 : ProfileKeyedServiceFactory("SessionLengthLimiter",
22 ProfileDependencyManager::GetInstance()) {
23 }
24
25 SessionLengthLimiterFactory::~SessionLengthLimiterFactory() {
26 }
27
28 ProfileKeyedService* SessionLengthLimiterFactory::BuildServiceInstanceFor(
29 Profile* profile) const {
30 return new SessionLengthLimiter(NULL, profile->GetPrefs());
31 }
32
33 void SessionLengthLimiterFactory::RegisterUserPrefs(PrefService* prefs) {
34 prefs->RegisterInt64Pref(prefs::kSessionStartTime,
35 0,
36 PrefService::UNSYNCABLE_PREF);
37 prefs->RegisterIntegerPref(prefs::kSessionLengthLimit,
38 0,
39 PrefService::UNSYNCABLE_PREF);
40 }
41
42 bool SessionLengthLimiterFactory::ServiceIsCreatedWithProfile() const {
43 return true;
44 }
45
46 bool SessionLengthLimiterFactory::ServiceIsNULLWhileTesting() const {
47 // Some tests replace the |PrefService| of the |TestingProfile| after the
48 // |SessionLengthLimiter| has been created, making its |Shutdown()| try to
49 // remove a |PrefChangeRegistrar| from a non-existent |PrefService|.
50 return true;
51 }
52
53 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698