| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_PRIVATE_API
_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_PRIVATE_API
_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_PRIVATE_API
_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_PRIVATE_API
_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.requestLocalFileSystem", | 138 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.requestLocalFileSystem", |
| 139 FILEBROWSERPRIVATE_REQUESTLOCALFILESYSTEM) | 139 FILEBROWSERPRIVATE_REQUESTLOCALFILESYSTEM) |
| 140 | 140 |
| 141 protected: | 141 protected: |
| 142 virtual ~RequestLocalFileSystemFunction() {} | 142 virtual ~RequestLocalFileSystemFunction() {} |
| 143 | 143 |
| 144 // AsyncExtensionFunction overrides. | 144 // AsyncExtensionFunction overrides. |
| 145 virtual bool RunImpl() OVERRIDE; | 145 virtual bool RunImpl() OVERRIDE; |
| 146 | 146 |
| 147 private: | 147 private: |
| 148 class LocalFileSystemCallbackDispatcher; | |
| 149 | |
| 150 void RespondSuccessOnUIThread(const std::string& name, | 148 void RespondSuccessOnUIThread(const std::string& name, |
| 151 const GURL& root_path); | 149 const GURL& root_path); |
| 152 void RespondFailedOnUIThread(base::PlatformFileError error_code); | 150 void RespondFailedOnUIThread(base::PlatformFileError error_code); |
| 151 |
| 152 // Requests to open the file system using |file_system_context| and |
| 153 // |source_url| on the FILE thread. |child_id|, the process ID of the |
| 154 // extension, is used for granting file system access permissions to the |
| 155 // extension. |
| 153 void RequestOnFileThread( | 156 void RequestOnFileThread( |
| 154 scoped_refptr<fileapi::FileSystemContext> file_system_context, | 157 scoped_refptr<fileapi::FileSystemContext> file_system_context, |
| 155 const GURL& source_url, | 158 const GURL& source_url, |
| 156 int child_id); | 159 int child_id); |
| 160 |
| 161 // Part of RequestOnFileThread(). Called when |
| 162 // FileSystemContext::OpenFileSystem() is done successfully. |
| 163 void DidOpenFileSystem( |
| 164 scoped_refptr<fileapi::FileSystemContext> file_system_context, |
| 165 int child_id, |
| 166 scoped_refptr<const extensions::Extension> extension, |
| 167 base::PlatformFileError result, |
| 168 const std::string& name, |
| 169 const GURL& root_path); |
| 170 |
| 171 // Part of RequestOnFileThread(). Called when |
| 172 // FileSystemContext::OpenFileSystem() is done unsuccessfully. |
| 173 void DidFail(base::PlatformFileError error_code); |
| 174 |
| 175 // Sets up file system access permissions to the extension identified by |
| 176 // |child_id|. |
| 177 bool SetupFileSystemAccessPermissions( |
| 178 scoped_refptr<fileapi::FileSystemContext> file_system_context, |
| 179 int child_id, |
| 180 scoped_refptr<const extensions::Extension> extension); |
| 157 }; | 181 }; |
| 158 | 182 |
| 159 // Implements the chrome.fileBrowserPrivate.addFileWatch method. | 183 // Implements the chrome.fileBrowserPrivate.addFileWatch method. |
| 160 class FileWatchBrowserFunctionBase : public AsyncExtensionFunction { | 184 class FileWatchBrowserFunctionBase : public AsyncExtensionFunction { |
| 161 protected: | 185 protected: |
| 162 virtual ~FileWatchBrowserFunctionBase() {} | 186 virtual ~FileWatchBrowserFunctionBase() {} |
| 163 | 187 |
| 164 // Performs a file watch operation (ex. adds or removes a file watch). | 188 // Performs a file watch operation (ex. adds or removes a file watch). |
| 165 virtual void PerformFileWatchOperation( | 189 virtual void PerformFileWatchOperation( |
| 166 const base::FilePath& local_path, | 190 const base::FilePath& local_path, |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 OpenNewWindowFunction(); | 804 OpenNewWindowFunction(); |
| 781 | 805 |
| 782 protected: | 806 protected: |
| 783 virtual ~OpenNewWindowFunction(); | 807 virtual ~OpenNewWindowFunction(); |
| 784 | 808 |
| 785 // AsyncExtensionFunction overrides. | 809 // AsyncExtensionFunction overrides. |
| 786 virtual bool RunImpl() OVERRIDE; | 810 virtual bool RunImpl() OVERRIDE; |
| 787 }; | 811 }; |
| 788 | 812 |
| 789 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_PRIVATE_
API_H_ | 813 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_FILE_BROWSER_PRIVATE_
API_H_ |
| OLD | NEW |