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

Side by Side 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, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "chrome/browser/extensions/extension_function.h" 12 #include "chrome/browser/extensions/extension_function.h"
13 #include "googleurl/src/url_util.h"
13 #include "webkit/fileapi/file_system_callback_dispatcher.h" 14 #include "webkit/fileapi/file_system_callback_dispatcher.h"
14 15
15 // Implements the Chrome Extension local File API. 16 // Implements the chrome.fileBrowserPrivate.requestLocalFileSystem method.
16 class RequestLocalFileSystemFunction 17 class RequestLocalFileSystemFunctionBase : public AsyncExtensionFunction {
17 : public AsyncExtensionFunction { 18 protected:
18 public: 19 // AsyncExtensionFunction overrides.
19 RequestLocalFileSystemFunction(); 20 virtual bool RunImpl() OVERRIDE;
20 21
21 protected: 22 protected:
ericu 2011/03/31 21:31:06 Duplicate label protected.
zel 2011/04/01 03:01:35 Done.
22 virtual ~RequestLocalFileSystemFunction(); 23 friend class LocalFileSystemCallbackDispatcher;
24 void RespondSuccessOnUIThread(const std::string& name,
25 const FilePath& path,
26 const std::string& file_url);
27 void RespondFailedOnUIThread(base::PlatformFileError error_code);
28 void RequestOnFileThread(const GURL& source_url, const std::string& file_url);
29 };
23 30
31 // Implements the chrome.fileBrowserPrivate.requestLocalFileSystem method.
32 class RequestLocalFileSystemFunction
33 : public RequestLocalFileSystemFunctionBase {
34 private:
35 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.requestLocalFileSystem");
36 };
37
38 // Implements the chrome.fileBrowserPrivate.getFileTasks method.
39 class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction {
40 protected:
24 // AsyncExtensionFunction overrides. 41 // AsyncExtensionFunction overrides.
25 virtual bool RunImpl() OVERRIDE; 42 virtual bool RunImpl() OVERRIDE;
26 43
27 private: 44 private:
28 friend class LocalFileSystemCallbackDispatcher;
29 void RespondSuccessOnUIThread(const std::string& name,
30 const FilePath& path);
31 void RespondFailedOnUIThread(base::PlatformFileError error_code);
32 45
33 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.requestLocalFileSystem"); 46 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getFileTasks");
47 };
48
49
50 // Implements the chrome.fileBrowserPrivate.executeTask method.
51 class ExecuteTasksFileBrowserFunction : public AsyncExtensionFunction {
52 protected:
53 // AsyncExtensionFunction overrides.
54 virtual bool RunImpl() OVERRIDE;
55
56 private:
57 // Creates file hash for a given |raw_file_url|. The hash, used as HMAC here,
58 // ensures that generated filesystem: url can be safely used within the
59 // 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
60 std::string MakeFileHash(const std::string& extension_id,
61 const std::string& raw_file_url);
62
63 // Creates file url that is safe to be used within the context of targeted
64 // extension.
65 std::string MakeSafeFileUrl(const std::string& extension_id,
66 const std::string& file_path);
67 // Executes context menu tasks for each element of |files_list|.
68 bool ExecuteContextMenuTasks(const std::string& extension_id,
69 const std::string& action_id,
70 ListValue* files_list);
71 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.executeTask");
34 }; 72 };
35 73
36 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_ 74 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698