Chromium Code Reviews| Index: chrome/browser/extensions/extension_file_browser_private_api.h |
| =================================================================== |
| --- chrome/browser/extensions/extension_file_browser_private_api.h (revision 79991) |
| +++ chrome/browser/extensions/extension_file_browser_private_api.h (working copy) |
| @@ -10,27 +10,64 @@ |
| #include "base/file_path.h" |
| #include "chrome/browser/extensions/extension_function.h" |
| +#include "googleurl/src/url_util.h" |
| #include "webkit/fileapi/file_system_callback_dispatcher.h" |
| -// Implements the Chrome Extension local File API. |
| +// Implements the chrome.fileBrowserPrivate.requestLocalFileSystem method. |
| +class RequestLocalFileSystemFunctionBase : public AsyncExtensionFunction { |
| + protected: |
| + friend class LocalFileSystemCallbackDispatcher; |
| + // AsyncExtensionFunction overrides. |
| + virtual bool RunImpl() OVERRIDE; |
| + void RespondSuccessOnUIThread(const std::string& name, |
| + const FilePath& path, |
| + const std::string& file_url); |
| + void RespondFailedOnUIThread(base::PlatformFileError error_code); |
| + void RequestOnFileThread(const GURL& source_url, const std::string& file_url); |
| +}; |
| + |
| +// Implements the chrome.fileBrowserPrivate.requestLocalFileSystem method. |
| class RequestLocalFileSystemFunction |
| - : public AsyncExtensionFunction { |
| - public: |
| - RequestLocalFileSystemFunction(); |
| + : public RequestLocalFileSystemFunctionBase { |
| + private: |
| + DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.requestLocalFileSystem"); |
| +}; |
| +// Implements the chrome.fileBrowserPrivate.getFileTasks method. |
| +class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction { |
| protected: |
| - virtual ~RequestLocalFileSystemFunction(); |
| + // AsyncExtensionFunction overrides. |
| + virtual bool RunImpl() OVERRIDE; |
| + private: |
| + |
| + DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getFileTasks"); |
| +}; |
| + |
| + |
| +// Implements the chrome.fileBrowserPrivate.executeTask method. |
| +class ExecuteTasksFileBrowserFunction : public AsyncExtensionFunction { |
| + protected: |
| // AsyncExtensionFunction overrides. |
| virtual bool RunImpl() OVERRIDE; |
| private: |
| - friend class LocalFileSystemCallbackDispatcher; |
| - void RespondSuccessOnUIThread(const std::string& name, |
| - const FilePath& path); |
| - void RespondFailedOnUIThread(base::PlatformFileError error_code); |
| + // Converts |origin_file_url| to a url that is safe to be used within the |
| + // context of targeted extension. It does that by replacing soruce extension |
|
ericu
2011/04/02 01:16:05
typo: source
zel
2011/04/06 00:06:33
Done.
|
| + // id within the utl and attaching a hash to the url. The hash is used as |
|
ericu
2011/04/02 01:16:05
typo: url
zel
2011/04/06 00:06:33
Done.
|
| + // MAC here, ensures that generated filesystem: url can be safely used within |
| + // the context of given target extension. |
| + // chrome.fileSystem.resolveFileSystemUrl function handlers will verify the |
| + // hash correctness. Urls generated this way are safe to use by the target |
| + // extension only during the lifetime of the current browser process. |
|
ericu
2011/04/02 01:16:05
It's still not at all clear what the hash is inten
zel
2011/04/06 00:06:33
Done.
|
| + std::string MakeSafeFileUrl(const std::string& origin_file_url, |
| + const std::string& extension_id); |
| - DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.requestLocalFileSystem"); |
| + // Executes context menu tasks for each element of |files_list|. |
| + bool ExecuteContextMenuTasks(const std::string& extension_id, |
| + const std::string& action_id, |
| + ListValue* files_list); |
| + DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.executeTask"); |
| }; |
| #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_ |