Chromium Code Reviews| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/extensions/extension_function.h" | 9 #include "chrome/browser/extensions/extension_function.h" |
| 10 | 10 |
| 11 namespace extensions { | 11 namespace extensions { |
| 12 | 12 |
| 13 class FileSystemGetDisplayPathFunction : public SyncExtensionFunction { | 13 class FileSystemGetDisplayPathFunction : public SyncExtensionFunction { |
| 14 public: | 14 public: |
| 15 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.getDisplayPath"); | 15 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.getDisplayPath"); |
| 16 | 16 |
| 17 protected: | 17 protected: |
| 18 virtual ~FileSystemGetDisplayPathFunction() {} | 18 virtual ~FileSystemGetDisplayPathFunction() {} |
| 19 virtual bool RunImpl() OVERRIDE; | 19 virtual bool RunImpl() OVERRIDE; |
| 20 }; | 20 }; |
| 21 | 21 |
| 22 class FileSystemGetWritableFileEntryFunction : public AsyncExtensionFunction { | 22 class FileSystemPickerFunction : public AsyncExtensionFunction { |
| 23 protected: | |
| 24 class FilePicker; | |
| 25 | |
| 26 virtual ~FileSystemPickerFunction() {} | |
| 27 bool ShowPicker(const FilePath& suggested_path, bool for_save); | |
| 28 | |
| 29 private: | |
| 30 // FileSelected and FileSelectionCanceled are called by the file picker. | |
| 31 void FileSelected(const FilePath& path, bool for_save); | |
| 32 void FileSelectionCanceled(); | |
| 33 | |
| 34 // CheckWritableFile is called on the FILE thread. This is only called when a | |
|
koz (OOO until 15th September)
2012/06/14 06:18:01
You can probably omit the first two words of this
benwells
2012/06/15 00:45:44
Done.
| |
| 35 // file is being chosen to save. The function will ensure the file exists, | |
| 36 // creating it if necessary, and also check that the file is not a link. | |
| 37 void CheckWritableFile(const FilePath& path); | |
| 38 | |
| 39 // RegisterFileSystemAndSendResponse will finish the process. This is either | |
| 40 // called directly from FileSelected, or from CreateFileIfNecessary. It is | |
| 41 // called on the UI thread. | |
| 42 void RegisterFileSystemAndSendResponse(const FilePath& path, bool for_save); | |
| 43 | |
| 44 // HandleWritableFileError is called on the UI thread if there is a problem | |
| 45 // checking a writable file. | |
| 46 void HandleWritableFileError(); | |
| 47 }; | |
| 48 | |
| 49 class FileSystemGetWritableFileEntryFunction : public FileSystemPickerFunction { | |
| 23 public: | 50 public: |
| 24 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.getWritableFileEntry"); | 51 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.getWritableFileEntry"); |
| 25 | 52 |
| 26 protected: | 53 protected: |
| 27 virtual ~FileSystemGetWritableFileEntryFunction() {} | 54 virtual ~FileSystemGetWritableFileEntryFunction() {} |
| 28 virtual bool RunImpl() OVERRIDE; | 55 virtual bool RunImpl() OVERRIDE; |
| 56 }; | |
| 29 | 57 |
| 30 private: | 58 class FileSystemChooseFileFunction : public FileSystemPickerFunction { |
| 31 class FilePicker; | 59 public: |
| 60 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.chooseFile"); | |
| 32 | 61 |
| 33 void FileSelected(const FilePath& path); | 62 protected: |
| 34 void FileSelectionCanceled(); | 63 virtual ~FileSystemChooseFileFunction() {} |
| 64 virtual bool RunImpl() OVERRIDE; | |
| 35 }; | 65 }; |
| 36 | 66 |
| 37 } // namespace extensions | 67 } // namespace extensions |
| 38 | 68 |
| 39 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 69 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
| OLD | NEW |