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

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: Getting code to work again after merge. Created 5 years, 9 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
« no previous file with comments | « chrome/browser/ui/webui/fallback_icon_source.cc ('k') | chrome/chrome_browser_ui.gypi » ('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) 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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/md5.h" 12 #include "base/md5.h"
13 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
14 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/prefs/pref_service.h" 16 #include "base/prefs/pref_service.h"
17 #include "base/prefs/scoped_user_pref_update.h" 17 #include "base/prefs/scoped_user_pref_update.h"
18 #include "base/strings/string16.h" 18 #include "base/strings/string16.h"
19 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
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/history/top_sites_factory.h" 23 #include "chrome/browser/history/top_sites_factory.h"
24 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/thumbnails/thumbnail_list_source.h" 25 #include "chrome/browser/thumbnails/thumbnail_list_source.h"
26 #include "chrome/browser/ui/browser.h" 26 #include "chrome/browser/ui/browser.h"
27 #include "chrome/browser/ui/browser_finder.h" 27 #include "chrome/browser/ui/browser_finder.h"
28 #include "chrome/browser/ui/tabs/tab_strip_model.h" 28 #include "chrome/browser/ui/tabs/tab_strip_model.h"
29 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h" 29 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h"
30 #include "chrome/browser/ui/webui/fallback_icon_source.h"
30 #include "chrome/browser/ui/webui/favicon_source.h" 31 #include "chrome/browser/ui/webui/favicon_source.h"
31 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 32 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
32 #include "chrome/browser/ui/webui/ntp/ntp_stats.h" 33 #include "chrome/browser/ui/webui/ntp/ntp_stats.h"
33 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" 34 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h"
34 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
35 #include "chrome/common/url_constants.h" 36 #include "chrome/common/url_constants.h"
36 #include "components/history/core/browser/page_usage_data.h" 37 #include "components/history/core/browser/page_usage_data.h"
37 #include "components/history/core/browser/top_sites.h" 38 #include "components/history/core/browser/top_sites.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"
(...skipping 32 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 scoped_refptr<history::TopSites> top_sites = 90 scoped_refptr<history::TopSites> top_sites =
87 TopSitesFactory::GetForProfile(profile); 91 TopSitesFactory::GetForProfile(profile);
88 if (top_sites) { 92 if (top_sites) {
89 // TopSites updates itself after a delay. This is especially noticable when 93 // TopSites updates itself after a delay. This is especially noticable when
90 // your profile is empty. Ask TopSites to update itself when we're about to 94 // your profile is empty. Ask TopSites to update itself when we're about to
91 // show the new tab page. 95 // show the new tab page.
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 return base::MD5String(url); 271 return base::MD5String(url);
268 } 272 }
269 273
270 // static 274 // static
271 void MostVisitedHandler::RegisterProfilePrefs( 275 void MostVisitedHandler::RegisterProfilePrefs(
272 user_prefs::PrefRegistrySyncable* registry) { 276 user_prefs::PrefRegistrySyncable* registry) {
273 registry->RegisterDictionaryPref( 277 registry->RegisterDictionaryPref(
274 prefs::kNtpMostVisitedURLsBlacklist, 278 prefs::kNtpMostVisitedURLsBlacklist,
275 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 279 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
276 } 280 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/fallback_icon_source.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698