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

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

Issue 985533004: Implement chrome.fileSystem.requestFileSystem(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaned up. Created 5 years, 9 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 a2f9e4dbd89d98031aacd2016830aadd73eb5d70..761e9af26108be45c46df7c4e1f150dc0446ad6a 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.h
+++ b/chrome/browser/extensions/api/file_system/file_system_api.h
@@ -10,10 +10,17 @@
#include "base/files/file.h"
#include "base/files/file_path.h"
+#include "base/memory/ref_counted.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
+#include "chrome/browser/extensions/chrome_extension_function_details.h"
#include "chrome/common/extensions/api/file_system.h"
+#include "extensions/browser/extension_function.h"
#include "ui/shell_dialogs/select_file_dialog.h"
+namespace storage {
+class FileSystemContext;
+} // namespace storage
+
namespace extensions {
class ExtensionPrefs;
@@ -240,6 +247,34 @@ class FileSystemGetObservedEntriesFunction
bool RunSync() override;
};
+// Requests a file system for the specified volume id.
+class FileSystemRequestFileSystemFunction : public UIThreadExtensionFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION("fileSystem.requestFileSystem",
+ FILESYSTEM_REQUESTFILESYSTEM)
+ FileSystemRequestFileSystemFunction();
+
+ protected:
+ ~FileSystemRequestFileSystemFunction() override {}
+
+ // AsyncExtensionFunction overrides.
+ ExtensionFunction::ResponseAction Run() override;
+
+ private:
+ ChromeExtensionFunctionDetails chrome_details_;
+
+ // Requests user consent for accessing the volume identified by |name|.
+ void RequestConsent(const std::string& display_name,
+ bool writable,
+ const base::Callback<void(bool)>& callback);
+
+ // Called when a user grants or rejects permissions for the file system
+ // access.
+ void OnConsentReceived(const std::string& volume_id,
+ bool writable,
+ bool granted);
+};
+
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_

Powered by Google App Engine
This is Rietveld 408576698