OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/history/top_sites_cache.h" | 5 #include "chrome/browser/history/top_sites_cache.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/ref_counted_memory.h" | 8 #include "base/ref_counted_memory.h" |
9 | 9 |
10 namespace history { | 10 namespace history { |
(...skipping 29 matching lines...) Expand all Loading... |
40 scoped_refptr<RefCountedBytes>* bytes) { | 40 scoped_refptr<RefCountedBytes>* bytes) { |
41 std::map<GURL, Images>::const_iterator found = | 41 std::map<GURL, Images>::const_iterator found = |
42 images_.find(GetCanonicalURL(url)); | 42 images_.find(GetCanonicalURL(url)); |
43 if (found != images_.end()) { | 43 if (found != images_.end()) { |
44 *bytes = found->second.thumbnail.get(); | 44 *bytes = found->second.thumbnail.get(); |
45 return true; | 45 return true; |
46 } | 46 } |
47 return false; | 47 return false; |
48 } | 48 } |
49 | 49 |
| 50 bool TopSitesCache::GetPageThumbnailScore(const GURL& url, |
| 51 ThumbnailScore* score) { |
| 52 std::map<GURL, Images>::const_iterator found = |
| 53 images_.find(GetCanonicalURL(url)); |
| 54 if (found != images_.end()) { |
| 55 *score = found->second.thumbnail_score; |
| 56 return true; |
| 57 } |
| 58 return false; |
| 59 } |
| 60 |
50 GURL TopSitesCache::GetCanonicalURL(const GURL& url) { | 61 GURL TopSitesCache::GetCanonicalURL(const GURL& url) { |
51 CanonicalURLs::iterator i = TopSitesCache::GetCanonicalURLsIterator(url); | 62 CanonicalURLs::iterator i = TopSitesCache::GetCanonicalURLsIterator(url); |
52 return i == canonical_urls_.end() ? url : i->first.first->url; | 63 return i == canonical_urls_.end() ? url : i->first.first->url; |
53 } | 64 } |
54 | 65 |
55 bool TopSitesCache::IsKnownURL(const GURL& url) { | 66 bool TopSitesCache::IsKnownURL(const GURL& url) { |
56 return GetCanonicalURLsIterator(url) != canonical_urls_.end(); | 67 return GetCanonicalURLsIterator(url) != canonical_urls_.end(); |
57 } | 68 } |
58 | 69 |
59 size_t TopSitesCache::GetURLIndex(const GURL& url) { | 70 size_t TopSitesCache::GetURLIndex(const GURL& url) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 const GURL& url) { | 112 const GURL& url) { |
102 MostVisitedURL most_visited_url; | 113 MostVisitedURL most_visited_url; |
103 most_visited_url.redirects.push_back(url); | 114 most_visited_url.redirects.push_back(url); |
104 CanonicalURLEntry entry; | 115 CanonicalURLEntry entry; |
105 entry.first = &most_visited_url; | 116 entry.first = &most_visited_url; |
106 entry.second = 0u; | 117 entry.second = 0u; |
107 return canonical_urls_.find(entry); | 118 return canonical_urls_.find(entry); |
108 } | 119 } |
109 | 120 |
110 } // namespace history | 121 } // namespace history |
OLD | NEW |