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

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

Issue 10196004: Changed ChromeURLDataManager to a ProfileKeyedService and made a Factory for it. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Made ChromeURLDataManager's destructor virtual Created 8 years, 8 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/suggestions_page_handler.h" 5 #include "chrome/browser/ui/webui/ntp/suggestions_page_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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 UMA_HISTOGRAM_ENUMERATION("NewTabPage.SuggestedSitesAction", action_id, 84 UMA_HISTOGRAM_ENUMERATION("NewTabPage.SuggestedSitesAction", action_id,
85 NUM_SUGGESTED_SITES_ACTIONS); 85 NUM_SUGGESTED_SITES_ACTIONS);
86 } 86 }
87 } 87 }
88 88
89 void SuggestionsHandler::RegisterMessages() { 89 void SuggestionsHandler::RegisterMessages() {
90 Profile* profile = Profile::FromWebUI(web_ui()); 90 Profile* profile = Profile::FromWebUI(web_ui());
91 // Set up our sources for thumbnail and favicon data. 91 // Set up our sources for thumbnail and favicon data.
92 profile->GetChromeURLDataManager()->AddDataSource( 92 ChromeURLDataManager::AddDataSource(profile, new ThumbnailSource(profile));
93 new ThumbnailSource(profile)); 93 ChromeURLDataManager::AddDataSource(profile,
94 profile->GetChromeURLDataManager()->AddDataSource(
95 new FaviconSource(profile, FaviconSource::FAVICON)); 94 new FaviconSource(profile, FaviconSource::FAVICON));
96 95
97 // TODO(georgey) change the source of the web-sites to provide our data. 96 // TODO(georgey) change the source of the web-sites to provide our data.
98 // Initial commit uses top sites as a data source. 97 // Initial commit uses top sites as a data source.
99 history::TopSites* top_sites = profile->GetTopSites(); 98 history::TopSites* top_sites = profile->GetTopSites();
100 if (top_sites) { 99 if (top_sites) {
101 // TopSites updates itself after a delay. This is especially noticable when 100 // TopSites updates itself after a delay. This is especially noticable when
102 // your profile is empty. Ask TopSites to update itself when we're about to 101 // your profile is empty. Ask TopSites to update itself when we're about to
103 // show the new tab page. 102 // show the new tab page.
104 top_sites->SyncWithHistory(); 103 top_sites->SyncWithHistory();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } 243 }
245 244
246 std::string SuggestionsHandler::GetDictionaryKeyForURL(const std::string& url) { 245 std::string SuggestionsHandler::GetDictionaryKeyForURL(const std::string& url) {
247 return base::MD5String(url); 246 return base::MD5String(url);
248 } 247 }
249 248
250 // static 249 // static
251 void SuggestionsHandler::RegisterUserPrefs(PrefService* prefs) { 250 void SuggestionsHandler::RegisterUserPrefs(PrefService* prefs) {
252 // TODO(georgey) add user preferences (such as own blacklist) as needed. 251 // TODO(georgey) add user preferences (such as own blacklist) as needed.
253 } 252 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_ui.cc ('k') | chrome/browser/ui/webui/omnibox/omnibox_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698