| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" | 5 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "base/prefs/pref_registry_simple.h" | 8 #include "base/prefs/pref_registry_simple.h" |
| 9 #include "chrome/browser/extensions/extension_system_factory.h" | 9 #include "chrome/browser/extensions/extension_system_factory.h" |
| 10 #include "chrome/browser/google/google_url_tracker_factory.h" | 10 #include "chrome/browser/google/google_url_tracker_factory.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 // static | 34 // static |
| 35 void AutomaticProfileResetterFactory::RegisterPrefs( | 35 void AutomaticProfileResetterFactory::RegisterPrefs( |
| 36 PrefRegistrySimple* registry) { | 36 PrefRegistrySimple* registry) { |
| 37 registry->RegisterDictionaryPref(prefs::kProfileResetPromptMemento); | 37 registry->RegisterDictionaryPref(prefs::kProfileResetPromptMemento); |
| 38 } | 38 } |
| 39 | 39 |
| 40 AutomaticProfileResetterFactory::AutomaticProfileResetterFactory() | 40 AutomaticProfileResetterFactory::AutomaticProfileResetterFactory() |
| 41 : BrowserContextKeyedServiceFactory( | 41 : BrowserContextKeyedServiceFactory( |
| 42 "AutomaticProfileResetter", | 42 "AutomaticProfileResetter", |
| 43 BrowserContextDependencyManager::GetInstance()) {} | 43 BrowserContextDependencyManager::GetInstance()) { |
| 44 DependsOn(TemplateURLServiceFactory::GetInstance()); |
| 45 } |
| 44 | 46 |
| 45 AutomaticProfileResetterFactory::~AutomaticProfileResetterFactory() {} | 47 AutomaticProfileResetterFactory::~AutomaticProfileResetterFactory() {} |
| 46 | 48 |
| 47 BrowserContextKeyedService* | 49 BrowserContextKeyedService* |
| 48 AutomaticProfileResetterFactory::BuildServiceInstanceFor( | 50 AutomaticProfileResetterFactory::BuildServiceInstanceFor( |
| 49 content::BrowserContext* context) const { | 51 content::BrowserContext* context) const { |
| 50 Profile* profile = Profile::FromBrowserContext(context); | 52 Profile* profile = Profile::FromBrowserContext(context); |
| 51 AutomaticProfileResetter* service = new AutomaticProfileResetter(profile); | 53 AutomaticProfileResetter* service = new AutomaticProfileResetter(profile); |
| 52 service->Initialize(); | 54 service->Activate(); |
| 53 return service; | 55 return service; |
| 54 } | 56 } |
| 55 | 57 |
| 56 void AutomaticProfileResetterFactory::RegisterProfilePrefs( | 58 void AutomaticProfileResetterFactory::RegisterProfilePrefs( |
| 57 user_prefs::PrefRegistrySyncable* registry) { | 59 user_prefs::PrefRegistrySyncable* registry) { |
| 58 registry->RegisterStringPref( | 60 registry->RegisterStringPref( |
| 59 prefs::kProfileResetPromptMemento, | 61 prefs::kProfileResetPromptMemento, |
| 60 "", | 62 "", |
| 61 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 63 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 62 } | 64 } |
| 63 | 65 |
| 64 bool AutomaticProfileResetterFactory::ServiceIsCreatedWithBrowserContext() | 66 bool AutomaticProfileResetterFactory::ServiceIsCreatedWithBrowserContext() |
| 65 const { | 67 const { |
| 66 return true; | 68 return true; |
| 67 } | 69 } |
| 68 | 70 |
| 69 bool AutomaticProfileResetterFactory::ServiceIsNULLWhileTesting() const { | 71 bool AutomaticProfileResetterFactory::ServiceIsNULLWhileTesting() const { |
| 70 return true; | 72 return true; |
| 71 } | 73 } |
| OLD | NEW |