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

Unified Diff: chrome/browser/dom_ui/filebrowse_ui.cc

Issue 5710002: Create base::WorkerPoolJob. Use it for HostResolverImpl and DirectoryLister. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/dom_ui/filebrowse_ui.cc
diff --git a/chrome/browser/dom_ui/filebrowse_ui.cc b/chrome/browser/dom_ui/filebrowse_ui.cc
index 41ab3c22ee32ab63d13f36d9f608850579bbfe57..7416ecf80c1ba1dd1ea963d7fc777a05256d17e0 100644
--- a/chrome/browser/dom_ui/filebrowse_ui.cc
+++ b/chrome/browser/dom_ui/filebrowse_ui.cc
@@ -93,7 +93,7 @@ class FileBrowseUIHTMLSource : public ChromeURLDataManager::DataSource {
class TaskProxy;
// The handler for Javascript messages related to the "filebrowse" view.
-class FilebrowseHandler : public net::DirectoryLister::DirectoryListerDelegate,
+class FilebrowseHandler : public net::DirectoryLister::Delegate,
public DOMMessageHandler,
#if defined(OS_CHROMEOS)
public chromeos::MountLibrary::Observer,
@@ -109,9 +109,8 @@ class FilebrowseHandler : public net::DirectoryLister::DirectoryListerDelegate,
// Init work after Attach.
void Init();
- // DirectoryLister::DirectoryListerDelegate methods:
- virtual void OnListFile(
- const net::DirectoryLister::DirectoryListerData& data);
+ // DirectoryLister::Delegate methods:
+ virtual void OnListFile(const net::DirectoryLister::Data& data);
virtual void OnListDone(int error);
// DOMMessageHandler implementation.
@@ -214,7 +213,7 @@ class FilebrowseHandler : public net::DirectoryLister::DirectoryListerDelegate,
std::string current_file_uploaded_;
int upload_response_code_;
TaskProxy* current_task_;
- scoped_refptr<net::DirectoryLister> lister_;
+ scoped_ptr<net::DirectoryLister> lister_;
bool is_refresh_;
scoped_ptr<URLFetcher> fetch_;
@@ -385,7 +384,6 @@ FilebrowseHandler::FilebrowseHandler()
fetch_(NULL),
download_manager_(NULL),
got_first_download_list_(false) {
- lister_ = NULL;
#if defined(OS_CHROMEOS)
chromeos::MountLibrary* lib =
chromeos::CrosLibrary::Get()->GetMountLibrary();
@@ -399,10 +397,6 @@ FilebrowseHandler::~FilebrowseHandler() {
chromeos::CrosLibrary::Get()->GetMountLibrary();
lib->RemoveObserver(this);
#endif
- if (lister_.get()) {
- lister_->Cancel();
- lister_->set_delegate(NULL);
- }
ClearDownloadItems();
download_manager_->RemoveObserver(this);
@@ -813,12 +807,7 @@ void FilebrowseHandler::GetChildrenForPath(FilePath& path, bool is_refresh) {
filelist_value_.reset(new ListValue());
currentpath_ = path;
- if (lister_.get()) {
- lister_->Cancel();
- lister_->set_delegate(NULL);
- lister_ = NULL;
- }
-
+ lister_.reset();
is_refresh_ = is_refresh;
#if defined(OS_CHROMEOS)
@@ -833,12 +822,12 @@ void FilebrowseHandler::GetChildrenForPath(FilePath& path, bool is_refresh) {
NOTREACHED();
}
if (currentpath_ == default_download_path) {
- lister_ = new net::DirectoryLister(currentpath_,
- false,
- net::DirectoryLister::DATE,
- this);
+ lister_.reset(new net::DirectoryLister(currentpath_,
+ false,
+ net::DirectoryLister::DATE,
+ this));
} else {
- lister_ = new net::DirectoryLister(currentpath_, this);
+ lister_.reset(new net::DirectoryLister(currentpath_, this));
}
lister_->Start();
}
@@ -853,8 +842,7 @@ void FilebrowseHandler::HandleGetChildren(const ListValue* args) {
#endif
}
-void FilebrowseHandler::OnListFile(
- const net::DirectoryLister::DirectoryListerData& data) {
+void FilebrowseHandler::OnListFile(const net::DirectoryLister::Data& data) {
#if defined(OS_WIN)
if (data.info.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) {
return;

Powered by Google App Engine
This is Rietveld 408576698