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

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

Issue 6479007: Attempt 3 at: Splits ChromeURLDataManager into 2 chunks:... (Closed) Base URL: svn://chrome-svn/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
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 url_blacklist_ = dom_ui->GetProfile()->GetPrefs()-> 67 Profile* profile = dom_ui->GetProfile();
68 GetMutableDictionary(prefs::kNTPMostVisitedURLsBlacklist); 68 url_blacklist_ = profile->GetPrefs()->GetMutableDictionary(
69 pinned_urls_ = dom_ui->GetProfile()->GetPrefs()-> 69 prefs::kNTPMostVisitedURLsBlacklist);
70 GetMutableDictionary(prefs::kNTPMostVisitedPinnedURLs); 70 pinned_urls_ = profile->GetPrefs()->GetMutableDictionary(
71 prefs::kNTPMostVisitedPinnedURLs);
71 // Set up our sources for thumbnail and favicon data. 72 // Set up our sources for thumbnail and favicon data.
72 WebUIThumbnailSource* thumbnail_src = 73 WebUIThumbnailSource* thumbnail_src = new WebUIThumbnailSource(profile);
73 new WebUIThumbnailSource(dom_ui->GetProfile()); 74 profile->GetChromeURLDataManager()->AddDataSource(thumbnail_src);
74 BrowserThread::PostTask(
75 BrowserThread::IO, FROM_HERE,
76 NewRunnableMethod(ChromeURLDataManager::GetInstance(),
77 &ChromeURLDataManager::AddDataSource,
78 make_scoped_refptr(thumbnail_src)));
79 75
80 WebUIFavIconSource* favicon_src = 76 WebUIFavIconSource* favicon_src = new WebUIFavIconSource(profile);
81 new WebUIFavIconSource(dom_ui->GetProfile()); 77 profile->GetChromeURLDataManager()->AddDataSource(favicon_src);
82 BrowserThread::PostTask(
83 BrowserThread::IO, FROM_HERE,
84 NewRunnableMethod(ChromeURLDataManager::GetInstance(),
85 &ChromeURLDataManager::AddDataSource,
86 make_scoped_refptr(favicon_src)));
87 78
88 // Get notifications when history is cleared. 79 // Get notifications when history is cleared.
89 registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, 80 registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED,
90 Source<Profile>(dom_ui->GetProfile())); 81 Source<Profile>(profile));
91 82
92 WebUIMessageHandler* result = WebUIMessageHandler::Attach(dom_ui); 83 WebUIMessageHandler* result = WebUIMessageHandler::Attach(dom_ui);
93 84
94 // We pre-emptively make a fetch for the most visited pages so we have the 85 // We pre-emptively make a fetch for the most visited pages so we have the
95 // results sooner. 86 // results sooner.
96 StartQueryForMostVisited(); 87 StartQueryForMostVisited();
97 return result; 88 return result;
98 } 89 }
99 90
100 void MostVisitedHandler::RegisterMessages() { 91 void MostVisitedHandler::RegisterMessages() {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 378
388 // static 379 // static
389 std::vector<GURL> MostVisitedHandler::GetPrePopulatedUrls() { 380 std::vector<GURL> MostVisitedHandler::GetPrePopulatedUrls() {
390 const std::vector<MostVisitedPage> pages = 381 const std::vector<MostVisitedPage> pages =
391 MostVisitedHandler::GetPrePopulatedPages(); 382 MostVisitedHandler::GetPrePopulatedPages();
392 std::vector<GURL> page_urls; 383 std::vector<GURL> page_urls;
393 for (size_t i = 0; i < pages.size(); ++i) 384 for (size_t i = 0; i < pages.size(); ++i)
394 page_urls.push_back(pages[i].url); 385 page_urls.push_back(pages[i].url);
395 return page_urls; 386 return page_urls;
396 } 387 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698