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

Unified Diff: base/file_util_proxy.cc

Issue 3282003: Support handling blob URL and resolve blob references in upload data.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: base/file_util_proxy.cc
===================================================================
--- base/file_util_proxy.cc (revision 57912)
+++ base/file_util_proxy.cc (working copy)
@@ -7,6 +7,8 @@
#include "base/file_util.h"
#include "base/message_loop_proxy.h"
+// TODO(jianli): Move the code from anonymous namespace to base namespace so
+// that all of the base:: prefixes would be unnecessary.
namespace {
class MessageLoopRelay
@@ -205,6 +207,33 @@
bool recursive_;
};
+class RelayGetFileInfo : public MessageLoopRelay {
+ public:
+ RelayGetFileInfo(const FilePath& file_path,
+ base::FileUtilProxy::GetFileInfoCallback* callback)
+ : callback_(callback),
+ file_path_(file_path),
+ exists_(false) {
+ DCHECK(callback);
+ }
+
+ protected:
+ virtual void RunWork() {
+ exists_ = file_util::GetFileInfo(file_path_, &file_info_);
+ }
+
+ virtual void RunCallback() {
+ callback_->Run(exists_, file_info_);
+ delete callback_;
+ }
+
+ private:
+ base::FileUtilProxy::GetFileInfoCallback* callback_;
+ FilePath file_path_;
+ bool exists_;
+ file_util::FileInfo file_info_;
+};
+
bool Start(const tracked_objects::Location& from_here,
scoped_refptr<base::MessageLoopProxy> message_loop_proxy,
scoped_refptr<MessageLoopRelay> relay) {
@@ -257,4 +286,13 @@
new RelayDelete(file_path, true, callback));
}
+// static
+bool FileUtilProxy::GetFileInfo(
+ scoped_refptr<MessageLoopProxy> message_loop_proxy,
+ const FilePath& file_path,
+ GetFileInfoCallback* callback) {
+ return Start(FROM_HERE, message_loop_proxy,
+ new RelayGetFileInfo(file_path, callback));
+}
+
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698