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

Unified Diff: chrome/browser/ui/app_list/app_list_prefs_factory.cc

Issue 599343002: Mirror app list hierarchy data in profile prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@app_list_folder_pref
Patch Set: add unit test Created 6 years, 2 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/ui/app_list/app_list_prefs_factory.cc
diff --git a/chrome/browser/ui/app_list/app_list_prefs_factory.cc b/chrome/browser/ui/app_list/app_list_prefs_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..80d8801a072a50273b8f5ef2eb78118a8dce804e
--- /dev/null
+++ b/chrome/browser/ui/app_list/app_list_prefs_factory.cc
@@ -0,0 +1,54 @@
+// Copyright 2014 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/ui/app_list/app_list_prefs_factory.h"
+
+#include "base/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/app_list/app_list_prefs.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "content/public/browser/browser_context.h"
+#include "extensions/browser/extensions_browser_client.h"
+
+namespace app_list {
+
+// static
+AppListPrefs* AppListPrefsFactory::GetForBrowserContext(
+ content::BrowserContext* context) {
+ return static_cast<AppListPrefs*>(
+ GetInstance()->GetServiceForBrowserContext(context, true));
+}
+
+// static
+AppListPrefsFactory* AppListPrefsFactory::GetInstance() {
+ return Singleton<AppListPrefsFactory>::get();
+}
+
+void AppListPrefsFactory::SetInstanceForTesting(
+ content::BrowserContext* context,
+ AppListPrefs* prefs) {
+ Associate(context, prefs);
+}
+
+AppListPrefsFactory::AppListPrefsFactory()
+ : BrowserContextKeyedServiceFactory(
+ "AppListPrefs",
+ BrowserContextDependencyManager::GetInstance()) {
+}
+
+AppListPrefsFactory::~AppListPrefsFactory() {
+}
+
+KeyedService* AppListPrefsFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ return AppListPrefs::Create(Profile::FromBrowserContext(context)->GetPrefs());
+}
+
+content::BrowserContext* AppListPrefsFactory::GetBrowserContextToUse(
+ content::BrowserContext* context) const {
+ return extensions::ExtensionsBrowserClient::Get()->GetOriginalContext(
+ context);
+}
+
+} // namespace app_list
« no previous file with comments | « chrome/browser/ui/app_list/app_list_prefs_factory.h ('k') | chrome/browser/ui/app_list/app_list_syncable_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698