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

Side by Side Diff: chrome/browser/ui/webui/ntp/most_visited_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/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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698