OLD | NEW |
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 "ios/chrome/browser/favicon/ios_chrome_large_icon_cache_factory.h" | 5 #include "ios/chrome/browser/google/google_logo_service_factory.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "components/keyed_service/ios/browser_state_dependency_manager.h" | 9 #include "components/keyed_service/ios/browser_state_dependency_manager.h" |
10 #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" | 10 #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" |
11 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 11 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
12 #include "ios/chrome/browser/favicon/large_icon_cache.h" | 12 #include "ios/chrome/browser/google/google_logo_service.h" |
13 | 13 |
14 // static | 14 // static |
15 LargeIconCache* IOSChromeLargeIconCacheFactory::GetForBrowserState( | 15 GoogleLogoService* GoogleLogoServiceFactory::GetForBrowserState( |
16 ios::ChromeBrowserState* browser_state) { | 16 ios::ChromeBrowserState* browser_state) { |
17 return static_cast<LargeIconCache*>( | 17 return static_cast<GoogleLogoService*>( |
18 GetInstance()->GetServiceForBrowserState(browser_state, true)); | 18 GetInstance()->GetServiceForBrowserState(browser_state, true)); |
19 } | 19 } |
20 | 20 |
21 // static | 21 // static |
22 IOSChromeLargeIconCacheFactory* IOSChromeLargeIconCacheFactory::GetInstance() { | 22 GoogleLogoServiceFactory* GoogleLogoServiceFactory::GetInstance() { |
23 return base::Singleton<IOSChromeLargeIconCacheFactory>::get(); | 23 return base::Singleton<GoogleLogoServiceFactory>::get(); |
24 } | 24 } |
25 | 25 |
26 IOSChromeLargeIconCacheFactory::IOSChromeLargeIconCacheFactory() | 26 GoogleLogoServiceFactory::GoogleLogoServiceFactory() |
27 : BrowserStateKeyedServiceFactory( | 27 : BrowserStateKeyedServiceFactory( |
28 "LargeIconCache", | 28 "GoogleLogoService", |
29 BrowserStateDependencyManager::GetInstance()) {} | 29 BrowserStateDependencyManager::GetInstance()) {} |
30 | 30 |
31 IOSChromeLargeIconCacheFactory::~IOSChromeLargeIconCacheFactory() {} | 31 GoogleLogoServiceFactory::~GoogleLogoServiceFactory() {} |
32 | 32 |
33 std::unique_ptr<KeyedService> | 33 std::unique_ptr<KeyedService> GoogleLogoServiceFactory::BuildServiceInstanceFor( |
34 IOSChromeLargeIconCacheFactory::BuildServiceInstanceFor( | |
35 web::BrowserState* context) const { | 34 web::BrowserState* context) const { |
36 return base::WrapUnique(new LargeIconCache); | 35 ios::ChromeBrowserState* browser_state = |
| 36 ios::ChromeBrowserState::FromBrowserState(context); |
| 37 return base::MakeUnique<GoogleLogoService>(browser_state); |
37 } | 38 } |
38 | 39 |
39 web::BrowserState* IOSChromeLargeIconCacheFactory::GetBrowserStateToUse( | 40 web::BrowserState* GoogleLogoServiceFactory::GetBrowserStateToUse( |
40 web::BrowserState* context) const { | 41 web::BrowserState* context) const { |
41 return GetBrowserStateOwnInstanceInIncognito(context); | 42 return GetBrowserStateOwnInstanceInIncognito(context); |
42 } | 43 } |
OLD | NEW |