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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 public: | 193 public: |
194 DECLARE_EXTENSION_FUNCTION("fileSystem.getWritableEntry", | 194 DECLARE_EXTENSION_FUNCTION("fileSystem.getWritableEntry", |
195 FILESYSTEM_GETWRITABLEENTRY) | 195 FILESYSTEM_GETWRITABLEENTRY) |
196 | 196 |
197 protected: | 197 protected: |
198 ~FileSystemGetWritableEntryFunction() override {} | 198 ~FileSystemGetWritableEntryFunction() override {} |
199 bool RunAsync() override; | 199 bool RunAsync() override; |
200 | 200 |
201 private: | 201 private: |
202 void CheckPermissionAndSendResponse(); | 202 void CheckPermissionAndSendResponse(); |
203 void SetIsDirectoryOnFileThread(); | 203 void SetIsDirectoryAsync(); |
204 | 204 |
205 // The path to the file for which a writable entry has been requested. | 205 // The path to the file for which a writable entry has been requested. |
206 base::FilePath path_; | 206 base::FilePath path_; |
207 }; | 207 }; |
208 | 208 |
209 class FileSystemIsWritableEntryFunction : public UIThreadExtensionFunction { | 209 class FileSystemIsWritableEntryFunction : public UIThreadExtensionFunction { |
210 public: | 210 public: |
211 DECLARE_EXTENSION_FUNCTION("fileSystem.isWritableEntry", | 211 DECLARE_EXTENSION_FUNCTION("fileSystem.isWritableEntry", |
212 FILESYSTEM_ISWRITABLEENTRY) | 212 FILESYSTEM_ISWRITABLEENTRY) |
213 | 213 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 265 |
266 // FilesSelected and FileSelectionCanceled are called by the file picker. | 266 // FilesSelected and FileSelectionCanceled are called by the file picker. |
267 void FilesSelected(const std::vector<base::FilePath>& path); | 267 void FilesSelected(const std::vector<base::FilePath>& path); |
268 void FileSelectionCanceled(); | 268 void FileSelectionCanceled(); |
269 | 269 |
270 // Check if the chosen directory is or is an ancestor of a sensitive | 270 // Check if the chosen directory is or is an ancestor of a sensitive |
271 // directory. If so, show a dialog to confirm that the user wants to open the | 271 // directory. If so, show a dialog to confirm that the user wants to open the |
272 // directory. Calls OnDirectoryAccessConfirmed if the directory isn't | 272 // directory. Calls OnDirectoryAccessConfirmed if the directory isn't |
273 // sensitive or the user chooses to open it. Otherwise, calls | 273 // sensitive or the user chooses to open it. Otherwise, calls |
274 // FileSelectionCanceled. | 274 // FileSelectionCanceled. |
275 void ConfirmDirectoryAccessOnFileThread( | 275 void ConfirmDirectoryAccessAsync(bool non_native_path, |
276 bool non_native_path, | 276 const std::vector<base::FilePath>& paths, |
277 const std::vector<base::FilePath>& paths, | 277 content::WebContents* web_contents); |
278 content::WebContents* web_contents); | |
279 void OnDirectoryAccessConfirmed(const std::vector<base::FilePath>& paths); | 278 void OnDirectoryAccessConfirmed(const std::vector<base::FilePath>& paths); |
280 | 279 |
281 base::FilePath initial_path_; | 280 base::FilePath initial_path_; |
282 }; | 281 }; |
283 | 282 |
284 class FileSystemRetainEntryFunction : public ChromeAsyncExtensionFunction { | 283 class FileSystemRetainEntryFunction : public ChromeAsyncExtensionFunction { |
285 public: | 284 public: |
286 DECLARE_EXTENSION_FUNCTION("fileSystem.retainEntry", FILESYSTEM_RETAINENTRY) | 285 DECLARE_EXTENSION_FUNCTION("fileSystem.retainEntry", FILESYSTEM_RETAINENTRY) |
287 | 286 |
288 protected: | 287 protected: |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 ExtensionFunction::ResponseAction Run() override; | 411 ExtensionFunction::ResponseAction Run() override; |
413 | 412 |
414 private: | 413 private: |
415 ChromeExtensionFunctionDetails chrome_details_; | 414 ChromeExtensionFunctionDetails chrome_details_; |
416 }; | 415 }; |
417 #endif | 416 #endif |
418 | 417 |
419 } // namespace extensions | 418 } // namespace extensions |
420 | 419 |
421 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 420 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
OLD | NEW |