Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Unified Diff: chrome/browser/extensions/api/file_system/file_system_api.h

Issue 10534156: Implement fileSystem.chooseFile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/file_system/file_system_api.h
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.h b/chrome/browser/extensions/api/file_system/file_system_api.h
index 0757736e537cbb46f3c7d8cb5cd99345b5dfe480..d1bd7b5649ebd15b23fad74944c93420b1b940b6 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.h
+++ b/chrome/browser/extensions/api/file_system/file_system_api.h
@@ -19,19 +19,49 @@ class FileSystemGetDisplayPathFunction : public SyncExtensionFunction {
virtual bool RunImpl() OVERRIDE;
};
-class FileSystemGetWritableFileEntryFunction : public AsyncExtensionFunction {
+class FileSystemPickerFunction : public AsyncExtensionFunction {
+ protected:
+ class FilePicker;
+
+ virtual ~FileSystemPickerFunction() {}
+ bool ShowPicker(const FilePath& suggested_path, bool for_save);
+
+ private:
+ // FileSelected and FileSelectionCanceled are called by the file picker.
+ void FileSelected(const FilePath& path, bool for_save);
+ void FileSelectionCanceled();
+
+ // 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.
+ // file is being chosen to save. The function will ensure the file exists,
+ // creating it if necessary, and also check that the file is not a link.
+ void CheckWritableFile(const FilePath& path);
+
+ // RegisterFileSystemAndSendResponse will finish the process. This is either
+ // called directly from FileSelected, or from CreateFileIfNecessary. It is
+ // called on the UI thread.
+ void RegisterFileSystemAndSendResponse(const FilePath& path, bool for_save);
+
+ // HandleWritableFileError is called on the UI thread if there is a problem
+ // checking a writable file.
+ void HandleWritableFileError();
+};
+
+class FileSystemGetWritableFileEntryFunction : public FileSystemPickerFunction {
public:
DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.getWritableFileEntry");
protected:
virtual ~FileSystemGetWritableFileEntryFunction() {}
virtual bool RunImpl() OVERRIDE;
+};
- private:
- class FilePicker;
+class FileSystemChooseFileFunction : public FileSystemPickerFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.chooseFile");
- void FileSelected(const FilePath& path);
- void FileSelectionCanceled();
+ protected:
+ virtual ~FileSystemChooseFileFunction() {}
+ virtual bool RunImpl() OVERRIDE;
};
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698