| 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_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "chrome/browser/extensions/chrome_extension_function.h" | 13 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 14 #include "chrome/browser/extensions/chrome_extension_function_details.h" |
| 14 #include "chrome/common/extensions/api/file_system.h" | 15 #include "chrome/common/extensions/api/file_system.h" |
| 16 #include "extensions/browser/extension_function.h" |
| 15 #include "ui/shell_dialogs/select_file_dialog.h" | 17 #include "ui/shell_dialogs/select_file_dialog.h" |
| 16 | 18 |
| 17 namespace extensions { | 19 namespace extensions { |
| 18 class ExtensionPrefs; | 20 class ExtensionPrefs; |
| 19 | 21 |
| 20 namespace file_system_api { | 22 namespace file_system_api { |
| 21 | 23 |
| 22 // Methods to get and set the path of the directory containing the last file | 24 // Methods to get and set the path of the directory containing the last file |
| 23 // chosen by the user in response to a chrome.fileSystem.chooseEntry() call for | 25 // chosen by the user in response to a chrome.fileSystem.chooseEntry() call for |
| 24 // the given extension. | 26 // the given extension. |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 : public ChromeSyncExtensionFunction { | 235 : public ChromeSyncExtensionFunction { |
| 234 public: | 236 public: |
| 235 DECLARE_EXTENSION_FUNCTION("fileSystem.getObservedEntries", | 237 DECLARE_EXTENSION_FUNCTION("fileSystem.getObservedEntries", |
| 236 FILESYSTEM_GETOBSERVEDENTRIES); | 238 FILESYSTEM_GETOBSERVEDENTRIES); |
| 237 | 239 |
| 238 protected: | 240 protected: |
| 239 ~FileSystemGetObservedEntriesFunction() override {} | 241 ~FileSystemGetObservedEntriesFunction() override {} |
| 240 bool RunSync() override; | 242 bool RunSync() override; |
| 241 }; | 243 }; |
| 242 | 244 |
| 245 // Requests a file system for the specified volume id. |
| 246 class FileSystemRequestFileSystemFunction : public UIThreadExtensionFunction { |
| 247 public: |
| 248 DECLARE_EXTENSION_FUNCTION("fileSystem.requestFileSystem", |
| 249 FILESYSTEM_REQUESTFILESYSTEM) |
| 250 FileSystemRequestFileSystemFunction(); |
| 251 |
| 252 protected: |
| 253 ~FileSystemRequestFileSystemFunction() override {} |
| 254 |
| 255 // AsyncExtensionFunction overrides. |
| 256 ExtensionFunction::ResponseAction Run() override; |
| 257 |
| 258 private: |
| 259 ChromeExtensionFunctionDetails chrome_details_; |
| 260 |
| 261 #if defined(OS_CHROMEOS) |
| 262 // Requests user consent for accessing the volume identified by |name|. |
| 263 void RequestConsent(const std::string& display_name, |
| 264 bool writable, |
| 265 const base::Callback<void(bool)>& callback); |
| 266 // Called when a user grants or rejects permissions for the file system |
| 267 // access. |
| 268 void OnConsentReceived(const std::string& volume_id, |
| 269 bool writable, |
| 270 bool granted); |
| 271 #endif |
| 272 }; |
| 273 |
| 243 } // namespace extensions | 274 } // namespace extensions |
| 244 | 275 |
| 245 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 276 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
| OLD | NEW |