| 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 16 matching lines...) Expand all Loading... |
| 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( | 31 bool TopSitesCache::GetPageThumbnail( |
| 32 const GURL& url, | 32 const GURL& url, |
| 33 scoped_refptr<base::RefCountedMemory>* bytes) { | 33 scoped_refptr<base::RefCountedMemory>* bytes) { |
| 34 std::map<GURL, Images>::const_iterator found = | 34 std::map<GURL, Images>::const_iterator found = |
| 35 images_.find(GetCanonicalURL(url)); | 35 images_.find(GetCanonicalURL(url)); |
| 36 if (found != images_.end()) { | 36 if (found != images_.end()) { |
| 37 base::RefCountedBytes* data = found->second.thumbnail.get(); | 37 base::RefCountedMemory* data = found->second.thumbnail.get(); |
| 38 if (data) { | 38 if (data) { |
| 39 *bytes = data; | 39 *bytes = data; |
| 40 return true; | 40 return true; |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 return false; | 43 return false; |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool TopSitesCache::GetPageThumbnailScore(const GURL& url, | 46 bool TopSitesCache::GetPageThumbnailScore(const GURL& url, |
| 47 ThumbnailScore* score) { | 47 ThumbnailScore* score) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 const GURL& url) { | 95 const GURL& url) { |
| 96 MostVisitedURL most_visited_url; | 96 MostVisitedURL most_visited_url; |
| 97 most_visited_url.redirects.push_back(url); | 97 most_visited_url.redirects.push_back(url); |
| 98 CanonicalURLEntry entry; | 98 CanonicalURLEntry entry; |
| 99 entry.first = &most_visited_url; | 99 entry.first = &most_visited_url; |
| 100 entry.second = 0u; | 100 entry.second = 0u; |
| 101 return canonical_urls_.find(entry); | 101 return canonical_urls_.find(entry); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace history | 104 } // namespace history |
| OLD | NEW |