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

Side by Side Diff: chrome/browser/dom_ui/most_visited_handler.cc

Issue 6461024: Revert 74292 - Splits ChromeURLDataManager into 2 chunks:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/dom_ui/mediaplayer_ui.cc ('k') | chrome/browser/dom_ui/net_internals_ui.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/dom_ui/most_visited_handler.h" 5 #include "chrome/browser/dom_ui/most_visited_handler.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 MostVisitedHandler::MostVisitedHandler() 57 MostVisitedHandler::MostVisitedHandler()
58 : url_blacklist_(NULL), 58 : url_blacklist_(NULL),
59 pinned_urls_(NULL), 59 pinned_urls_(NULL),
60 got_first_most_visited_request_(false) { 60 got_first_most_visited_request_(false) {
61 } 61 }
62 62
63 MostVisitedHandler::~MostVisitedHandler() { 63 MostVisitedHandler::~MostVisitedHandler() {
64 } 64 }
65 65
66 WebUIMessageHandler* MostVisitedHandler::Attach(DOMUI* dom_ui) { 66 WebUIMessageHandler* MostVisitedHandler::Attach(DOMUI* dom_ui) {
67 Profile* profile = dom_ui->GetProfile(); 67 url_blacklist_ = dom_ui->GetProfile()->GetPrefs()->
68 url_blacklist_ = profile->GetPrefs()->GetMutableDictionary( 68 GetMutableDictionary(prefs::kNTPMostVisitedURLsBlacklist);
69 prefs::kNTPMostVisitedURLsBlacklist); 69 pinned_urls_ = dom_ui->GetProfile()->GetPrefs()->
70 pinned_urls_ = profile->GetPrefs()->GetMutableDictionary( 70 GetMutableDictionary(prefs::kNTPMostVisitedPinnedURLs);
71 prefs::kNTPMostVisitedPinnedURLs);
72 // Set up our sources for thumbnail and favicon data. 71 // Set up our sources for thumbnail and favicon data.
73 WebUIThumbnailSource* thumbnail_src = new WebUIThumbnailSource(profile); 72 WebUIThumbnailSource* thumbnail_src =
74 profile->GetChromeURLDataManager()->AddDataSource(thumbnail_src); 73 new WebUIThumbnailSource(dom_ui->GetProfile());
74 BrowserThread::PostTask(
75 BrowserThread::IO, FROM_HERE,
76 NewRunnableMethod(ChromeURLDataManager::GetInstance(),
77 &ChromeURLDataManager::AddDataSource,
78 make_scoped_refptr(thumbnail_src)));
75 79
76 WebUIFavIconSource* favicon_src = new WebUIFavIconSource(profile); 80 WebUIFavIconSource* favicon_src =
77 profile->GetChromeURLDataManager()->AddDataSource(favicon_src); 81 new WebUIFavIconSource(dom_ui->GetProfile());
82 BrowserThread::PostTask(
83 BrowserThread::IO, FROM_HERE,
84 NewRunnableMethod(ChromeURLDataManager::GetInstance(),
85 &ChromeURLDataManager::AddDataSource,
86 make_scoped_refptr(favicon_src)));
78 87
79 // Get notifications when history is cleared. 88 // Get notifications when history is cleared.
80 registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, 89 registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED,
81 Source<Profile>(profile)); 90 Source<Profile>(dom_ui->GetProfile()));
82 91
83 WebUIMessageHandler* result = WebUIMessageHandler::Attach(dom_ui); 92 WebUIMessageHandler* result = WebUIMessageHandler::Attach(dom_ui);
84 93
85 // We pre-emptively make a fetch for the most visited pages so we have the 94 // We pre-emptively make a fetch for the most visited pages so we have the
86 // results sooner. 95 // results sooner.
87 StartQueryForMostVisited(); 96 StartQueryForMostVisited();
88 return result; 97 return result;
89 } 98 }
90 99
91 void MostVisitedHandler::RegisterMessages() { 100 void MostVisitedHandler::RegisterMessages() {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 387
379 // static 388 // static
380 std::vector<GURL> MostVisitedHandler::GetPrePopulatedUrls() { 389 std::vector<GURL> MostVisitedHandler::GetPrePopulatedUrls() {
381 const std::vector<MostVisitedPage> pages = 390 const std::vector<MostVisitedPage> pages =
382 MostVisitedHandler::GetPrePopulatedPages(); 391 MostVisitedHandler::GetPrePopulatedPages();
383 std::vector<GURL> page_urls; 392 std::vector<GURL> page_urls;
384 for (size_t i = 0; i < pages.size(); ++i) 393 for (size_t i = 0; i < pages.size(); ++i)
385 page_urls.push_back(pages[i].url); 394 page_urls.push_back(pages[i].url);
386 return page_urls; 395 return page_urls;
387 } 396 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/mediaplayer_ui.cc ('k') | chrome/browser/dom_ui/net_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698