Chromium Code Reviews| Index: ios/chrome/browser/favicon/large_icon_cache_factory.mm |
| diff --git a/ios/chrome/browser/favicon/large_icon_cache_factory.mm b/ios/chrome/browser/favicon/large_icon_cache_factory.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9d8a1ec2c2c0fb78cd5f95e7befdc11527910a31 |
| --- /dev/null |
| +++ b/ios/chrome/browser/favicon/large_icon_cache_factory.mm |
| @@ -0,0 +1,40 @@ |
| +// 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 "ios/chrome/browser/favicon/large_icon_cache_factory.h" |
| + |
| +#include "base/memory/singleton.h" |
| +#include "components/keyed_service/ios/browser_state_dependency_manager.h" |
| +#include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" |
| +#include "ios/chrome/browser/favicon/large_icon_cache.h" |
| +#include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.h" |
| + |
| +// static |
| +LargeIconCache* LargeIconCacheFactory::GetForBrowserState( |
| + ios::ChromeBrowserState* browser_state) { |
| + return static_cast<LargeIconCache*>( |
| + GetInstance()->GetServiceForBrowserState(browser_state, true)); |
| +} |
| + |
| +// static |
| +LargeIconCacheFactory* LargeIconCacheFactory::GetInstance() { |
| + return base::Singleton<LargeIconCacheFactory>::get(); |
|
sdefresne
2015/10/30 09:27:19
Please put a call to this method in ios/chrome/bro
justincohen
2015/10/30 11:59:21
Done.
|
| +} |
| + |
| +LargeIconCacheFactory::LargeIconCacheFactory() |
| + : BrowserStateKeyedServiceFactory( |
| + "LargeIconCache", |
| + BrowserStateDependencyManager::GetInstance()) {} |
| + |
| +LargeIconCacheFactory::~LargeIconCacheFactory() {} |
| + |
| +scoped_ptr<KeyedService> LargeIconCacheFactory::BuildServiceInstanceFor( |
| + web::BrowserState* context) const { |
| + return make_scoped_ptr(new LargeIconCache()); |
|
sdefresne
2015/10/30 09:27:19
nit: return make_scoped_ptr(new LargeIconCache);
justincohen
2015/10/30 11:59:21
Done.
|
| +} |
| + |
| +web::BrowserState* LargeIconCacheFactory::GetBrowserStateToUse( |
| + web::BrowserState* context) const { |
| + return GetBrowserStateOwnInstanceInIncognito(context); |
| +} |