| 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 #ifndef IOS_CHROME_BROWSER_FAVICON_LARGE_ICON_CACHE_H_ | 5 #ifndef IOS_CHROME_BROWSER_FAVICON_LARGE_ICON_CACHE_H_ |
| 6 #define IOS_CHROME_BROWSER_FAVICON_LARGE_ICON_CACHE_H_ | 6 #define IOS_CHROME_BROWSER_FAVICON_LARGE_ICON_CACHE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/containers/mru_cache.h" | 10 #include "base/containers/mru_cache.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "components/keyed_service/core/keyed_service.h" | 12 #include "components/keyed_service/core/keyed_service.h" |
| 13 | 13 |
| 14 class GURL; | 14 class GURL; |
| 15 struct LargeIconCacheEntry; | 15 struct LargeIconCacheEntry; |
| 16 | 16 |
| 17 namespace favicon_base { | 17 namespace favicon_base { |
| 18 struct LargeIconResult; | 18 struct LargeIconResult; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace ios { | |
| 22 class ChromeBrowserState; | |
| 23 } | |
| 24 | |
| 25 // Provides a cache of most recently used LargeIconResult. | 21 // Provides a cache of most recently used LargeIconResult. |
| 26 // | 22 // |
| 27 // Example usage: | 23 // Example usage: |
| 28 // LargeIconCache* large_icon_cache = | 24 // LargeIconCache* large_icon_cache = |
| 29 // IOSChromeLargeIconServiceFactory::GetForBrowserState(browser_state); | 25 // IOSChromeLargeIconServiceFactory::GetForBrowserState(browser_state); |
| 30 // std::unique_ptr<favicon_base::LargeIconResult> icon = | 26 // std::unique_ptr<favicon_base::LargeIconResult> icon = |
| 31 // large_icon_cache->GetCachedResult(...); | 27 // large_icon_cache->GetCachedResult(...); |
| 32 // | 28 // |
| 33 class LargeIconCache : public KeyedService { | 29 class LargeIconCache : public KeyedService { |
| 34 public: | 30 public: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 48 // Clones a LargeIconResult. | 44 // Clones a LargeIconResult. |
| 49 std::unique_ptr<favicon_base::LargeIconResult> CloneLargeIconResult( | 45 std::unique_ptr<favicon_base::LargeIconResult> CloneLargeIconResult( |
| 50 const favicon_base::LargeIconResult& large_icon_result); | 46 const favicon_base::LargeIconResult& large_icon_result); |
| 51 | 47 |
| 52 base::MRUCache<GURL, std::unique_ptr<LargeIconCacheEntry>> cache_; | 48 base::MRUCache<GURL, std::unique_ptr<LargeIconCacheEntry>> cache_; |
| 53 | 49 |
| 54 DISALLOW_COPY_AND_ASSIGN(LargeIconCache); | 50 DISALLOW_COPY_AND_ASSIGN(LargeIconCache); |
| 55 }; | 51 }; |
| 56 | 52 |
| 57 #endif // IOS_CHROME_BROWSER_FAVICON_LARGE_ICON_CACHE_H_ | 53 #endif // IOS_CHROME_BROWSER_FAVICON_LARGE_ICON_CACHE_H_ |
| OLD | NEW |