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

Unified Diff: chrome/browser/devtools/devtools_file_helper.h

Issue 11570081: Support file system access in DevTools with isolated file system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added fs name / root url generation in browser process as recommended by kinuko@ and addressed tsep… Created 7 years, 11 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
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/devtools/devtools_file_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/devtools/devtools_file_helper.h
diff --git a/chrome/browser/devtools/devtools_file_helper.h b/chrome/browser/devtools/devtools_file_helper.h
index b894a73c0953bba782f4453f7c3564140e4d8e61..42fcb7d46a6c4eeee15092a5f384a7f3ee1b018b 100644
--- a/chrome/browser/devtools/devtools_file_helper.h
+++ b/chrome/browser/devtools/devtools_file_helper.h
@@ -7,6 +7,7 @@
#include <map>
#include <string>
+#include <vector>
#include "base/basictypes.h"
#include "base/callback.h"
@@ -16,13 +17,34 @@
class FilePath;
class Profile;
+namespace content {
+class WebContents;
+}
+
class DevToolsFileHelper {
public:
- explicit DevToolsFileHelper(Profile* profile);
+ struct FileSystem {
+ FileSystem();
+ FileSystem(const std::string& file_system_name,
+ const std::string& root_url,
+ const std::string& file_system_path);
+
+ std::string file_system_name;
+ std::string root_url;
+ std::string file_system_path;
+ };
+
+ DevToolsFileHelper(content::WebContents* web_contents, Profile* profile);
~DevToolsFileHelper();
typedef base::Callback<void(void)> SaveCallback;
typedef base::Callback<void(void)> AppendCallback;
+ typedef base::Callback<
+ void(const std::vector<DevToolsFileHelper::FileSystem>&)>
+ RequestFileSystemsCallback;
+ typedef base::Callback<
+ void(std::string, const DevToolsFileHelper::FileSystem&)>
+ AddFileSystemCallback;
// Saves |content| to the file and associates its path with given |url|.
// If client is calling this method with given |url| for the first time
@@ -40,13 +62,38 @@ class DevToolsFileHelper {
const std::string& content,
const AppendCallback& callback);
+ // Shows select folder dialog.
+ // If user cancels folder selection, passes empty FileSystem struct to
+ // |callback|.
+ // If selected folder contains magic file, grants renderer read/write
+ // permissions, registers isolated file system for it and passes FileSystem
+ // struct to |callback|. Saves file system path to prefs.
+ // If selected folder does not contain magic file, passes error string to
+ // |callback|.
+ void AddFileSystem(const AddFileSystemCallback& callback);
+
+ // Loads file system paths from prefs, grants permissions and registers
+ // isolated file system for those of them that contain magic file and passes
+ // FileSystem structs for registered file systems to |callback|.
+ void RequestFileSystems(const RequestFileSystemsCallback& callback);
+
+ // Removes isolated file system for given |file_system_path|.
+ void RemoveFileSystem(const std::string& file_system_path);
+
private:
void SaveAsFileSelected(const std::string& url,
- const std::string& content,
- const SaveCallback& callback,
- const FilePath& path);
+ const std::string& content,
+ const SaveCallback& callback,
+ const FilePath& path);
void SaveAsFileSelectionCanceled();
+ void InnerAddFileSystem(const AddFileSystemCallback& callback,
+ const FilePath& path);
+ void AddValidatedFileSystem(const AddFileSystemCallback& callback,
+ const std::vector<FilePath>& permitted_paths);
+ void RestoreValidatedFileSystems(const RequestFileSystemsCallback& callback,
+ const std::vector<FilePath>& file_paths);
+ content::WebContents* web_contents_;
Profile* profile_;
base::WeakPtrFactory<DevToolsFileHelper> weak_factory_;
typedef std::map<std::string, FilePath> PathsMap;
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/devtools/devtools_file_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698