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

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

Issue 350007: Convert chrome_url_data_manager (previously a global) into a Singleton. This (Closed)
Patch Set: Created 11 years, 1 month 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
« no previous file with comments | « chrome/browser/dom_ui/downloads_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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/filebrowse_ui.h" 5 #include "chrome/browser/dom_ui/filebrowse_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/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
11 #include "base/singleton.h"
11 #include "base/string_piece.h" 12 #include "base/string_piece.h"
12 #include "base/string_util.h" 13 #include "base/string_util.h"
13 #include "base/thread.h" 14 #include "base/thread.h"
14 #include "base/time.h" 15 #include "base/time.h"
15 #include "base/values.h" 16 #include "base/values.h"
16 #include "chrome/browser/bookmarks/bookmark_model.h" 17 #include "chrome/browser/bookmarks/bookmark_model.h"
17 #include "chrome/browser/chrome_thread.h" 18 #include "chrome/browser/chrome_thread.h"
18 #include "chrome/browser/dom_ui/dom_ui_favicon_source.h" 19 #include "chrome/browser/dom_ui/dom_ui_favicon_source.h"
19 #include "chrome/browser/metrics/user_metrics.h" 20 #include "chrome/browser/metrics/user_metrics.h"
20 #include "chrome/browser/history/history_types.h" 21 #include "chrome/browser/history/history_types.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 lister_->Cancel(); 130 lister_->Cancel();
130 lister_->set_delegate(NULL); 131 lister_->set_delegate(NULL);
131 } 132 }
132 } 133 }
133 134
134 DOMMessageHandler* FileBrowseHandler::Attach(DOMUI* dom_ui) { 135 DOMMessageHandler* FileBrowseHandler::Attach(DOMUI* dom_ui) {
135 // Create our favicon data source. 136 // Create our favicon data source.
136 ChromeThread::PostTask( 137 ChromeThread::PostTask(
137 ChromeThread::IO, FROM_HERE, 138 ChromeThread::IO, FROM_HERE,
138 NewRunnableMethod( 139 NewRunnableMethod(
139 &chrome_url_data_manager, 140 Singleton<ChromeURLDataManager>().get(),
140 &ChromeURLDataManager::AddDataSource, 141 &ChromeURLDataManager::AddDataSource,
141 new DOMUIFavIconSource(dom_ui->GetProfile()))); 142 new DOMUIFavIconSource(dom_ui->GetProfile())));
142 143
143 return DOMMessageHandler::Attach(dom_ui); 144 return DOMMessageHandler::Attach(dom_ui);
144 } 145 }
145 146
146 void FileBrowseHandler::RegisterMessages() { 147 void FileBrowseHandler::RegisterMessages() {
147 dom_ui_->RegisterMessageCallback("getRoots", 148 dom_ui_->RegisterMessageCallback("getRoots",
148 NewCallback(this, &FileBrowseHandler::HandleGetRoots)); 149 NewCallback(this, &FileBrowseHandler::HandleGetRoots));
149 dom_ui_->RegisterMessageCallback("getChildren", 150 dom_ui_->RegisterMessageCallback("getChildren",
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 247
247 FileBrowseUI::FileBrowseUI(TabContents* contents) : DOMUI(contents) { 248 FileBrowseUI::FileBrowseUI(TabContents* contents) : DOMUI(contents) {
248 AddMessageHandler((new FileBrowseHandler())->Attach(this)); 249 AddMessageHandler((new FileBrowseHandler())->Attach(this));
249 DLOG(ERROR) << "Got call to filebrowseUI"; 250 DLOG(ERROR) << "Got call to filebrowseUI";
250 FileBrowseUIHTMLSource* html_source = new FileBrowseUIHTMLSource(); 251 FileBrowseUIHTMLSource* html_source = new FileBrowseUIHTMLSource();
251 252
252 // Set up the chrome://filebrowse/ source. 253 // Set up the chrome://filebrowse/ source.
253 ChromeThread::PostTask( 254 ChromeThread::PostTask(
254 ChromeThread::IO, FROM_HERE, 255 ChromeThread::IO, FROM_HERE,
255 NewRunnableMethod( 256 NewRunnableMethod(
256 &chrome_url_data_manager, 257 Singleton<ChromeURLDataManager>().get(),
257 &ChromeURLDataManager::AddDataSource, 258 &ChromeURLDataManager::AddDataSource,
258 html_source)); 259 html_source));
259 } 260 }
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/downloads_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