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

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

Issue 5519016: Add a new GetInstance() method for singleton classes used in chrome/browser files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 10 years 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/flags_ui.cc ('k') | chrome/browser/dom_ui/history_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) 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/history2_ui.h" 5 #include "chrome/browser/dom_ui/history2_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
119 BrowsingHistoryHandler2::~BrowsingHistoryHandler2() { 119 BrowsingHistoryHandler2::~BrowsingHistoryHandler2() {
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* BrowsingHistoryHandler2::Attach(DOMUI* dom_ui) { 124 DOMMessageHandler* BrowsingHistoryHandler2::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 BrowsingHistoryHandler2::RegisterMessages() { 139 void BrowsingHistoryHandler2::RegisterMessages() {
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 391
392 HistoryUI2::HistoryUI2(TabContents* contents) : DOMUI(contents) { 392 HistoryUI2::HistoryUI2(TabContents* contents) : DOMUI(contents) {
393 AddMessageHandler((new BrowsingHistoryHandler2())->Attach(this)); 393 AddMessageHandler((new BrowsingHistoryHandler2())->Attach(this));
394 394
395 HistoryUIHTMLSource2* html_source = new HistoryUIHTMLSource2(); 395 HistoryUIHTMLSource2* html_source = new HistoryUIHTMLSource2();
396 396
397 // Set up the chrome://history2/ source. 397 // Set up the chrome://history2/ source.
398 BrowserThread::PostTask( 398 BrowserThread::PostTask(
399 BrowserThread::IO, FROM_HERE, 399 BrowserThread::IO, FROM_HERE,
400 NewRunnableMethod( 400 NewRunnableMethod(
401 Singleton<ChromeURLDataManager>::get(), 401 ChromeURLDataManager::GetInstance(),
402 &ChromeURLDataManager::AddDataSource, 402 &ChromeURLDataManager::AddDataSource,
403 make_scoped_refptr(html_source))); 403 make_scoped_refptr(html_source)));
404 } 404 }
405 405
406 // static 406 // static
407 const GURL HistoryUI2::GetHistoryURLWithSearchText(const string16& text) { 407 const GURL HistoryUI2::GetHistoryURLWithSearchText(const string16& text) {
408 return GURL(std::string(chrome::kChromeUIHistory2URL) + "#q=" + 408 return GURL(std::string(chrome::kChromeUIHistory2URL) + "#q=" +
409 EscapeQueryParamValue(UTF16ToUTF8(text), true)); 409 EscapeQueryParamValue(UTF16ToUTF8(text), true));
410 } 410 }
411 411
412 // static 412 // static
413 RefCountedMemory* HistoryUI2::GetFaviconResourceBytes() { 413 RefCountedMemory* HistoryUI2::GetFaviconResourceBytes() {
414 return ResourceBundle::GetSharedInstance(). 414 return ResourceBundle::GetSharedInstance().
415 LoadDataResourceBytes(IDR_HISTORY_FAVICON); 415 LoadDataResourceBytes(IDR_HISTORY_FAVICON);
416 } 416 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/flags_ui.cc ('k') | chrome/browser/dom_ui/history_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698