| Index: chrome/browser/chromeos/session_length_limiter_factory.cc
|
| diff --git a/chrome/browser/chromeos/session_length_limiter_factory.cc b/chrome/browser/chromeos/session_length_limiter_factory.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..dac281b700365ad0d7befb22344fbfb332eaa521
|
| --- /dev/null
|
| +++ b/chrome/browser/chromeos/session_length_limiter_factory.cc
|
| @@ -0,0 +1,53 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/chromeos/session_length_limiter_factory.h"
|
| +
|
| +#include "chrome/browser/chromeos/session_length_limiter.h"
|
| +#include "chrome/browser/prefs/pref_service.h"
|
| +#include "chrome/browser/profiles/profile.h"
|
| +#include "chrome/browser/profiles/profile_dependency_manager.h"
|
| +#include "chrome/common/pref_names.h"
|
| +
|
| +namespace chromeos {
|
| +
|
| +// static
|
| +SessionLengthLimiterFactory* SessionLengthLimiterFactory::GetInstance() {
|
| + return Singleton<SessionLengthLimiterFactory>::get();
|
| +}
|
| +
|
| +SessionLengthLimiterFactory::SessionLengthLimiterFactory()
|
| + : ProfileKeyedServiceFactory("SessionLengthLimiter",
|
| + ProfileDependencyManager::GetInstance()) {
|
| +}
|
| +
|
| +SessionLengthLimiterFactory::~SessionLengthLimiterFactory() {
|
| +}
|
| +
|
| +ProfileKeyedService* SessionLengthLimiterFactory::BuildServiceInstanceFor(
|
| + Profile* profile) const {
|
| + return new SessionLengthLimiter(NULL, profile->GetPrefs());
|
| +}
|
| +
|
| +void SessionLengthLimiterFactory::RegisterUserPrefs(PrefService* prefs) {
|
| + prefs->RegisterInt64Pref(prefs::kSessionStartTime,
|
| + 0,
|
| + PrefService::UNSYNCABLE_PREF);
|
| + prefs->RegisterIntegerPref(prefs::kSessionLengthLimit,
|
| + 0,
|
| + PrefService::UNSYNCABLE_PREF);
|
| +}
|
| +
|
| +bool SessionLengthLimiterFactory::ServiceIsCreatedWithProfile() const {
|
| + return true;
|
| +}
|
| +
|
| +bool SessionLengthLimiterFactory::ServiceIsNULLWhileTesting() const {
|
| + // Some tests replace the |PrefService| of the |TestingProfile| after the
|
| + // |SessionLengthLimiter| has been created, making its |Shutdown()| try to
|
| + // remove a |PrefChangeRegistrar| from a non-existent |PrefService|.
|
| + return true;
|
| +}
|
| +
|
| +} // namespace chromeos
|
|
|