Chromium Code Reviews| Index: chrome/browser/extensions/extension_file_browser_private_api.h |
| =================================================================== |
| --- chrome/browser/extensions/extension_file_browser_private_api.h (revision 79517) |
| +++ chrome/browser/extensions/extension_file_browser_private_api.h (working copy) |
| @@ -10,27 +10,65 @@ |
| #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. |
| -class RequestLocalFileSystemFunction |
| - : public AsyncExtensionFunction { |
| - public: |
| - RequestLocalFileSystemFunction(); |
| - |
| +// Implements the chrome.fileBrowserPrivate.requestLocalFileSystem method. |
| +class RequestLocalFileSystemFunctionBase : public AsyncExtensionFunction { |
| protected: |
| - virtual ~RequestLocalFileSystemFunction(); |
| - |
| // AsyncExtensionFunction overrides. |
| virtual bool RunImpl() OVERRIDE; |
| - private: |
| + protected: |
|
ericu
2011/03/31 21:31:06
Duplicate label protected.
zel
2011/04/01 03:01:35
Done.
|
| friend class LocalFileSystemCallbackDispatcher; |
| void RespondSuccessOnUIThread(const std::string& name, |
| - const FilePath& path); |
| + 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 RequestLocalFileSystemFunctionBase { |
| + private: |
| DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.requestLocalFileSystem"); |
| }; |
| +// Implements the chrome.fileBrowserPrivate.getFileTasks method. |
| +class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction { |
| + protected: |
| + // 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: |
| + // Creates file hash for a given |raw_file_url|. The hash, used as HMAC here, |
| + // ensures that generated filesystem: url can be safely used within the |
| + // context of given extension. |
|
ericu
2011/03/31 21:31:06
How? What is the HMAC intended to validate?
Adam
zel
2011/04/01 03:01:35
I've added Adam and implemented the HMAC at this p
|
| + std::string MakeFileHash(const std::string& extension_id, |
| + const std::string& raw_file_url); |
| + |
| + // Creates file url that is safe to be used within the context of targeted |
| + // extension. |
| + std::string MakeSafeFileUrl(const std::string& extension_id, |
| + const std::string& file_path); |
| + // 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_ |