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

Side by Side Diff: chrome/browser/profile_resetter/automatic_profile_resetter_factory.cc

Issue 271673006: Eliminate all code related to the AutomaticProfileResetter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nit from dbeam@, using new tracked preference deprecation. Created 6 years, 4 months 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 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/profile_resetter/automatic_profile_resetter.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/search_engines/template_url_service_factory.h"
12 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
13 #include "chrome/common/pref_names.h"
14 #include "components/keyed_service/content/browser_context_dependency_manager.h"
15 #include "components/pref_registry/pref_registry_syncable.h"
16 #include "content/public/browser/browser_context.h"
17
18 // static
19 AutomaticProfileResetter* AutomaticProfileResetterFactory::GetForBrowserContext(
20 content::BrowserContext* context) {
21 return static_cast<AutomaticProfileResetter*>(
22 GetInstance()->GetServiceForBrowserContext(context, true));
23 }
24
25 // static
26 AutomaticProfileResetterFactory*
27 AutomaticProfileResetterFactory::GetInstance() {
28 return Singleton<AutomaticProfileResetterFactory>::get();
29 }
30
31 // static
32 void AutomaticProfileResetterFactory::RegisterPrefs(
33 PrefRegistrySimple* registry) {
34 registry->RegisterDictionaryPref(prefs::kProfileResetPromptMemento);
35 }
36
37 AutomaticProfileResetterFactory::AutomaticProfileResetterFactory()
38 : BrowserContextKeyedServiceFactory(
39 "AutomaticProfileResetter",
40 BrowserContextDependencyManager::GetInstance()) {
41 DependsOn(TemplateURLServiceFactory::GetInstance());
42 DependsOn(GlobalErrorServiceFactory::GetInstance());
43 }
44
45 AutomaticProfileResetterFactory::~AutomaticProfileResetterFactory() {}
46
47 KeyedService* AutomaticProfileResetterFactory::BuildServiceInstanceFor(
48 content::BrowserContext* context) const {
49 Profile* profile = Profile::FromBrowserContext(context);
50 AutomaticProfileResetter* service = new AutomaticProfileResetter(profile);
51 service->Initialize();
52 service->Activate();
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::
65 ServiceIsCreatedWithBrowserContext() const {
66 return true;
67 }
68
69 bool AutomaticProfileResetterFactory::ServiceIsNULLWhileTesting() const {
70 return true;
71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698