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

Unified Diff: chrome/browser/extensions/extension_app_icon_service_factory.cc

Issue 2819413003: Refactor extension app icon. (Closed)
Patch Set: Created 3 years, 8 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/extensions/extension_app_icon_service_factory.cc
diff --git a/chrome/browser/extensions/extension_app_icon_service_factory.cc b/chrome/browser/extensions/extension_app_icon_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e23cea891c0c75a9f7f2262f5334bf31fa2722f4
--- /dev/null
+++ b/chrome/browser/extensions/extension_app_icon_service_factory.cc
@@ -0,0 +1,44 @@
+// Copyright 2017 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/extensions/extension_app_icon_service_factory.h"
+
+#include "chrome/browser/extensions/extension_app_icon_service.h"
+#include "chrome/browser/profiles/incognito_helpers.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+
+namespace extensions {
+
+// static
+ExtensionAppIconService* ExtensionAppIconServiceFactory::GetForBrowserContext(
+ content::BrowserContext* context) {
+ return static_cast<ExtensionAppIconService*>(
+ GetInstance()->GetServiceForBrowserContext(context, true));
+}
+
+// static
+ExtensionAppIconServiceFactory* ExtensionAppIconServiceFactory::GetInstance() {
+ return base::Singleton<ExtensionAppIconServiceFactory>::get();
+}
+
+ExtensionAppIconServiceFactory::ExtensionAppIconServiceFactory()
+ : BrowserContextKeyedServiceFactory(
+ "ExtensionAppIconService",
+ BrowserContextDependencyManager::GetInstance()) {}
xiyuan 2017/04/18 20:43:01 DependsOn(ExtensionRegistryFactory::GetInstance())
khmel 2017/04/20 00:13:38 Thanks for catching this! actually I was seeking t
+
+ExtensionAppIconServiceFactory::~ExtensionAppIconServiceFactory() = default;
+
+KeyedService* ExtensionAppIconServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ return ExtensionAppIconService::Create(context);
+}
+
+content::BrowserContext* ExtensionAppIconServiceFactory::GetBrowserContextToUse(
+ content::BrowserContext* context) const {
+ // This matches the logic in ExtensionSyncServiceFactory, which uses the
+ // original browser context.
+ return chrome::GetBrowserContextRedirectedInIncognito(context);
+}
+
+} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698