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

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

Issue 7600013: ntp4: make default (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unit test failures 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
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"
11 #include "base/logging.h" 10 #include "base/logging.h"
12 #include "base/md5.h" 11 #include "base/md5.h"
13 #include "base/string_util.h" 12 #include "base/string_util.h"
14 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
15 #include "base/values.h" 14 #include "base/values.h"
16 #include "chrome/browser/history/history_backend.h" 15 #include "chrome/browser/history/history_backend.h"
17 #include "chrome/browser/history/history_notifications.h" 16 #include "chrome/browser/history/history_notifications.h"
18 #include "chrome/browser/history/page_usage_data.h" 17 #include "chrome/browser/history/page_usage_data.h"
19 #include "chrome/browser/history/top_sites_backend.h" 18 #include "chrome/browser/history/top_sites_backend.h"
20 #include "chrome/browser/history/top_sites_cache.h" 19 #include "chrome/browser/history/top_sites_cache.h"
21 #include "chrome/browser/prefs/pref_service.h" 20 #include "chrome/browser/prefs/pref_service.h"
22 #include "chrome/browser/prefs/scoped_user_pref_update.h" 21 #include "chrome/browser/prefs/scoped_user_pref_update.h"
23 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" 23 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h"
24 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
25 #include "chrome/common/chrome_notification_types.h" 25 #include "chrome/common/chrome_notification_types.h"
26 #include "chrome/common/chrome_switches.h"
27 #include "chrome/common/pref_names.h" 26 #include "chrome/common/pref_names.h"
28 #include "chrome/common/thumbnail_score.h" 27 #include "chrome/common/thumbnail_score.h"
29 #include "content/browser/browser_thread.h" 28 #include "content/browser/browser_thread.h"
30 #include "content/browser/tab_contents/navigation_details.h" 29 #include "content/browser/tab_contents/navigation_details.h"
31 #include "content/browser/tab_contents/navigation_entry.h" 30 #include "content/browser/tab_contents/navigation_entry.h"
32 #include "content/common/notification_service.h" 31 #include "content/common/notification_service.h"
33 #include "grit/chromium_strings.h" 32 #include "grit/chromium_strings.h"
34 #include "grit/generated_resources.h" 33 #include "grit/generated_resources.h"
35 #include "grit/locale_settings.h" 34 #include "grit/locale_settings.h"
36 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 } 644 }
646 645
647 // static 646 // static
648 MostVisitedURLList TopSites::GetPrepopulatePages() { 647 MostVisitedURLList TopSites::GetPrepopulatePages() {
649 MostVisitedURLList urls; 648 MostVisitedURLList urls;
650 urls.resize(arraysize(kPrepopulatePageIDs)); 649 urls.resize(arraysize(kPrepopulatePageIDs));
651 for (size_t i = 0; i < arraysize(kPrepopulatePageIDs); ++i) { 650 for (size_t i = 0; i < arraysize(kPrepopulatePageIDs); ++i) {
652 MostVisitedURL& url = urls[i]; 651 MostVisitedURL& url = urls[i];
653 url.url = GURL(l10n_util::GetStringUTF8(kPrepopulatePageIDs[i])); 652 url.url = GURL(l10n_util::GetStringUTF8(kPrepopulatePageIDs[i]));
654 url.redirects.push_back(url.url); 653 url.redirects.push_back(url.url);
655 url.favicon_url = 654 url.favicon_url = NewTabUI::Ntp4Enabled() ?
656 CommandLine::ForCurrentProcess()->HasSwitch(switches::kNewTabPage4) ?
657 GURL(kNewPrepopulateFaviconURLs[i]) : 655 GURL(kNewPrepopulateFaviconURLs[i]) :
658 GURL(kPrepopulateFaviconURLs[i]); 656 GURL(kPrepopulateFaviconURLs[i]);
659 url.title = l10n_util::GetStringUTF16(kPrepopulateTitleIDs[i]); 657 url.title = l10n_util::GetStringUTF16(kPrepopulateTitleIDs[i]);
660 } 658 }
661 return urls; 659 return urls;
662 } 660 }
663 661
664 // static 662 // static
665 bool TopSites::AddPrepopulatedPages(MostVisitedURLList* urls) { 663 bool TopSites::AddPrepopulatedPages(MostVisitedURLList* urls) {
666 bool added = false; 664 bool added = false;
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 SetTopSites(pages); 1006 SetTopSites(pages);
1009 1007
1010 // Used only in testing. 1008 // Used only in testing.
1011 NotificationService::current()->Notify( 1009 NotificationService::current()->Notify(
1012 chrome::NOTIFICATION_TOP_SITES_UPDATED, 1010 chrome::NOTIFICATION_TOP_SITES_UPDATED,
1013 Source<TopSites>(this), 1011 Source<TopSites>(this),
1014 Details<CancelableRequestProvider::Handle>(&handle)); 1012 Details<CancelableRequestProvider::Handle>(&handle));
1015 } 1013 }
1016 1014
1017 } // namespace history 1015 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/extensions/apps_promo.cc ('k') | chrome/browser/ui/cocoa/browser_window_controller_private.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698