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

Unified Diff: chrome/browser/favicon/chrome_fallback_icon_client_factory.cc

Issue 996253002: [Fallback Icons] Refactor FallbackIconService to be a BrowserContext-level singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync and merge. Created 5 years, 9 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/favicon/chrome_fallback_icon_client_factory.cc
diff --git a/chrome/browser/favicon/chrome_fallback_icon_client_factory.cc b/chrome/browser/favicon/chrome_fallback_icon_client_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cf06ed10f48b2009adbf253e2d90c7b8f93a6f41
--- /dev/null
+++ b/chrome/browser/favicon/chrome_fallback_icon_client_factory.cc
@@ -0,0 +1,45 @@
+// Copyright 2015 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/favicon/chrome_fallback_icon_client_factory.h"
+
+#include "base/memory/singleton.h"
+#include "chrome/browser/favicon/chrome_fallback_icon_client.h"
+#include "chrome/browser/profiles/incognito_helpers.h"
+#include "chrome/browser/profiles/profile.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+
+ChromeFallbackIconClientFactory::ChromeFallbackIconClientFactory()
+ : BrowserContextKeyedServiceFactory(
+ "ChromeFallbackIconClient",
+ BrowserContextDependencyManager::GetInstance()) {
beaudoin 2015/03/26 12:53:55 Indentation should be 8 I believe.
huangs 2015/03/26 18:26:06 Done.
+}
+
+ChromeFallbackIconClientFactory::~ChromeFallbackIconClientFactory() {
+}
+
+// static
+FallbackIconClient* ChromeFallbackIconClientFactory::GetForProfile(
+ Profile* profile) {
+ return static_cast<FallbackIconClient*>(
+ GetInstance()->GetServiceForBrowserContext(profile, true));
+}
+
+// static
+ChromeFallbackIconClientFactory*
+ChromeFallbackIconClientFactory::GetInstance() {
+ return Singleton<ChromeFallbackIconClientFactory>::get();
+}
+
+KeyedService* ChromeFallbackIconClientFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ ChromeFallbackIconClient* client = new ChromeFallbackIconClient();
+ return client;
+}
+
+content::BrowserContext*
+ChromeFallbackIconClientFactory::GetBrowserContextToUse(
+ content::BrowserContext* context) const {
+ return chrome::GetBrowserContextRedirectedInIncognito(context);
+}

Powered by Google App Engine
This is Rietveld 408576698