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/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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 : got_first_most_visited_request_(false) { | 45 : got_first_most_visited_request_(false) { |
46 } | 46 } |
47 | 47 |
48 MostVisitedHandler::~MostVisitedHandler() { | 48 MostVisitedHandler::~MostVisitedHandler() { |
49 } | 49 } |
50 | 50 |
51 void MostVisitedHandler::RegisterMessages() { | 51 void MostVisitedHandler::RegisterMessages() { |
52 Profile* profile = Profile::FromWebUI(web_ui()); | 52 Profile* profile = Profile::FromWebUI(web_ui()); |
53 // Set up our sources for thumbnail and favicon data. | 53 // Set up our sources for thumbnail and favicon data. |
54 ThumbnailSource* thumbnail_src = new ThumbnailSource(profile); | 54 ThumbnailSource* thumbnail_src = new ThumbnailSource(profile); |
55 profile->GetChromeURLDataManager()->AddDataSource(thumbnail_src); | 55 ChromeURLDataManager::AddDataSource(profile, thumbnail_src); |
56 | 56 |
57 profile->GetChromeURLDataManager()->AddDataSource( | 57 ChromeURLDataManager::AddDataSource(profile, |
58 new FaviconSource(profile, FaviconSource::FAVICON)); | 58 new FaviconSource(profile, FaviconSource::FAVICON)); |
59 | 59 |
60 history::TopSites* ts = profile->GetTopSites(); | 60 history::TopSites* ts = profile->GetTopSites(); |
61 if (ts) { | 61 if (ts) { |
62 // TopSites updates itself after a delay. This is especially noticable when | 62 // TopSites updates itself after a delay. This is especially noticable when |
63 // your profile is empty. Ask TopSites to update itself when we're about to | 63 // your profile is empty. Ask TopSites to update itself when we're about to |
64 // show the new tab page. | 64 // show the new tab page. |
65 ts->SyncWithHistory(); | 65 ts->SyncWithHistory(); |
66 | 66 |
67 // Register for notification when TopSites changes so that we can update | 67 // Register for notification when TopSites changes so that we can update |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 std::string MostVisitedHandler::GetDictionaryKeyForURL(const std::string& url) { | 204 std::string MostVisitedHandler::GetDictionaryKeyForURL(const std::string& url) { |
205 return base::MD5String(url); | 205 return base::MD5String(url); |
206 } | 206 } |
207 | 207 |
208 // static | 208 // static |
209 void MostVisitedHandler::RegisterUserPrefs(PrefService* prefs) { | 209 void MostVisitedHandler::RegisterUserPrefs(PrefService* prefs) { |
210 prefs->RegisterDictionaryPref(prefs::kNtpMostVisitedURLsBlacklist, | 210 prefs->RegisterDictionaryPref(prefs::kNtpMostVisitedURLsBlacklist, |
211 PrefService::UNSYNCABLE_PREF); | 211 PrefService::UNSYNCABLE_PREF); |
212 } | 212 } |
OLD | NEW |