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

Side by Side Diff: chrome/browser/dom_ui/history2_ui.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/history2_ui.h" 5 #include "chrome/browser/dom_ui/history2_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 : search_text_() { 122 : search_text_() {
123 } 123 }
124 124
125 BrowsingHistoryHandler2::~BrowsingHistoryHandler2() { 125 BrowsingHistoryHandler2::~BrowsingHistoryHandler2() {
126 cancelable_search_consumer_.CancelAllRequests(); 126 cancelable_search_consumer_.CancelAllRequests();
127 cancelable_delete_consumer_.CancelAllRequests(); 127 cancelable_delete_consumer_.CancelAllRequests();
128 } 128 }
129 129
130 WebUIMessageHandler* BrowsingHistoryHandler2::Attach(DOMUI* dom_ui) { 130 WebUIMessageHandler* BrowsingHistoryHandler2::Attach(DOMUI* dom_ui) {
131 // Create our favicon data source. 131 // Create our favicon data source.
132 BrowserThread::PostTask( 132 Profile* profile = dom_ui->GetProfile();
133 BrowserThread::IO, FROM_HERE, 133 profile->GetChromeURLDataManager()->AddDataSource(
134 NewRunnableMethod( 134 new WebUIFavIconSource(profile));
135 ChromeURLDataManager::GetInstance(),
136 &ChromeURLDataManager::AddDataSource,
137 make_scoped_refptr(new WebUIFavIconSource(dom_ui->GetProfile()))));
138 135
139 // Get notifications when history is cleared. 136 // Get notifications when history is cleared.
140 registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, 137 registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED,
141 Source<Profile>(dom_ui->GetProfile()->GetOriginalProfile())); 138 Source<Profile>(dom_ui->GetProfile()->GetOriginalProfile()));
142 return WebUIMessageHandler::Attach(dom_ui); 139 return WebUIMessageHandler::Attach(dom_ui);
143 } 140 }
144 141
145 void BrowsingHistoryHandler2::RegisterMessages() { 142 void BrowsingHistoryHandler2::RegisterMessages() {
146 dom_ui_->RegisterMessageCallback("getHistory", 143 dom_ui_->RegisterMessageCallback("getHistory",
147 NewCallback(this, &BrowsingHistoryHandler2::HandleGetHistory)); 144 NewCallback(this, &BrowsingHistoryHandler2::HandleGetHistory));
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 // HistoryUIContents 390 // HistoryUIContents
394 // 391 //
395 //////////////////////////////////////////////////////////////////////////////// 392 ////////////////////////////////////////////////////////////////////////////////
396 393
397 HistoryUI2::HistoryUI2(TabContents* contents) : DOMUI(contents) { 394 HistoryUI2::HistoryUI2(TabContents* contents) : DOMUI(contents) {
398 AddMessageHandler((new BrowsingHistoryHandler2())->Attach(this)); 395 AddMessageHandler((new BrowsingHistoryHandler2())->Attach(this));
399 396
400 HistoryUIHTMLSource2* html_source = new HistoryUIHTMLSource2(); 397 HistoryUIHTMLSource2* html_source = new HistoryUIHTMLSource2();
401 398
402 // Set up the chrome://history2/ source. 399 // Set up the chrome://history2/ source.
403 BrowserThread::PostTask( 400 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source);
404 BrowserThread::IO, FROM_HERE,
405 NewRunnableMethod(
406 ChromeURLDataManager::GetInstance(),
407 &ChromeURLDataManager::AddDataSource,
408 make_scoped_refptr(html_source)));
409 } 401 }
410 402
411 // static 403 // static
412 const GURL HistoryUI2::GetHistoryURLWithSearchText(const string16& text) { 404 const GURL HistoryUI2::GetHistoryURLWithSearchText(const string16& text) {
413 return GURL(std::string(chrome::kChromeUIHistory2URL) + "#q=" + 405 return GURL(std::string(chrome::kChromeUIHistory2URL) + "#q=" +
414 EscapeQueryParamValue(UTF16ToUTF8(text), true)); 406 EscapeQueryParamValue(UTF16ToUTF8(text), true));
415 } 407 }
416 408
417 // static 409 // static
418 RefCountedMemory* HistoryUI2::GetFaviconResourceBytes() { 410 RefCountedMemory* HistoryUI2::GetFaviconResourceBytes() {
419 return ResourceBundle::GetSharedInstance(). 411 return ResourceBundle::GetSharedInstance().
420 LoadDataResourceBytes(IDR_HISTORY_FAVICON); 412 LoadDataResourceBytes(IDR_HISTORY_FAVICON);
421 } 413 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698