OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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/profile_resetter/automatic_profile_resetter_factory.h" |
| 6 |
| 7 #include "base/memory/singleton.h" |
| 8 #include "base/prefs/pref_registry_simple.h" |
| 9 #include "chrome/browser/extensions/extension_system_factory.h" |
| 10 #include "chrome/browser/google/google_url_tracker_factory.h" |
| 11 #include "chrome/browser/profile_resetter/automatic_profile_resetter.h" |
| 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 14 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 15 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 16 #include "chrome/common/pref_names.h" |
| 17 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 18 #include "components/user_prefs/pref_registry_syncable.h" |
| 19 #include "content/public/browser/browser_context.h" |
| 20 |
| 21 // static |
| 22 AutomaticProfileResetter* AutomaticProfileResetterFactory::GetForBrowserContext( |
| 23 content::BrowserContext* context) { |
| 24 return static_cast<AutomaticProfileResetter*>( |
| 25 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 26 } |
| 27 |
| 28 // static |
| 29 AutomaticProfileResetterFactory* |
| 30 AutomaticProfileResetterFactory::GetInstance() { |
| 31 return Singleton<AutomaticProfileResetterFactory>::get(); |
| 32 } |
| 33 |
| 34 // static |
| 35 void AutomaticProfileResetterFactory::RegisterPrefs( |
| 36 PrefRegistrySimple* registry) { |
| 37 registry->RegisterDictionaryPref(prefs::kProfileResetPromptMemento); |
| 38 } |
| 39 |
| 40 AutomaticProfileResetterFactory::AutomaticProfileResetterFactory() |
| 41 : BrowserContextKeyedServiceFactory( |
| 42 "AutomaticProfileResetter", |
| 43 BrowserContextDependencyManager::GetInstance()) {} |
| 44 |
| 45 AutomaticProfileResetterFactory::~AutomaticProfileResetterFactory() {} |
| 46 |
| 47 BrowserContextKeyedService* |
| 48 AutomaticProfileResetterFactory::BuildServiceInstanceFor( |
| 49 content::BrowserContext* context) const { |
| 50 Profile* profile = Profile::FromBrowserContext(context); |
| 51 AutomaticProfileResetter* service = new AutomaticProfileResetter(profile); |
| 52 service->Initialize(); |
| 53 return service; |
| 54 } |
| 55 |
| 56 void AutomaticProfileResetterFactory::RegisterProfilePrefs( |
| 57 user_prefs::PrefRegistrySyncable* registry) { |
| 58 registry->RegisterStringPref( |
| 59 prefs::kProfileResetPromptMemento, |
| 60 "", |
| 61 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 62 } |
| 63 |
| 64 bool AutomaticProfileResetterFactory::ServiceIsCreatedWithBrowserContext() |
| 65 const { |
| 66 return true; |
| 67 } |
| 68 |
| 69 bool AutomaticProfileResetterFactory::ServiceIsNULLWhileTesting() const { |
| 70 return true; |
| 71 } |
OLD | NEW |