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.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/bind.h" | 10 #include "base/bind.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "content/public/browser/navigation_controller.h" | 32 #include "content/public/browser/navigation_controller.h" |
33 #include "content/public/browser/navigation_details.h" | 33 #include "content/public/browser/navigation_details.h" |
34 #include "content/public/browser/navigation_entry.h" | 34 #include "content/public/browser/navigation_entry.h" |
35 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
36 #include "content/public/browser/web_contents.h" | 36 #include "content/public/browser/web_contents.h" |
37 #include "grit/chromium_strings.h" | 37 #include "grit/chromium_strings.h" |
38 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
39 #include "grit/locale_settings.h" | 39 #include "grit/locale_settings.h" |
40 #include "grit/theme_resources.h" | 40 #include "grit/theme_resources.h" |
41 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
| 42 #include "ui/base/layout.h" |
42 #include "ui/base/resource/resource_bundle.h" | 43 #include "ui/base/resource/resource_bundle.h" |
43 #include "ui/gfx/image/image_util.h" | 44 #include "ui/gfx/image/image_util.h" |
44 | 45 |
45 using base::DictionaryValue; | 46 using base::DictionaryValue; |
46 using content::BrowserThread; | 47 using content::BrowserThread; |
47 using content::NavigationController; | 48 using content::NavigationController; |
48 | 49 |
49 namespace history { | 50 namespace history { |
50 | 51 |
51 // How many top sites to store in the cache. | 52 // How many top sites to store in the cache. |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 { | 248 { |
248 base::AutoLock lock(lock_); | 249 base::AutoLock lock(lock_); |
249 if (thread_safe_cache_->GetPageThumbnail(url, bytes)) | 250 if (thread_safe_cache_->GetPageThumbnail(url, bytes)) |
250 return true; | 251 return true; |
251 } | 252 } |
252 | 253 |
253 // Resource bundle is thread safe. | 254 // Resource bundle is thread safe. |
254 for (size_t i = 0; i < arraysize(kPrepopulatedPages); i++) { | 255 for (size_t i = 0; i < arraysize(kPrepopulatedPages); i++) { |
255 if (url.spec() == l10n_util::GetStringUTF8(kPrepopulatedPages[i].url_id)) { | 256 if (url.spec() == l10n_util::GetStringUTF8(kPrepopulatedPages[i].url_id)) { |
256 *bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes( | 257 *bytes = ResourceBundle::GetSharedInstance().LoadDataResourceBytes( |
257 kPrepopulatedPages[i].thumbnail_id); | 258 kPrepopulatedPages[i].thumbnail_id, |
| 259 ui::SCALE_FACTOR_100P); |
258 return true; | 260 return true; |
259 } | 261 } |
260 } | 262 } |
261 | 263 |
262 return false; | 264 return false; |
263 } | 265 } |
264 | 266 |
265 bool TopSites::GetPageThumbnailScore(const GURL& url, | 267 bool TopSites::GetPageThumbnailScore(const GURL& url, |
266 ThumbnailScore* score) { | 268 ThumbnailScore* score) { |
267 // WARNING: this may be invoked on any thread. | 269 // WARNING: this may be invoked on any thread. |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 SetTopSites(pages); | 898 SetTopSites(pages); |
897 | 899 |
898 // Used only in testing. | 900 // Used only in testing. |
899 content::NotificationService::current()->Notify( | 901 content::NotificationService::current()->Notify( |
900 chrome::NOTIFICATION_TOP_SITES_UPDATED, | 902 chrome::NOTIFICATION_TOP_SITES_UPDATED, |
901 content::Source<TopSites>(this), | 903 content::Source<TopSites>(this), |
902 content::Details<CancelableRequestProvider::Handle>(&handle)); | 904 content::Details<CancelableRequestProvider::Handle>(&handle)); |
903 } | 905 } |
904 | 906 |
905 } // namespace history | 907 } // namespace history |
OLD | NEW |