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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 // Use 100 quality (highest quality) because we're very sensitive to | 71 // Use 100 quality (highest quality) because we're very sensitive to |
72 // artifacts for these small sized, highly detailed images. | 72 // artifacts for these small sized, highly detailed images. |
73 static const int kTopSitesImageQuality = 100; | 73 static const int kTopSitesImageQuality = 100; |
74 | 74 |
75 const TopSites::PrepopulatedPage kPrepopulatedPages[] = { | 75 const TopSites::PrepopulatedPage kPrepopulatedPages[] = { |
76 #if defined(OS_CHROMEOS) | 76 #if defined(OS_CHROMEOS) |
77 { IDS_CHROMEOS_WELCOME_URL, IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE, | 77 { IDS_CHROMEOS_WELCOME_URL, IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE, |
78 IDR_PRODUCT_LOGO_16, IDR_NEWTAB_CHROMEOS_WELCOME_PAGE_THUMBNAIL, | 78 IDR_PRODUCT_LOGO_16, IDR_NEWTAB_CHROMEOS_WELCOME_PAGE_THUMBNAIL, |
79 SkColorSetRGB(0, 147, 60) }, | 79 SkColorSetRGB(0, 147, 60) }, |
| 80 #elif defined(OS_ANDROID) |
| 81 { IDS_MOBILE_WELCOME_URL, IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE, |
| 82 IDR_PRODUCT_LOGO_16, IDR_NEWTAB_CHROME_WELCOME_PAGE_THUMBNAIL, |
| 83 SkColorSetRGB(0, 147, 60) } |
80 #else | 84 #else |
81 { IDS_CHROME_WELCOME_URL, IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE, | 85 { IDS_CHROME_WELCOME_URL, IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE, |
82 IDR_PRODUCT_LOGO_16, IDR_NEWTAB_CHROME_WELCOME_PAGE_THUMBNAIL, | 86 IDR_PRODUCT_LOGO_16, IDR_NEWTAB_CHROME_WELCOME_PAGE_THUMBNAIL, |
83 SkColorSetRGB(0, 147, 60) }, | 87 SkColorSetRGB(0, 147, 60) }, |
84 #endif | 88 #endif |
| 89 #if !defined(OS_ANDROID) |
85 { IDS_WEBSTORE_URL, IDS_EXTENSION_WEB_STORE_TITLE, | 90 { IDS_WEBSTORE_URL, IDS_EXTENSION_WEB_STORE_TITLE, |
86 IDR_WEBSTORE_ICON_16, IDR_NEWTAB_WEBSTORE_THUMBNAIL, | 91 IDR_WEBSTORE_ICON_16, IDR_NEWTAB_WEBSTORE_THUMBNAIL, |
87 SkColorSetRGB(63, 132, 197) } | 92 SkColorSetRGB(63, 132, 197) } |
| 93 #endif |
88 }; | 94 }; |
89 | 95 |
90 namespace { | 96 namespace { |
91 | 97 |
92 // HistoryDBTask used during migration of thumbnails from history to top sites. | 98 // HistoryDBTask used during migration of thumbnails from history to top sites. |
93 // When run on the history thread it collects the top sites and the | 99 // When run on the history thread it collects the top sites and the |
94 // corresponding thumbnails. When run back on the ui thread it calls into | 100 // corresponding thumbnails. When run back on the ui thread it calls into |
95 // TopSites::FinishHistoryMigration. | 101 // TopSites::FinishHistoryMigration. |
96 class LoadThumbnailsFromHistoryTask : public HistoryDBTask { | 102 class LoadThumbnailsFromHistoryTask : public HistoryDBTask { |
97 public: | 103 public: |
98 LoadThumbnailsFromHistoryTask(TopSites* top_sites, | 104 LoadThumbnailsFromHistoryTask(TopSites* top_sites, |
99 int result_count) | 105 int result_count) |
100 : top_sites_(top_sites), | 106 : top_sites_(top_sites), |
101 result_count_(result_count) { | 107 result_count_(result_count) { |
102 // l10n_util isn't thread safe, so cache for use on the db thread. | 108 // l10n_util isn't thread safe, so cache for use on the db thread. |
103 ignore_urls_.insert(l10n_util::GetStringUTF8(IDS_CHROME_WELCOME_URL)); | 109 ignore_urls_.insert(l10n_util::GetStringUTF8(IDS_CHROME_WELCOME_URL)); |
104 ignore_urls_.insert(l10n_util::GetStringUTF8(IDS_WEBSTORE_URL)); | 110 ignore_urls_.insert(l10n_util::GetStringUTF8(IDS_WEBSTORE_URL)); |
| 111 #if defined(OS_ANDROID) |
| 112 ignore_urls_.insert(l10n_util::GetStringUTF8(IDS_MOBILE_WELCOME_URL)); |
| 113 #endif |
105 } | 114 } |
106 | 115 |
107 virtual bool RunOnDBThread(history::HistoryBackend* backend, | 116 virtual bool RunOnDBThread(history::HistoryBackend* backend, |
108 history::HistoryDatabase* db) { | 117 history::HistoryDatabase* db) { |
109 // Get the most visited urls. | 118 // Get the most visited urls. |
110 backend->QueryMostVisitedURLsImpl(result_count_, | 119 backend->QueryMostVisitedURLsImpl(result_count_, |
111 kDaysOfHistory, | 120 kDaysOfHistory, |
112 &data_.most_visited); | 121 &data_.most_visited); |
113 | 122 |
114 // And fetch the thumbnails. | 123 // And fetch the thumbnails. |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 SetTopSites(pages); | 947 SetTopSites(pages); |
939 | 948 |
940 // Used only in testing. | 949 // Used only in testing. |
941 content::NotificationService::current()->Notify( | 950 content::NotificationService::current()->Notify( |
942 chrome::NOTIFICATION_TOP_SITES_UPDATED, | 951 chrome::NOTIFICATION_TOP_SITES_UPDATED, |
943 content::Source<TopSites>(this), | 952 content::Source<TopSites>(this), |
944 content::Details<CancelableRequestProvider::Handle>(&handle)); | 953 content::Details<CancelableRequestProvider::Handle>(&handle)); |
945 } | 954 } |
946 | 955 |
947 } // namespace history | 956 } // namespace history |
OLD | NEW |