diff options
author | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-15 18:49:58 +0000 |
---|---|---|
committer | jianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-15 18:49:58 +0000 |
commit | 6aa4a1c041ca9bd2c3087c3c059a87193b1a82e1 (patch) | |
tree | 8e833c393312e866250077c15bc1d90464fe99d7 /app/os_exchange_data.h | |
parent | 963dfb5a05c5b0e3fa8ed74d803f01cb10fd455e (diff) | |
download | chromium_src-6aa4a1c041ca9bd2c3087c3c059a87193b1a82e1.zip chromium_src-6aa4a1c041ca9bd2c3087c3c059a87193b1a82e1.tar.gz chromium_src-6aa4a1c041ca9bd2c3087c3c059a87193b1a82e1.tar.bz2 |
Support dragging a virtual file out of the browser.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/351029
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/os_exchange_data.h')
-rw-r--r-- | app/os_exchange_data.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/app/os_exchange_data.h b/app/os_exchange_data.h index 7efea43..5677409 100644 --- a/app/os_exchange_data.h +++ b/app/os_exchange_data.h @@ -18,6 +18,8 @@ #endif #include "base/basictypes.h" +#include "base/file_path.h" +#include "base/ref_counted.h" #include "base/scoped_ptr.h" class GURL; @@ -59,6 +61,48 @@ class OSExchangeData { #endif }; + struct DownloadFileInfo; + + // Defines the interface to observe the status of file download. + class DownloadFileObserver : public base::RefCounted<DownloadFileObserver> { + public: + // The caller is responsible to free the DownloadFileInfo objects passed + // in the vector parameter. + virtual void OnDataReady( + int format, + const std::vector<DownloadFileInfo*>& downloads) = 0; + + protected: + friend class base::RefCounted<DownloadFileObserver>; + virtual ~DownloadFileObserver() {} + }; + + // Defines the interface to control how a file is downloaded. + class DownloadFileProvider : + public base::RefCountedThreadSafe<DownloadFileProvider> { + public: + virtual bool Start(DownloadFileObserver* observer, int format) = 0; + virtual void Stop() = 0; + + protected: + friend class base::RefCountedThreadSafe<DownloadFileProvider>; + virtual ~DownloadFileProvider() {} + }; + + // Encapsulates the info about a file to be downloaded. + struct DownloadFileInfo { + FilePath filename; + uint64 size; + scoped_refptr<DownloadFileProvider> downloader; + + DownloadFileInfo(const FilePath& filename, + uint64 size, + DownloadFileProvider* downloader) + : filename(filename), + size(size), + downloader(downloader) {} + }; + // Provider defines the platform specific part of OSExchangeData that // interacts with the native system. class Provider { @@ -91,6 +135,7 @@ class OSExchangeData { virtual bool GetHtml(std::wstring* html, GURL* base_url) const = 0; virtual bool HasFileContents() const = 0; virtual bool HasHtml() const = 0; + virtual void SetDownloadFileInfo(DownloadFileInfo* download) = 0; #endif }; @@ -164,6 +209,9 @@ class OSExchangeData { bool GetFileContents(std::wstring* filename, std::string* file_contents) const; bool GetHtml(std::wstring* html, GURL* base_url) const; + + // Adds a download file with full path (CF_HDROP). + void SetDownloadFileInfo(DownloadFileInfo* download); #endif private: |