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/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/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 NewRunnableMethod( | 415 NewRunnableMethod( |
416 task, &TaskProxy::DeleteFetcher, fetch)); | 416 task, &TaskProxy::DeleteFetcher, fetch)); |
417 } | 417 } |
418 } | 418 } |
419 | 419 |
420 DOMMessageHandler* FilebrowseHandler::Attach(DOMUI* dom_ui) { | 420 DOMMessageHandler* FilebrowseHandler::Attach(DOMUI* dom_ui) { |
421 // Create our favicon data source. | 421 // Create our favicon data source. |
422 BrowserThread::PostTask( | 422 BrowserThread::PostTask( |
423 BrowserThread::IO, FROM_HERE, | 423 BrowserThread::IO, FROM_HERE, |
424 NewRunnableMethod( | 424 NewRunnableMethod( |
425 Singleton<ChromeURLDataManager>::get(), | 425 ChromeURLDataManager::GetInstance(), |
426 &ChromeURLDataManager::AddDataSource, | 426 &ChromeURLDataManager::AddDataSource, |
427 make_scoped_refptr(new DOMUIFavIconSource(dom_ui->GetProfile())))); | 427 make_scoped_refptr(new DOMUIFavIconSource(dom_ui->GetProfile())))); |
428 profile_ = dom_ui->GetProfile(); | 428 profile_ = dom_ui->GetProfile(); |
429 tab_contents_ = dom_ui->tab_contents(); | 429 tab_contents_ = dom_ui->tab_contents(); |
430 return DOMMessageHandler::Attach(dom_ui); | 430 return DOMMessageHandler::Attach(dom_ui); |
431 } | 431 } |
432 | 432 |
433 void FilebrowseHandler::Init() { | 433 void FilebrowseHandler::Init() { |
434 download_manager_ = profile_->GetDownloadManager(); | 434 download_manager_ = profile_->GetDownloadManager(); |
435 download_manager_->AddObserver(this); | 435 download_manager_->AddObserver(this); |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1122 FileBrowseUI::FileBrowseUI(TabContents* contents) : HtmlDialogUI(contents) { | 1122 FileBrowseUI::FileBrowseUI(TabContents* contents) : HtmlDialogUI(contents) { |
1123 FilebrowseHandler* handler = new FilebrowseHandler(); | 1123 FilebrowseHandler* handler = new FilebrowseHandler(); |
1124 AddMessageHandler((handler)->Attach(this)); | 1124 AddMessageHandler((handler)->Attach(this)); |
1125 handler->Init(); | 1125 handler->Init(); |
1126 FileBrowseUIHTMLSource* html_source = new FileBrowseUIHTMLSource(); | 1126 FileBrowseUIHTMLSource* html_source = new FileBrowseUIHTMLSource(); |
1127 | 1127 |
1128 // Set up the chrome://filebrowse/ source. | 1128 // Set up the chrome://filebrowse/ source. |
1129 BrowserThread::PostTask( | 1129 BrowserThread::PostTask( |
1130 BrowserThread::IO, FROM_HERE, | 1130 BrowserThread::IO, FROM_HERE, |
1131 NewRunnableMethod( | 1131 NewRunnableMethod( |
1132 Singleton<ChromeURLDataManager>::get(), | 1132 ChromeURLDataManager::GetInstance(), |
1133 &ChromeURLDataManager::AddDataSource, | 1133 &ChromeURLDataManager::AddDataSource, |
1134 make_scoped_refptr(html_source))); | 1134 make_scoped_refptr(html_source))); |
1135 } | 1135 } |
1136 | 1136 |
1137 // static | 1137 // static |
1138 Browser* FileBrowseUI::OpenPopup(Profile* profile, | 1138 Browser* FileBrowseUI::OpenPopup(Profile* profile, |
1139 const std::string& hashArgument, | 1139 const std::string& hashArgument, |
1140 int width, | 1140 int width, |
1141 int height) { | 1141 int height) { |
1142 // Get existing pop up for given hashArgument. | 1142 // Get existing pop up for given hashArgument. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1204 } | 1204 } |
1205 } | 1205 } |
1206 | 1206 |
1207 return NULL; | 1207 return NULL; |
1208 } | 1208 } |
1209 | 1209 |
1210 const int FileBrowseUI::kPopupWidth = 250; | 1210 const int FileBrowseUI::kPopupWidth = 250; |
1211 const int FileBrowseUI::kPopupHeight = 300; | 1211 const int FileBrowseUI::kPopupHeight = 300; |
1212 const int FileBrowseUI::kSmallPopupWidth = 250; | 1212 const int FileBrowseUI::kSmallPopupWidth = 250; |
1213 const int FileBrowseUI::kSmallPopupHeight = 50; | 1213 const int FileBrowseUI::kSmallPopupHeight = 50; |
OLD | NEW |