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

Side by Side Diff: chrome/browser/favicon/fallback_icon_service_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: Comment fix; removing usage of Profile in factories. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/enhanced_bookmarks/android/bookmark_image_service_andro id.h" 5 #include "chrome/browser/favicon/fallback_icon_service_factory.h"
6 #include "chrome/browser/enhanced_bookmarks/android/bookmark_image_service_facto ry.h" 6
7 #include "base/memory/singleton.h"
8 #include "chrome/browser/favicon/chrome_fallback_icon_client_factory.h"
9 #include "components/favicon/core/fallback_icon_service.h"
7 #include "components/keyed_service/content/browser_context_dependency_manager.h" 10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
8 #include "content/public/browser/browser_context.h" 11 #include "content/public/browser/browser_context.h"
9 12
10 namespace enhanced_bookmarks {
11
12 // static 13 // static
13 BookmarkImageServiceFactory* BookmarkImageServiceFactory::GetInstance() { 14 FallbackIconService* FallbackIconServiceFactory::GetForBrowserContext(
14 return Singleton<BookmarkImageServiceFactory>::get(); 15 content::BrowserContext* context) {
16 return static_cast<FallbackIconService*>(
17 GetInstance()->GetServiceForBrowserContext(context, true));
15 } 18 }
16 19
17 // static 20 // static
18 BookmarkImageService* BookmarkImageServiceFactory::GetForBrowserContext( 21 FallbackIconServiceFactory* FallbackIconServiceFactory::GetInstance() {
19 content::BrowserContext* context) { 22 return Singleton<FallbackIconServiceFactory>::get();
20 return static_cast<BookmarkImageService*>(
21 GetInstance()->GetServiceForBrowserContext(context, true));
22 } 23 }
23 24
24 BookmarkImageServiceFactory::BookmarkImageServiceFactory() 25 FallbackIconServiceFactory::FallbackIconServiceFactory()
25 : BrowserContextKeyedServiceFactory( 26 : BrowserContextKeyedServiceFactory(
26 "BookmarkExtendedStorageService", 27 "FallbackIconService",
27 BrowserContextDependencyManager::GetInstance()) {} 28 BrowserContextDependencyManager::GetInstance()) {
28 29 DependsOn(ChromeFallbackIconClientFactory::GetInstance());
29 BookmarkImageServiceFactory::~BookmarkImageServiceFactory() {}
30
31 content::BrowserContext* BookmarkImageServiceFactory::GetBrowserContextToUse(
32 content::BrowserContext* context) const {
33 return context;
34 } 30 }
35 31
36 BookmarkImageService* BookmarkImageServiceFactory::BuildServiceInstanceFor( 32 FallbackIconServiceFactory::~FallbackIconServiceFactory() {}
37 content::BrowserContext* browser_context) const { 33
38 return new BookmarkImageServiceAndroid(browser_context); 34 KeyedService* FallbackIconServiceFactory::BuildServiceInstanceFor(
35 content::BrowserContext* context) const {
36 FallbackIconClient* fallback_icon_client =
37 ChromeFallbackIconClientFactory::GetForBrowserContext(context);
38 return new FallbackIconService(fallback_icon_client);
39 } 39 }
40 40
41 } // namespace enhanced_bookmarks 41 bool FallbackIconServiceFactory::ServiceIsNULLWhileTesting() const {
42 return true;
43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698