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

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

Issue 8036002: ntp: remove ntp3 resources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 3 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
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/logging.h" 10 #include "base/logging.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 static const int64 kMaxUpdateIntervalMinutes = 60; 53 static const int64 kMaxUpdateIntervalMinutes = 60;
54 54
55 // IDs of the sites we force into top sites. 55 // IDs of the sites we force into top sites.
56 static const int kPrepopulatePageIDs[] = 56 static const int kPrepopulatePageIDs[] =
57 { IDS_CHROME_WELCOME_URL, IDS_WEBSTORE_URL }; 57 { IDS_CHROME_WELCOME_URL, IDS_WEBSTORE_URL };
58 58
59 // Favicons of the sites we force into top sites. 59 // Favicons of the sites we force into top sites.
60 static const char kPrepopulateFaviconURLs[][100] = 60 static const char kPrepopulateFaviconURLs[][100] =
61 { "chrome://theme/IDR_PRODUCT_LOGO_16", 61 { "chrome://theme/IDR_PRODUCT_LOGO_16",
62 "chrome://theme/IDR_WEBSTORE_ICON_16" }; 62 "chrome://theme/IDR_WEBSTORE_ICON_16" };
63 // Same as above, but for NTP4. TODO(estade): remove the above.
csilv 2011/09/26 22:25:47 It looks like you removed the wrong lines here.
Evan Stade 2011/09/26 22:32:05 aye, but I didn't. We're using 16x16 for now.
csilv 2011/09/26 22:36:46 Ah right of course.
64 static const char kNewPrepopulateFaviconURLs[][100] =
65 { "chrome://theme/IDR_PRODUCT_LOGO_32",
66 "chrome://theme/IDR_WEBSTORE_ICON_32" };
67 63
68 static const int kPrepopulateTitleIDs[] = 64 static const int kPrepopulateTitleIDs[] =
69 { IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE, 65 { IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE,
70 IDS_NEW_TAB_WEBSTORE_PAGE_TITLE }; 66 IDS_NEW_TAB_WEBSTORE_PAGE_TITLE };
71 67
72 namespace { 68 namespace {
73 69
74 // HistoryDBTask used during migration of thumbnails from history to top sites. 70 // HistoryDBTask used during migration of thumbnails from history to top sites.
75 // When run on the history thread it collects the top sites and the 71 // When run on the history thread it collects the top sites and the
76 // corresponding thumbnails. When run back on the ui thread it calls into 72 // corresponding thumbnails. When run back on the ui thread it calls into
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 } 646 }
651 647
652 // static 648 // static
653 MostVisitedURLList TopSites::GetPrepopulatePages() { 649 MostVisitedURLList TopSites::GetPrepopulatePages() {
654 MostVisitedURLList urls; 650 MostVisitedURLList urls;
655 urls.resize(arraysize(kPrepopulatePageIDs)); 651 urls.resize(arraysize(kPrepopulatePageIDs));
656 for (size_t i = 0; i < arraysize(kPrepopulatePageIDs); ++i) { 652 for (size_t i = 0; i < arraysize(kPrepopulatePageIDs); ++i) {
657 MostVisitedURL& url = urls[i]; 653 MostVisitedURL& url = urls[i];
658 url.url = GURL(l10n_util::GetStringUTF8(kPrepopulatePageIDs[i])); 654 url.url = GURL(l10n_util::GetStringUTF8(kPrepopulatePageIDs[i]));
659 url.redirects.push_back(url.url); 655 url.redirects.push_back(url.url);
660 url.favicon_url = NewTabUI::NTP4Enabled() ? 656 url.favicon_url = GURL(kPrepopulateFaviconURLs[i]);
661 GURL(kNewPrepopulateFaviconURLs[i]) :
662 GURL(kPrepopulateFaviconURLs[i]);
663 url.title = l10n_util::GetStringUTF16(kPrepopulateTitleIDs[i]); 657 url.title = l10n_util::GetStringUTF16(kPrepopulateTitleIDs[i]);
664 } 658 }
665 return urls; 659 return urls;
666 } 660 }
667 661
668 // static 662 // static
669 bool TopSites::AddPrepopulatedPages(MostVisitedURLList* urls) { 663 bool TopSites::AddPrepopulatedPages(MostVisitedURLList* urls) {
670 bool added = false; 664 bool added = false;
671 MostVisitedURLList prepopulate_urls = GetPrepopulatePages(); 665 MostVisitedURLList prepopulate_urls = GetPrepopulatePages();
672 for (size_t i = 0; i < prepopulate_urls.size(); ++i) { 666 for (size_t i = 0; i < prepopulate_urls.size(); ++i) {
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 SetTopSites(pages); 1006 SetTopSites(pages);
1013 1007
1014 // Used only in testing. 1008 // Used only in testing.
1015 NotificationService::current()->Notify( 1009 NotificationService::current()->Notify(
1016 chrome::NOTIFICATION_TOP_SITES_UPDATED, 1010 chrome::NOTIFICATION_TOP_SITES_UPDATED,
1017 Source<TopSites>(this), 1011 Source<TopSites>(this),
1018 Details<CancelableRequestProvider::Handle>(&handle)); 1012 Details<CancelableRequestProvider::Handle>(&handle));
1019 } 1013 }
1020 1014
1021 } // namespace history 1015 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698