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

Unified Diff: chrome/browser/profile_resetter/automatic_profile_resetter_factory.cc

Issue 533183002: Revert "Eliminate all code related to the AutomaticProfileResetter." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/profile_resetter/automatic_profile_resetter_factory.cc
diff --git a/chrome/browser/profile_resetter/automatic_profile_resetter_factory.cc b/chrome/browser/profile_resetter/automatic_profile_resetter_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7acdff7896ec113458a77268c4abc98f1fd60cbd
--- /dev/null
+++ b/chrome/browser/profile_resetter/automatic_profile_resetter_factory.cc
@@ -0,0 +1,72 @@
+// Copyright 2013 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/profile_resetter/automatic_profile_resetter_factory.h"
+
+#include "base/memory/singleton.h"
+#include "base/prefs/pref_registry_simple.h"
+#include "chrome/browser/profile_resetter/automatic_profile_resetter.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/search_engines/template_url_service_factory.h"
+#include "chrome/browser/ui/global_error/global_error_service_factory.h"
+#include "chrome/common/pref_names.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "components/pref_registry/pref_registry_syncable.h"
+#include "content/public/browser/browser_context.h"
+
+// static
+AutomaticProfileResetter* AutomaticProfileResetterFactory::GetForBrowserContext(
+ content::BrowserContext* context) {
+ return static_cast<AutomaticProfileResetter*>(
+ GetInstance()->GetServiceForBrowserContext(context, true));
+}
+
+// static
+AutomaticProfileResetterFactory*
+AutomaticProfileResetterFactory::GetInstance() {
+ return Singleton<AutomaticProfileResetterFactory>::get();
+}
+
+// static
+void AutomaticProfileResetterFactory::RegisterPrefs(
+ PrefRegistrySimple* registry) {
+ registry->RegisterDictionaryPref(
+ prefs::kProfileResetPromptMementosInLocalState);
+}
+
+AutomaticProfileResetterFactory::AutomaticProfileResetterFactory()
+ : BrowserContextKeyedServiceFactory(
+ "AutomaticProfileResetter",
+ BrowserContextDependencyManager::GetInstance()) {
+ DependsOn(TemplateURLServiceFactory::GetInstance());
+ DependsOn(GlobalErrorServiceFactory::GetInstance());
+}
+
+AutomaticProfileResetterFactory::~AutomaticProfileResetterFactory() {}
+
+KeyedService* AutomaticProfileResetterFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ Profile* profile = Profile::FromBrowserContext(context);
+ AutomaticProfileResetter* service = new AutomaticProfileResetter(profile);
+ service->Initialize();
+ service->Activate();
+ return service;
+}
+
+void AutomaticProfileResetterFactory::RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
+ registry->RegisterStringPref(
+ prefs::kProfileResetPromptMementoInProfilePrefs,
+ "",
+ user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
+}
+
+bool AutomaticProfileResetterFactory::
+ ServiceIsCreatedWithBrowserContext() const {
+ return true;
+}
+
+bool AutomaticProfileResetterFactory::ServiceIsNULLWhileTesting() const {
+ return true;
+}

Powered by Google App Engine
This is Rietveld 408576698