diff options
author | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 02:42:36 +0000 |
---|---|---|
committer | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 02:42:36 +0000 |
commit | 8107004fbfe9f7ea4be59f6620273c1206c12f42 (patch) | |
tree | f86046c0bb77f471f60d088626ad291360b356ff /base/file_util_proxy.cc | |
parent | 766f613f1c7022941e2e182543d0208a61210a16 (diff) | |
download | chromium_src-8107004fbfe9f7ea4be59f6620273c1206c12f42.zip chromium_src-8107004fbfe9f7ea4be59f6620273c1206c12f42.tar.gz chromium_src-8107004fbfe9f7ea4be59f6620273c1206c12f42.tar.bz2 |
Support handling blob URL and resolve blob references in upload data.
BUG=none
TEST=unittest
Review URL: http://codereview.chromium.org/3282003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57938 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_proxy.cc')
-rw-r--r-- | base/file_util_proxy.cc | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/base/file_util_proxy.cc b/base/file_util_proxy.cc index b08d4a7..3863b37 100644 --- a/base/file_util_proxy.cc +++ b/base/file_util_proxy.cc @@ -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 @@ class RelayDelete : public RelayWithStatusCallback { 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 @@ bool FileUtilProxy::RecursiveDelete( 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 |