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

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) 2011 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.
17 class RequestLocalFileSystemFunctionBase : public AsyncExtensionFunction {
18 protected:
19 friend class LocalFileSystemCallbackDispatcher;
20 // AsyncExtensionFunction overrides.
21 virtual bool RunImpl() OVERRIDE;
22 void RespondSuccessOnUIThread(const std::string& name,
23 const FilePath& path,
24 const GURL& file_url);
25 void RespondFailedOnUIThread(base::PlatformFileError error_code);
26 void RequestOnFileThread(const GURL& source_url, const GURL& file_url);
27 };
28
29 // Implements the chrome.fileBrowserPrivate.requestLocalFileSystem method.
16 class RequestLocalFileSystemFunction 30 class RequestLocalFileSystemFunction
17 : public AsyncExtensionFunction { 31 : public RequestLocalFileSystemFunctionBase {
18 public: 32 private:
19 RequestLocalFileSystemFunction(); 33 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.requestLocalFileSystem");
34 };
20 35
36 // Implements the chrome.fileBrowserPrivate.getFileTasks method.
37 class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction {
21 protected: 38 protected:
22 virtual ~RequestLocalFileSystemFunction();
23
24 // AsyncExtensionFunction overrides. 39 // AsyncExtensionFunction overrides.
25 virtual bool RunImpl() OVERRIDE; 40 virtual bool RunImpl() OVERRIDE;
26 41
27 private: 42 private:
28 friend class LocalFileSystemCallbackDispatcher;
29 void RespondSuccessOnUIThread(const std::string& name,
30 const FilePath& path);
31 void RespondFailedOnUIThread(base::PlatformFileError error_code);
32 43
33 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.requestLocalFileSystem"); 44 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getFileTasks");
45 };
46
47
48 // Implements the chrome.fileBrowserPrivate.executeTask method.
49 class ExecuteTasksFileBrowserFunction : public AsyncExtensionFunction {
50 protected:
51 // AsyncExtensionFunction overrides.
52 virtual bool RunImpl() OVERRIDE;
53
54 private:
55 // Grants access for local file system element represented by
56 // |origin_file_url| from handler extension identified by
57 // |handler_extension_id|. It also modifies |origin_file_url| to make it
58 // usable within handler extension - replaces origin extension id with
59 // handlers's.
60 bool GrantLocalFileSystemAccess(const GURL& origin_file_url,
61 const std::string& handler_extension_id,
62 GURL* handler_file_url);
63
64 // Executes context menu tasks for each element of |files_list|.
65 bool ExecuteContextMenuTasks(const std::string& handler_extension_id,
66 const std::string& action_id,
67 ListValue* files_list);
68 DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.executeTask");
34 }; 69 };
35 70
36 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_ 71 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698