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

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 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_

Powered by Google App Engine
This is Rietveld 408576698