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

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

Issue 301613004: Turn FaviconClient into a Keyed service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: touching wood Created 6 years, 6 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
« no previous file with comments | « chrome/browser/favicon/chrome_favicon_client_factory.h ('k') | chrome/browser/favicon/favicon_tab_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/favicon/chrome_favicon_client_factory.cc
diff --git a/chrome/browser/favicon/chrome_favicon_client_factory.cc b/chrome/browser/favicon/chrome_favicon_client_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6cb370062aa5a15d6ce117402ebb12235eb3d2a3
--- /dev/null
+++ b/chrome/browser/favicon/chrome_favicon_client_factory.cc
@@ -0,0 +1,44 @@
+// 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/favicon/chrome_favicon_client_factory.h"
+
+#include "chrome/browser/profiles/profile.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+
+ChromeFaviconClientFactory::ChromeFaviconClientFactory()
+ : BrowserContextKeyedServiceFactory(
+ "ChromeFaviconClient",
+ BrowserContextDependencyManager::GetInstance()) {
+}
+
+ChromeFaviconClientFactory::~ChromeFaviconClientFactory() {
+}
+
+// static
+FaviconClient* ChromeFaviconClientFactory::GetForProfile(Profile* profile) {
+ if (!profile->IsOffTheRecord()) {
+ return static_cast<FaviconClient*>(
+ GetInstance()->GetServiceForBrowserContext(profile, true));
+ }
+ // Profile must be OffTheRecord in this case.
+ return static_cast<FaviconClient*>(GetInstance()->GetServiceForBrowserContext(
+ profile->GetOriginalProfile(), true));
+}
+
+// static
+ChromeFaviconClientFactory* ChromeFaviconClientFactory::GetInstance() {
+ return Singleton<ChromeFaviconClientFactory>::get();
+}
+
+KeyedService* ChromeFaviconClientFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ ChromeFaviconClient* client =
+ new ChromeFaviconClient(Profile::FromBrowserContext(context));
+ return client;
+}
+
+bool ChromeFaviconClientFactory::ServiceIsNULLWhileTesting() const {
+ return true;
+}
« no previous file with comments | « chrome/browser/favicon/chrome_favicon_client_factory.h ('k') | chrome/browser/favicon/favicon_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698