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

Unified Diff: chrome/browser/file_select_helper.cc

Issue 5710002: Create base::WorkerPoolJob. Use it for HostResolverImpl and DirectoryLister. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minimize the header dependency. 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/file_select_helper.cc
diff --git a/chrome/browser/file_select_helper.cc b/chrome/browser/file_select_helper.cc
index 4490d339c97b55309c9441b471d572e9bfea46b7..0ed7f3f1e1c60d2deab0640ad07417c154280879 100644
--- a/chrome/browser/file_select_helper.cc
+++ b/chrome/browser/file_select_helper.cc
@@ -10,6 +10,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "net/base/mime_util.h"
+#include "net/base/net_errors.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/render_view_host.h"
@@ -34,12 +35,6 @@ FileSelectHelper::~FileSelectHelper() {
// away so they don't try and call back to us.
if (select_file_dialog_.get())
select_file_dialog_->ListenerDestroyed();
-
- // Stop any pending directory enumeration and prevent a callback.
- if (directory_lister_.get()) {
- directory_lister_->set_delegate(NULL);
- directory_lister_->Cancel();
- }
}
void FileSelectHelper::FileSelected(const FilePath& path,
@@ -86,16 +81,15 @@ void FileSelectHelper::FileSelectionCanceled(void* params) {
}
void FileSelectHelper::DirectorySelected(const FilePath& path) {
- directory_lister_ = new net::DirectoryLister(path,
- true,
- net::DirectoryLister::NO_SORT,
- this);
- if (!directory_lister_->Start())
- FileSelectionCanceled(NULL);
+ directory_lister_.reset(
+ new net::DirectoryLister(path,
+ true,
+ net::DirectoryLister::NO_SORT,
+ this));
+ directory_lister_->Start();
}
-void FileSelectHelper::OnListFile(
- const net::DirectoryLister::DirectoryListerData& data) {
+void FileSelectHelper::OnListFile(const net::DirectoryLister::Data& data) {
// Directory upload only cares about files. This util call just checks
// the flags in the structure; there's no file I/O going on.
if (file_util::FileEnumerator::IsDirectory(data.info))
@@ -108,14 +102,14 @@ void FileSelectHelper::OnListDone(int error) {
if (!render_view_host_)
return;
- if (error) {
+ if (error != net::OK) {
FileSelectionCanceled(NULL);
return;
}
render_view_host_->FilesSelectedInChooser(directory_lister_results_);
render_view_host_ = NULL;
- directory_lister_ = NULL;
+ directory_lister_.reset();
directory_lister_results_.clear();
}

Powered by Google App Engine
This is Rietveld 408576698