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

Unified Diff: chrome/browser/extensions/extension_file_browser_private_api.h

Issue 6749021: Added new fileBrowserPrivate and fileHandler extension APIs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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: 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_

Powered by Google App Engine
This is Rietveld 408576698