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

Side by Side Diff: chrome/browser/ui/webui/ntp/most_visited_handler.cc

Issue 835903005: [Favicon] Add new fallback icon rendering flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing FallbackIconStyleBuilder; trimming down chrome://fallback-icon syntax. Created 5 years, 11 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
OLDNEW
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/ui/webui/ntp/most_visited_handler.h" 5 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 10 matching lines...) Expand all
21 #include "base/threading/thread.h" 21 #include "base/threading/thread.h"
22 #include "base/values.h" 22 #include "base/values.h"
23 #include "chrome/browser/chrome_notification_types.h" 23 #include "chrome/browser/chrome_notification_types.h"
24 #include "chrome/browser/history/top_sites.h" 24 #include "chrome/browser/history/top_sites.h"
25 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/thumbnails/thumbnail_list_source.h" 26 #include "chrome/browser/thumbnails/thumbnail_list_source.h"
27 #include "chrome/browser/ui/browser.h" 27 #include "chrome/browser/ui/browser.h"
28 #include "chrome/browser/ui/browser_finder.h" 28 #include "chrome/browser/ui/browser_finder.h"
29 #include "chrome/browser/ui/tabs/tab_strip_model.h" 29 #include "chrome/browser/ui/tabs/tab_strip_model.h"
30 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h" 30 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h"
31 #include "chrome/browser/ui/webui/fallback_icon_source.h"
31 #include "chrome/browser/ui/webui/favicon_source.h" 32 #include "chrome/browser/ui/webui/favicon_source.h"
32 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 33 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
33 #include "chrome/browser/ui/webui/ntp/ntp_stats.h" 34 #include "chrome/browser/ui/webui/ntp/ntp_stats.h"
34 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" 35 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h"
35 #include "chrome/common/pref_names.h" 36 #include "chrome/common/pref_names.h"
36 #include "chrome/common/url_constants.h" 37 #include "chrome/common/url_constants.h"
37 #include "components/history/core/browser/page_usage_data.h" 38 #include "components/history/core/browser/page_usage_data.h"
38 #include "components/pref_registry/pref_registry_syncable.h" 39 #include "components/pref_registry/pref_registry_syncable.h"
39 #include "content/public/browser/navigation_controller.h" 40 #include "content/public/browser/navigation_controller.h"
40 #include "content/public/browser/navigation_entry.h" 41 #include "content/public/browser/navigation_entry.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 73
73 void MostVisitedHandler::RegisterMessages() { 74 void MostVisitedHandler::RegisterMessages() {
74 Profile* profile = Profile::FromWebUI(web_ui()); 75 Profile* profile = Profile::FromWebUI(web_ui());
75 // Set up our sources for thumbnail and favicon data. 76 // Set up our sources for thumbnail and favicon data.
76 content::URLDataSource::Add(profile, new ThumbnailSource(profile, false)); 77 content::URLDataSource::Add(profile, new ThumbnailSource(profile, false));
77 content::URLDataSource::Add(profile, new ThumbnailSource(profile, true)); 78 content::URLDataSource::Add(profile, new ThumbnailSource(profile, true));
78 79
79 // Set up our sources for top-sites data. 80 // Set up our sources for top-sites data.
80 content::URLDataSource::Add(profile, new ThumbnailListSource(profile)); 81 content::URLDataSource::Add(profile, new ThumbnailListSource(profile));
81 82
83 // Register chrome://fallback-icon as a data source for fallback icons.
84 content::URLDataSource::Add(profile, new FallbackIconSource());
85
82 // Register chrome://favicon as a data source for favicons. 86 // Register chrome://favicon as a data source for favicons.
83 content::URLDataSource::Add( 87 content::URLDataSource::Add(
84 profile, new FaviconSource(profile, FaviconSource::FAVICON)); 88 profile, new FaviconSource(profile, FaviconSource::FAVICON));
85 89
86 history::TopSites* ts = profile->GetTopSites(); 90 history::TopSites* ts = profile->GetTopSites();
87 if (ts) { 91 if (ts) {
88 // TopSites updates itself after a delay. This is especially noticable when 92 // TopSites updates itself after a delay. This is especially noticable when
89 // your profile is empty. Ask TopSites to update itself when we're about to 93 // your profile is empty. Ask TopSites to update itself when we're about to
90 // show the new tab page. 94 // show the new tab page.
91 ts->SyncWithHistory(); 95 ts->SyncWithHistory();
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 return base::MD5String(url); 267 return base::MD5String(url);
264 } 268 }
265 269
266 // static 270 // static
267 void MostVisitedHandler::RegisterProfilePrefs( 271 void MostVisitedHandler::RegisterProfilePrefs(
268 user_prefs::PrefRegistrySyncable* registry) { 272 user_prefs::PrefRegistrySyncable* registry) {
269 registry->RegisterDictionaryPref( 273 registry->RegisterDictionaryPref(
270 prefs::kNtpMostVisitedURLsBlacklist, 274 prefs::kNtpMostVisitedURLsBlacklist,
271 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 275 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
272 } 276 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698