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

Side by Side Diff: chrome/browser/dom_ui/filebrowse_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/filebrowse_ui.h" 5 #include "chrome/browser/dom_ui/filebrowse_ui.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 task->AddRef(); 415 task->AddRef();
416 BrowserThread::PostTask( 416 BrowserThread::PostTask(
417 BrowserThread::FILE, FROM_HERE, 417 BrowserThread::FILE, FROM_HERE,
418 NewRunnableMethod( 418 NewRunnableMethod(
419 task, &TaskProxy::DeleteFetcher, fetch)); 419 task, &TaskProxy::DeleteFetcher, fetch));
420 } 420 }
421 } 421 }
422 422
423 WebUIMessageHandler* FilebrowseHandler::Attach(DOMUI* dom_ui) { 423 WebUIMessageHandler* FilebrowseHandler::Attach(DOMUI* dom_ui) {
424 // Create our favicon data source. 424 // Create our favicon data source.
425 BrowserThread::PostTask(
426 BrowserThread::IO, FROM_HERE,
427 NewRunnableMethod(
428 ChromeURLDataManager::GetInstance(),
429 &ChromeURLDataManager::AddDataSource,
430 make_scoped_refptr(new WebUIFavIconSource(dom_ui->GetProfile()))));
431 profile_ = dom_ui->GetProfile(); 425 profile_ = dom_ui->GetProfile();
426 profile_->GetChromeURLDataManager()->AddDataSource(
427 new WebUIFavIconSource(profile_));
432 tab_contents_ = dom_ui->tab_contents(); 428 tab_contents_ = dom_ui->tab_contents();
433 return WebUIMessageHandler::Attach(dom_ui); 429 return WebUIMessageHandler::Attach(dom_ui);
434 } 430 }
435 431
436 void FilebrowseHandler::Init() { 432 void FilebrowseHandler::Init() {
437 download_manager_ = profile_->GetDownloadManager(); 433 download_manager_ = profile_->GetDownloadManager();
438 download_manager_->AddObserver(this); 434 download_manager_->AddObserver(this);
439 TaskProxy* task = new TaskProxy(AsWeakPtr(), currentpath_); 435 TaskProxy* task = new TaskProxy(AsWeakPtr(), currentpath_);
440 task->AddRef(); 436 task->AddRef();
441 current_task_ = task; 437 current_task_ = task;
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 // 1128 //
1133 //////////////////////////////////////////////////////////////////////////////// 1129 ////////////////////////////////////////////////////////////////////////////////
1134 1130
1135 FileBrowseUI::FileBrowseUI(TabContents* contents) : HtmlDialogUI(contents) { 1131 FileBrowseUI::FileBrowseUI(TabContents* contents) : HtmlDialogUI(contents) {
1136 FilebrowseHandler* handler = new FilebrowseHandler(); 1132 FilebrowseHandler* handler = new FilebrowseHandler();
1137 AddMessageHandler((handler)->Attach(this)); 1133 AddMessageHandler((handler)->Attach(this));
1138 handler->Init(); 1134 handler->Init();
1139 FileBrowseUIHTMLSource* html_source = new FileBrowseUIHTMLSource(); 1135 FileBrowseUIHTMLSource* html_source = new FileBrowseUIHTMLSource();
1140 1136
1141 // Set up the chrome://filebrowse/ source. 1137 // Set up the chrome://filebrowse/ source.
1142 BrowserThread::PostTask( 1138 contents->profile()->GetChromeURLDataManager()->AddDataSource(html_source);
1143 BrowserThread::IO, FROM_HERE,
1144 NewRunnableMethod(
1145 ChromeURLDataManager::GetInstance(),
1146 &ChromeURLDataManager::AddDataSource,
1147 make_scoped_refptr(html_source)));
1148 } 1139 }
1149 1140
1150 // static 1141 // static
1151 Browser* FileBrowseUI::OpenPopup(Profile* profile, 1142 Browser* FileBrowseUI::OpenPopup(Profile* profile,
1152 const std::string& hashArgument, 1143 const std::string& hashArgument,
1153 int width, 1144 int width,
1154 int height) { 1145 int height) {
1155 // Get existing pop up for given hashArgument. 1146 // Get existing pop up for given hashArgument.
1156 Browser* browser = GetPopupForPath(hashArgument, profile); 1147 Browser* browser = GetPopupForPath(hashArgument, profile);
1157 1148
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 } 1208 }
1218 } 1209 }
1219 1210
1220 return NULL; 1211 return NULL;
1221 } 1212 }
1222 1213
1223 const int FileBrowseUI::kPopupWidth = 250; 1214 const int FileBrowseUI::kPopupWidth = 250;
1224 const int FileBrowseUI::kPopupHeight = 300; 1215 const int FileBrowseUI::kPopupHeight = 300;
1225 const int FileBrowseUI::kSmallPopupWidth = 250; 1216 const int FileBrowseUI::kSmallPopupWidth = 250;
1226 const int FileBrowseUI::kSmallPopupHeight = 50; 1217 const int FileBrowseUI::kSmallPopupHeight = 50;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698