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

Unified Diff: ios/chrome/browser/favicon/ios_chrome_large_icon_cache_factory.cc

Issue 1413903008: Add LargeIconCache and LargeIconServiceFactory for iOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits for unit test Created 5 years, 2 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: ios/chrome/browser/favicon/ios_chrome_large_icon_cache_factory.cc
diff --git a/ios/chrome/browser/favicon/ios_chrome_large_icon_cache_factory.cc b/ios/chrome/browser/favicon/ios_chrome_large_icon_cache_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b640f0df5b0ebaf8f72a4c3f8771fc96b410779f
--- /dev/null
+++ b/ios/chrome/browser/favicon/ios_chrome_large_icon_cache_factory.cc
@@ -0,0 +1,41 @@
+// 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/ios_chrome_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* IOSChromeLargeIconCacheFactory::GetForBrowserState(
+ ios::ChromeBrowserState* browser_state) {
+ return static_cast<LargeIconCache*>(
+ GetInstance()->GetServiceForBrowserState(browser_state, true));
+}
+
+// static
+IOSChromeLargeIconCacheFactory* IOSChromeLargeIconCacheFactory::GetInstance() {
+ return base::Singleton<IOSChromeLargeIconCacheFactory>::get();
+}
+
+IOSChromeLargeIconCacheFactory::IOSChromeLargeIconCacheFactory()
+ : BrowserStateKeyedServiceFactory(
+ "LargeIconCache",
+ BrowserStateDependencyManager::GetInstance()) {}
+
+IOSChromeLargeIconCacheFactory::~IOSChromeLargeIconCacheFactory() {}
+
+scoped_ptr<KeyedService>
+IOSChromeLargeIconCacheFactory::BuildServiceInstanceFor(
+ web::BrowserState* context) const {
+ return make_scoped_ptr(new LargeIconCache);
+}
+
+web::BrowserState* IOSChromeLargeIconCacheFactory::GetBrowserStateToUse(
+ web::BrowserState* context) const {
+ return GetBrowserStateOwnInstanceInIncognito(context);
+}

Powered by Google App Engine
This is Rietveld 408576698