| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/history_ui.h" | 5 #include "chrome/browser/dom_ui/history_ui.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 BrowsingHistoryHandler::~BrowsingHistoryHandler() { | 119 BrowsingHistoryHandler::~BrowsingHistoryHandler() { |
| 120 cancelable_search_consumer_.CancelAllRequests(); | 120 cancelable_search_consumer_.CancelAllRequests(); |
| 121 cancelable_delete_consumer_.CancelAllRequests(); | 121 cancelable_delete_consumer_.CancelAllRequests(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 DOMMessageHandler* BrowsingHistoryHandler::Attach(DOMUI* dom_ui) { | 124 DOMMessageHandler* BrowsingHistoryHandler::Attach(DOMUI* dom_ui) { |
| 125 // Create our favicon data source. | 125 // Create our favicon data source. |
| 126 BrowserThread::PostTask( | 126 BrowserThread::PostTask( |
| 127 BrowserThread::IO, FROM_HERE, | 127 BrowserThread::IO, FROM_HERE, |
| 128 NewRunnableMethod( | 128 NewRunnableMethod( |
| 129 Singleton<ChromeURLDataManager>::get(), | 129 ChromeURLDataManager::GetInstance(), |
| 130 &ChromeURLDataManager::AddDataSource, | 130 &ChromeURLDataManager::AddDataSource, |
| 131 make_scoped_refptr(new DOMUIFavIconSource(dom_ui->GetProfile())))); | 131 make_scoped_refptr(new DOMUIFavIconSource(dom_ui->GetProfile())))); |
| 132 | 132 |
| 133 // Get notifications when history is cleared. | 133 // Get notifications when history is cleared. |
| 134 registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, | 134 registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, |
| 135 Source<Profile>(dom_ui->GetProfile()->GetOriginalProfile())); | 135 Source<Profile>(dom_ui->GetProfile()->GetOriginalProfile())); |
| 136 return DOMMessageHandler::Attach(dom_ui); | 136 return DOMMessageHandler::Attach(dom_ui); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void BrowsingHistoryHandler::RegisterMessages() { | 139 void BrowsingHistoryHandler::RegisterMessages() { |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 379 |
| 380 HistoryUI::HistoryUI(TabContents* contents) : DOMUI(contents) { | 380 HistoryUI::HistoryUI(TabContents* contents) : DOMUI(contents) { |
| 381 AddMessageHandler((new BrowsingHistoryHandler())->Attach(this)); | 381 AddMessageHandler((new BrowsingHistoryHandler())->Attach(this)); |
| 382 | 382 |
| 383 HistoryUIHTMLSource* html_source = new HistoryUIHTMLSource(); | 383 HistoryUIHTMLSource* html_source = new HistoryUIHTMLSource(); |
| 384 | 384 |
| 385 // Set up the chrome://history/ source. | 385 // Set up the chrome://history/ source. |
| 386 BrowserThread::PostTask( | 386 BrowserThread::PostTask( |
| 387 BrowserThread::IO, FROM_HERE, | 387 BrowserThread::IO, FROM_HERE, |
| 388 NewRunnableMethod( | 388 NewRunnableMethod( |
| 389 Singleton<ChromeURLDataManager>::get(), | 389 ChromeURLDataManager::GetInstance(), |
| 390 &ChromeURLDataManager::AddDataSource, | 390 &ChromeURLDataManager::AddDataSource, |
| 391 make_scoped_refptr(html_source))); | 391 make_scoped_refptr(html_source))); |
| 392 } | 392 } |
| 393 | 393 |
| 394 // static | 394 // static |
| 395 const GURL HistoryUI::GetHistoryURLWithSearchText(const string16& text) { | 395 const GURL HistoryUI::GetHistoryURLWithSearchText(const string16& text) { |
| 396 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + | 396 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + |
| 397 EscapeQueryParamValue(UTF16ToUTF8(text), true)); | 397 EscapeQueryParamValue(UTF16ToUTF8(text), true)); |
| 398 } | 398 } |
| 399 | 399 |
| 400 // static | 400 // static |
| 401 RefCountedMemory* HistoryUI::GetFaviconResourceBytes() { | 401 RefCountedMemory* HistoryUI::GetFaviconResourceBytes() { |
| 402 return ResourceBundle::GetSharedInstance(). | 402 return ResourceBundle::GetSharedInstance(). |
| 403 LoadDataResourceBytes(IDR_HISTORY_FAVICON); | 403 LoadDataResourceBytes(IDR_HISTORY_FAVICON); |
| 404 } | 404 } |
| OLD | NEW |