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

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: Review feedback 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..2acf23a4f1050edf8f01ba4eeee3f0743d278e1f 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,48 @@ 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();
+
+ // called on the FILE thread. This is only called when a 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);
+
+ // This will finish the choose file 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);
+
+ // 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