Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: chrome/browser/history/top_sites.cc

Issue 7529051: ntp: use web store as default mv tile instead of themes gallery (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated thumbnail Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/app/theme/theme_resources.grd ('k') | chrome/browser/resources/ntp4/tile_page.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 static const size_t kTopSitesShown = 8; 48 static const size_t kTopSitesShown = 8;
49 static const int kDaysOfHistory = 90; 49 static const int kDaysOfHistory = 90;
50 // Time from startup to first HistoryService query. 50 // Time from startup to first HistoryService query.
51 static const int64 kUpdateIntervalSecs = 15; 51 static const int64 kUpdateIntervalSecs = 15;
52 // Intervals between requests to HistoryService. 52 // Intervals between requests to HistoryService.
53 static const int64 kMinUpdateIntervalMinutes = 1; 53 static const int64 kMinUpdateIntervalMinutes = 1;
54 static const int64 kMaxUpdateIntervalMinutes = 60; 54 static const int64 kMaxUpdateIntervalMinutes = 60;
55 55
56 // IDs of the sites we force into top sites. 56 // IDs of the sites we force into top sites.
57 static const int kPrepopulatePageIDs[] = 57 static const int kPrepopulatePageIDs[] =
58 { IDS_CHROME_WELCOME_URL, IDS_THEMES_GALLERY_URL }; 58 { IDS_CHROME_WELCOME_URL, IDS_WEBSTORE_URL };
59 59
60 // Favicons of the sites we force into top sites. 60 // Favicons of the sites we force into top sites.
61 static const char kPrepopulateFaviconURLs[][100] = 61 static const char kPrepopulateFaviconURLs[][100] =
62 { "chrome://theme/IDR_PRODUCT_LOGO_16", 62 { "chrome://theme/IDR_PRODUCT_LOGO_16",
63 "chrome://theme/IDR_WEBSTORE_ICON_16" }; 63 "chrome://theme/IDR_WEBSTORE_ICON_16" };
64 // Same as above, but for NTP4. TODO(estade): remove the above. 64 // Same as above, but for NTP4. TODO(estade): remove the above.
65 static const char kNewPrepopulateFaviconURLs[][100] = 65 static const char kNewPrepopulateFaviconURLs[][100] =
66 { "chrome://theme/IDR_PRODUCT_LOGO_32", 66 { "chrome://theme/IDR_PRODUCT_LOGO_32",
67 "chrome://theme/IDR_WEBSTORE_ICON_32" }; 67 "chrome://theme/IDR_WEBSTORE_ICON_32" };
68 68
69 static const int kPrepopulateTitleIDs[] = 69 static const int kPrepopulateTitleIDs[] =
70 { IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE, 70 { IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE,
71 IDS_NEW_TAB_THEMES_GALLERY_PAGE_TITLE }; 71 IDS_NEW_TAB_WEBSTORE_PAGE_TITLE };
72 72
73 namespace { 73 namespace {
74 74
75 // HistoryDBTask used during migration of thumbnails from history to top sites. 75 // HistoryDBTask used during migration of thumbnails from history to top sites.
76 // When run on the history thread it collects the top sites and the 76 // When run on the history thread it collects the top sites and the
77 // corresponding thumbnails. When run back on the ui thread it calls into 77 // corresponding thumbnails. When run back on the ui thread it calls into
78 // TopSites::FinishHistoryMigration. 78 // TopSites::FinishHistoryMigration.
79 class LoadThumbnailsFromHistoryTask : public HistoryDBTask { 79 class LoadThumbnailsFromHistoryTask : public HistoryDBTask {
80 public: 80 public:
81 LoadThumbnailsFromHistoryTask(TopSites* top_sites, 81 LoadThumbnailsFromHistoryTask(TopSites* top_sites,
82 int result_count) 82 int result_count)
83 : top_sites_(top_sites), 83 : top_sites_(top_sites),
84 result_count_(result_count) { 84 result_count_(result_count) {
85 // l10n_util isn't thread safe, so cache for use on the db thread. 85 // l10n_util isn't thread safe, so cache for use on the db thread.
86 ignore_urls_.insert(l10n_util::GetStringUTF8(IDS_CHROME_WELCOME_URL)); 86 ignore_urls_.insert(l10n_util::GetStringUTF8(IDS_CHROME_WELCOME_URL));
87 ignore_urls_.insert(l10n_util::GetStringUTF8(IDS_THEMES_GALLERY_URL)); 87 ignore_urls_.insert(l10n_util::GetStringUTF8(IDS_WEBSTORE_URL));
88 } 88 }
89 89
90 virtual bool RunOnDBThread(history::HistoryBackend* backend, 90 virtual bool RunOnDBThread(history::HistoryBackend* backend,
91 history::HistoryDatabase* db) { 91 history::HistoryDatabase* db) {
92 // Get the most visited urls. 92 // Get the most visited urls.
93 backend->QueryMostVisitedURLsImpl(result_count_, 93 backend->QueryMostVisitedURLsImpl(result_count_,
94 kDaysOfHistory, 94 kDaysOfHistory,
95 &data_.most_visited); 95 &data_.most_visited);
96 96
97 // And fetch the thumbnails. 97 // And fetch the thumbnails.
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 SetTopSites(pages); 1008 SetTopSites(pages);
1009 1009
1010 // Used only in testing. 1010 // Used only in testing.
1011 NotificationService::current()->Notify( 1011 NotificationService::current()->Notify(
1012 chrome::NOTIFICATION_TOP_SITES_UPDATED, 1012 chrome::NOTIFICATION_TOP_SITES_UPDATED,
1013 Source<TopSites>(this), 1013 Source<TopSites>(this),
1014 Details<CancelableRequestProvider::Handle>(&handle)); 1014 Details<CancelableRequestProvider::Handle>(&handle));
1015 } 1015 }
1016 1016
1017 } // namespace history 1017 } // namespace history
OLDNEW
« no previous file with comments | « chrome/app/theme/theme_resources.grd ('k') | chrome/browser/resources/ntp4/tile_page.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698