OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/browser/history/top_sites.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 return thread_safe_cache_->GetPageThumbnail(url, bytes); | 250 return thread_safe_cache_->GetPageThumbnail(url, bytes); |
251 } | 251 } |
252 | 252 |
253 bool TopSites::GetPageThumbnailScore(const GURL& url, | 253 bool TopSites::GetPageThumbnailScore(const GURL& url, |
254 ThumbnailScore* score) { | 254 ThumbnailScore* score) { |
255 // WARNING: this may be invoked on any thread. | 255 // WARNING: this may be invoked on any thread. |
256 base::AutoLock lock(lock_); | 256 base::AutoLock lock(lock_); |
257 return thread_safe_cache_->GetPageThumbnailScore(url, score); | 257 return thread_safe_cache_->GetPageThumbnailScore(url, score); |
258 } | 258 } |
259 | 259 |
| 260 bool TopSites::GetTemporaryPageThumbnailScore(const GURL& url, |
| 261 ThumbnailScore* score) { |
| 262 for (TempImages::iterator i = temp_images_.begin(); i != temp_images_.end(); |
| 263 ++i) { |
| 264 if (i->first == url) { |
| 265 *score = i->second.thumbnail_score; |
| 266 return true; |
| 267 } |
| 268 } |
| 269 return false; |
| 270 } |
| 271 |
| 272 |
260 // Returns the index of |url| in |urls|, or -1 if not found. | 273 // Returns the index of |url| in |urls|, or -1 if not found. |
261 static int IndexOf(const MostVisitedURLList& urls, const GURL& url) { | 274 static int IndexOf(const MostVisitedURLList& urls, const GURL& url) { |
262 for (size_t i = 0; i < urls.size(); i++) { | 275 for (size_t i = 0; i < urls.size(); i++) { |
263 if (urls[i].url == url) | 276 if (urls[i].url == url) |
264 return i; | 277 return i; |
265 } | 278 } |
266 return -1; | 279 return -1; |
267 } | 280 } |
268 | 281 |
269 void TopSites::MigrateFromHistory() { | 282 void TopSites::MigrateFromHistory() { |
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 SetTopSites(pages); | 976 SetTopSites(pages); |
964 | 977 |
965 // Used only in testing. | 978 // Used only in testing. |
966 NotificationService::current()->Notify( | 979 NotificationService::current()->Notify( |
967 NotificationType::TOP_SITES_UPDATED, | 980 NotificationType::TOP_SITES_UPDATED, |
968 Source<TopSites>(this), | 981 Source<TopSites>(this), |
969 Details<CancelableRequestProvider::Handle>(&handle)); | 982 Details<CancelableRequestProvider::Handle>(&handle)); |
970 } | 983 } |
971 | 984 |
972 } // namespace history | 985 } // namespace history |
OLD | NEW |