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

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

Issue 1092873002: [Icons NTP] Refactor large_icon_source to extract the logic shared between desktop and Android to f… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/favicon/large_icon_service_factory.cc
diff --git a/chrome/browser/favicon/large_icon_service_factory.cc b/chrome/browser/favicon/large_icon_service_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..56890cb5ffbb65f7848f5eebc07c2c70dba34350
--- /dev/null
+++ b/chrome/browser/favicon/large_icon_service_factory.cc
@@ -0,0 +1,46 @@
+// 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/large_icon_service_factory.h"
+
+#include "base/memory/singleton.h"
+#include "chrome/browser/favicon/favicon_service_factory.h"
+#include "chrome/browser/profiles/profile.h"
+#include "components/favicon/core/favicon_service.h"
+#include "components/favicon/core/large_icon_service.h"
+#include "components/keyed_service/content/browser_context_dependency_manager.h"
+#include "content/public/browser/browser_context.h"
+
+// static
+favicon::LargeIconService* LargeIconServiceFactory::GetForBrowserContext(
+ content::BrowserContext* context) {
+ return static_cast<favicon::LargeIconService*>(
+ GetInstance()->GetServiceForBrowserContext(context, true));
+}
+
+// static
+LargeIconServiceFactory* LargeIconServiceFactory::GetInstance() {
+ return Singleton<LargeIconServiceFactory>::get();
+}
+
+LargeIconServiceFactory::LargeIconServiceFactory()
+ : BrowserContextKeyedServiceFactory(
+ "LargeIconService",
+ BrowserContextDependencyManager::GetInstance()) {
+ DependsOn(FaviconServiceFactory::GetInstance());
+}
+
+LargeIconServiceFactory::~LargeIconServiceFactory() {}
+
+KeyedService* LargeIconServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ favicon::FaviconService* favicon_service =
+ FaviconServiceFactory::GetForProfile(Profile::FromBrowserContext(context),
huangs 2015/04/20 19:50:25 Perhaps in favicon_service_factory.cc, add // sta
beaudoin 2015/04/21 00:15:38 Done.
pkotwicz 2015/04/21 20:13:28 Ping me if you want to discuss some more. I notice
beaudoin 2015/04/21 20:24:05 NP. I think this is better.
+ ServiceAccessType::EXPLICIT_ACCESS);
+ return new favicon::LargeIconService(favicon_service);
+}
+
+bool LargeIconServiceFactory::ServiceIsNULLWhileTesting() const {
+ return true;
+}

Powered by Google App Engine
This is Rietveld 408576698