| 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 "chrome/browser/extensions/extension_function.h" | 8 #include "chrome/browser/extensions/extension_function.h" |
| 9 #include "chrome/common/extensions/api/file_system.h" | 9 #include "chrome/common/extensions/api/file_system.h" |
| 10 #include "ui/shell_dialogs/select_file_dialog.h" | 10 #include "ui/shell_dialogs/select_file_dialog.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 protected: | 25 protected: |
| 26 enum EntryType { | 26 enum EntryType { |
| 27 READ_ONLY, | 27 READ_ONLY, |
| 28 WRITABLE | 28 WRITABLE |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 virtual ~FileSystemEntryFunction() {} | 31 virtual ~FileSystemEntryFunction() {} |
| 32 | 32 |
| 33 bool HasFileSystemWritePermission(); | 33 bool HasFileSystemWritePermission(); |
| 34 | 34 |
| 35 // Called on the FILE thread. This is called when a writable file entry is | 35 // This is called when a writable file entry is being returned. The function |
| 36 // being returned. The function will ensure the file exists, creating it if | 36 // will ensure the file exists, creating it if necessary, and also check that |
| 37 // necessary, and also check that the file is not a link. | 37 // the file is not a link. If it succeeds it proceeds to |
| 38 // RegisterFileSystemAndSendResponse, otherwise to HandleWritableFileError. |
| 38 void CheckWritableFile(const base::FilePath& path); | 39 void CheckWritableFile(const base::FilePath& path); |
| 39 | 40 |
| 40 // This will finish the choose file process. This is either called directly | 41 // This will finish the choose file process. This is either called directly |
| 41 // from FileSelected, or from CreateFileIfNecessary. It is called on the UI | 42 // from FileSelected, or from CreateFileIfNecessary. It is called on the UI |
| 42 // thread. | 43 // thread. |
| 43 void RegisterFileSystemAndSendResponse(const base::FilePath& path, | 44 void RegisterFileSystemAndSendResponse(const base::FilePath& path, |
| 44 EntryType entry_type); | 45 EntryType entry_type); |
| 45 | 46 |
| 46 // called on the UI thread if there is a problem checking a writable file. | 47 // called on the UI thread if there is a problem checking a writable file. |
| 47 void HandleWritableFileError(); | 48 void HandleWritableFileError(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 106 |
| 106 private: | 107 private: |
| 107 // FileSelected and FileSelectionCanceled are called by the file picker. | 108 // FileSelected and FileSelectionCanceled are called by the file picker. |
| 108 void FileSelected(const base::FilePath& path, EntryType entry_type); | 109 void FileSelected(const base::FilePath& path, EntryType entry_type); |
| 109 void FileSelectionCanceled(); | 110 void FileSelectionCanceled(); |
| 110 }; | 111 }; |
| 111 | 112 |
| 112 } // namespace extensions | 113 } // namespace extensions |
| 113 | 114 |
| 114 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 115 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
| OLD | NEW |