OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/thumbnail_store.h" | 5 #include "chrome/browser/thumbnail_store.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 | 9 |
10 #include "app/gfx/codec/jpeg_codec.h" | 10 #include "app/gfx/codec/jpeg_codec.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 void ThumbnailStore::NotifyThumbnailStoreReady() { | 211 void ThumbnailStore::NotifyThumbnailStoreReady() { |
212 NotificationService::current()->Notify( | 212 NotificationService::current()->Notify( |
213 NotificationType::THUMBNAIL_STORE_READY, | 213 NotificationType::THUMBNAIL_STORE_READY, |
214 Source<ThumbnailStore>(this), | 214 Source<ThumbnailStore>(this), |
215 NotificationService::NoDetails()); | 215 NotificationService::NoDetails()); |
216 } | 216 } |
217 | 217 |
218 void ThumbnailStore::UpdateURLData() { | 218 void ThumbnailStore::UpdateURLData() { |
219 DCHECK(url_blacklist_); | 219 DCHECK(url_blacklist_); |
220 | 220 |
221 int result_count = ThumbnailStore::kMaxCacheSize + url_blacklist_->GetSize(); | 221 int result_count = ThumbnailStore::kMaxCacheSize + url_blacklist_->size(); |
222 hs_->QueryTopURLsAndRedirects(result_count, &consumer_, | 222 hs_->QueryTopURLsAndRedirects(result_count, &consumer_, |
223 NewCallback(this, &ThumbnailStore::OnURLDataAvailable)); | 223 NewCallback(this, &ThumbnailStore::OnURLDataAvailable)); |
224 } | 224 } |
225 | 225 |
226 void ThumbnailStore::OnURLDataAvailable(HistoryService::Handle handle, | 226 void ThumbnailStore::OnURLDataAvailable(HistoryService::Handle handle, |
227 bool success, | 227 bool success, |
228 std::vector<GURL>* urls, | 228 std::vector<GURL>* urls, |
229 history::RedirectMap* redirects) { | 229 history::RedirectMap* redirects) { |
230 if (!success) | 230 if (!success) |
231 return; | 231 return; |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 425 |
426 std::wstring ThumbnailStore::GetDictionaryKeyForURL( | 426 std::wstring ThumbnailStore::GetDictionaryKeyForURL( |
427 const std::string& url) const { | 427 const std::string& url) const { |
428 return ASCIIToWide(MD5String(url)); | 428 return ASCIIToWide(MD5String(url)); |
429 } | 429 } |
430 | 430 |
431 bool ThumbnailStore::IsPopular(const GURL& url) const { | 431 bool ThumbnailStore::IsPopular(const GURL& url) const { |
432 return most_visited_urls_->size() < kMaxCacheSize || | 432 return most_visited_urls_->size() < kMaxCacheSize || |
433 most_visited_urls_->find(url) != most_visited_urls_->end(); | 433 most_visited_urls_->find(url) != most_visited_urls_->end(); |
434 } | 434 } |
OLD | NEW |