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

Side by Side Diff: chrome/browser/extensions/api/file_system/file_system_api.h

Issue 14607023: Add support for persistent file access in apps. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 7 years, 7 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 unified diff | Download patch
OLDNEW
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 7
8 #include "chrome/browser/extensions/extension_function.h" 8 #include "chrome/browser/extensions/extension_function.h"
9 #include "chrome/common/extensions/api/file_system.h" 9 #include "chrome/common/extensions/api/file_system.h"
10 #include "ui/shell_dialogs/select_file_dialog.h" 10 #include "ui/shell_dialogs/select_file_dialog.h"
(...skipping 26 matching lines...) Expand all
37 // the file is not a link. If it succeeds it proceeds to 37 // the file is not a link. If it succeeds it proceeds to
38 // RegisterFileSystemAndSendResponse, otherwise to HandleWritableFileError. 38 // RegisterFileSystemAndSendResponse, otherwise to HandleWritableFileError.
39 void CheckWritableFile(const base::FilePath& path); 39 void CheckWritableFile(const base::FilePath& path);
40 40
41 // This will finish the choose file process. This is either called directly 41 // This will finish the choose file process. This is either called directly
42 // from FileSelected, or from CreateFileIfNecessary. It is called on the UI 42 // from FileSelected, or from CreateFileIfNecessary. It is called on the UI
43 // thread. 43 // thread.
44 void RegisterFileSystemAndSendResponse(const base::FilePath& path, 44 void RegisterFileSystemAndSendResponse(const base::FilePath& path,
45 EntryType entry_type); 45 EntryType entry_type);
46 46
47 // This will finish the choose file process. This is either called directly
48 // from FileSelected, or from CreateFileIfNecessary. It is called on the UI
49 // thread. |id_override| specifies the id to send in the response instead of
50 // the generated id. This can be useful for creating a file entry with an id
51 // matching another file entry, e.g. for restoreEntry.
52 void RegisterFileSystemAndSendResponseWithIdOverride(
53 const base::FilePath& path,
54 EntryType entry_type,
55 const std::string& id_override);
56
47 // called on the UI thread if there is a problem checking a writable file. 57 // called on the UI thread if there is a problem checking a writable file.
48 void HandleWritableFileError(); 58 void HandleWritableFileError();
49 }; 59 };
50 60
51 class FileSystemGetWritableEntryFunction : public FileSystemEntryFunction { 61 class FileSystemGetWritableEntryFunction : public FileSystemEntryFunction {
52 public: 62 public:
53 DECLARE_EXTENSION_FUNCTION("fileSystem.getWritableEntry", 63 DECLARE_EXTENSION_FUNCTION("fileSystem.getWritableEntry",
54 FILESYSTEM_GETWRITABLEENTRY) 64 FILESYSTEM_GETWRITABLEENTRY)
55 65
56 protected: 66 protected:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 void SetInitialPathOnFileThread(const base::FilePath& suggested_name, 118 void SetInitialPathOnFileThread(const base::FilePath& suggested_name,
109 const base::FilePath& previous_path); 119 const base::FilePath& previous_path);
110 120
111 // FileSelected and FileSelectionCanceled are called by the file picker. 121 // FileSelected and FileSelectionCanceled are called by the file picker.
112 void FileSelected(const base::FilePath& path, EntryType entry_type); 122 void FileSelected(const base::FilePath& path, EntryType entry_type);
113 void FileSelectionCanceled(); 123 void FileSelectionCanceled();
114 124
115 base::FilePath initial_path_; 125 base::FilePath initial_path_;
116 }; 126 };
117 127
128 class FileSystemRetainEntryFunction : public SyncExtensionFunction {
129 public:
130 DECLARE_EXTENSION_FUNCTION("fileSystem.retainEntry", FILESYSTEM_RETAINENTRY)
131
132 protected:
133 virtual ~FileSystemRetainEntryFunction() {}
134 virtual bool RunImpl() OVERRIDE;
135
136 private:
137 // Retains the file entry referenced by |entry_id| in apps::SavedFilesService.
138 // |entry_id| must refer to an entry in an isolated file system.
139 bool RetainFileEntry(const std::string& entry_id);
140 };
141
142 class FileSystemIsRestorableFunction : public SyncExtensionFunction {
143 public:
144 DECLARE_EXTENSION_FUNCTION("fileSystem.isRestorable", FILESYSTEM_ISRESTORABLE)
145
146 protected:
147 virtual ~FileSystemIsRestorableFunction() {}
148 virtual bool RunImpl() OVERRIDE;
149 };
150
151 class FileSystemRestoreEntryFunction : public FileSystemEntryFunction {
152 public:
153 DECLARE_EXTENSION_FUNCTION("fileSystem.restoreEntry", FILESYSTEM_RESTOREENTRY)
154
155 protected:
156 virtual ~FileSystemRestoreEntryFunction() {}
157 virtual bool RunImpl() OVERRIDE;
158 };
159
118 } // namespace extensions 160 } // namespace extensions
119 161
120 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ 162 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698