OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
9 | 9 |
10 namespace history { | 10 namespace history { |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 void TopSitesCache::SetThumbnails(const URLToImagesMap& images) { | 23 void TopSitesCache::SetThumbnails(const URLToImagesMap& images) { |
24 images_ = images; | 24 images_ = images; |
25 } | 25 } |
26 | 26 |
27 Images* TopSitesCache::GetImage(const GURL& url) { | 27 Images* TopSitesCache::GetImage(const GURL& url) { |
28 return &images_[GetCanonicalURL(url)]; | 28 return &images_[GetCanonicalURL(url)]; |
29 } | 29 } |
30 | 30 |
31 bool TopSitesCache::GetPageThumbnail(const GURL& url, | 31 bool TopSitesCache::GetPageThumbnail( |
32 scoped_refptr<RefCountedMemory>* bytes) { | 32 const GURL& url, |
| 33 scoped_refptr<base::RefCountedMemory>* bytes) { |
33 std::map<GURL, Images>::const_iterator found = | 34 std::map<GURL, Images>::const_iterator found = |
34 images_.find(GetCanonicalURL(url)); | 35 images_.find(GetCanonicalURL(url)); |
35 if (found != images_.end()) { | 36 if (found != images_.end()) { |
36 base::RefCountedBytes* data = found->second.thumbnail.get(); | 37 base::RefCountedBytes* data = found->second.thumbnail.get(); |
37 if (data) { | 38 if (data) { |
38 *bytes = data; | 39 *bytes = data; |
39 return true; | 40 return true; |
40 } | 41 } |
41 } | 42 } |
42 return false; | 43 return false; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 const GURL& url) { | 95 const GURL& url) { |
95 MostVisitedURL most_visited_url; | 96 MostVisitedURL most_visited_url; |
96 most_visited_url.redirects.push_back(url); | 97 most_visited_url.redirects.push_back(url); |
97 CanonicalURLEntry entry; | 98 CanonicalURLEntry entry; |
98 entry.first = &most_visited_url; | 99 entry.first = &most_visited_url; |
99 entry.second = 0u; | 100 entry.second = 0u; |
100 return canonical_urls_.find(entry); | 101 return canonical_urls_.find(entry); |
101 } | 102 } |
102 | 103 |
103 } // namespace history | 104 } // namespace history |
OLD | NEW |