[ExtensionToolbarMac] Restrict action button drags to the container's bounds
[chromium-blink-merge.git] / chrome / browser / profile_resetter / automatic_profile_resetter_factory.cc
blob7acdff7896ec113458a77268c4abc98f1fd60cbd
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.
5 #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h"
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"
18 // static
19 AutomaticProfileResetter* AutomaticProfileResetterFactory::GetForBrowserContext(
20 content::BrowserContext* context) {
21 return static_cast<AutomaticProfileResetter*>(
22 GetInstance()->GetServiceForBrowserContext(context, true));
25 // static
26 AutomaticProfileResetterFactory*
27 AutomaticProfileResetterFactory::GetInstance() {
28 return Singleton<AutomaticProfileResetterFactory>::get();
31 // static
32 void AutomaticProfileResetterFactory::RegisterPrefs(
33 PrefRegistrySimple* registry) {
34 registry->RegisterDictionaryPref(
35 prefs::kProfileResetPromptMementosInLocalState);
38 AutomaticProfileResetterFactory::AutomaticProfileResetterFactory()
39 : BrowserContextKeyedServiceFactory(
40 "AutomaticProfileResetter",
41 BrowserContextDependencyManager::GetInstance()) {
42 DependsOn(TemplateURLServiceFactory::GetInstance());
43 DependsOn(GlobalErrorServiceFactory::GetInstance());
46 AutomaticProfileResetterFactory::~AutomaticProfileResetterFactory() {}
48 KeyedService* AutomaticProfileResetterFactory::BuildServiceInstanceFor(
49 content::BrowserContext* context) const {
50 Profile* profile = Profile::FromBrowserContext(context);
51 AutomaticProfileResetter* service = new AutomaticProfileResetter(profile);
52 service->Initialize();
53 service->Activate();
54 return service;
57 void AutomaticProfileResetterFactory::RegisterProfilePrefs(
58 user_prefs::PrefRegistrySyncable* registry) {
59 registry->RegisterStringPref(
60 prefs::kProfileResetPromptMementoInProfilePrefs,
61 "",
62 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
65 bool AutomaticProfileResetterFactory::
66 ServiceIsCreatedWithBrowserContext() const {
67 return true;
70 bool AutomaticProfileResetterFactory::ServiceIsNULLWhileTesting() const {
71 return true;