OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |