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