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

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: 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.
51 void RegisterFileSystemAndSendResponseWithIdOverride(
52 const base::FilePath& path,
53 EntryType entry_type,
54 const std::string& id_override);
55
47 // called on the UI thread if there is a problem checking a writable file. 56 // called on the UI thread if there is a problem checking a writable file.
48 void HandleWritableFileError(); 57 void HandleWritableFileError();
49 }; 58 };
50 59
51 class FileSystemGetWritableEntryFunction : public FileSystemEntryFunction { 60 class FileSystemGetWritableEntryFunction : public FileSystemEntryFunction {
52 public: 61 public:
53 DECLARE_EXTENSION_FUNCTION("fileSystem.getWritableEntry", 62 DECLARE_EXTENSION_FUNCTION("fileSystem.getWritableEntry",
54 FILESYSTEM_GETWRITABLEENTRY) 63 FILESYSTEM_GETWRITABLEENTRY)
55 64
56 protected: 65 protected:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 void SetInitialPathOnFileThread(const base::FilePath& suggested_name, 117 void SetInitialPathOnFileThread(const base::FilePath& suggested_name,
109 const base::FilePath& previous_path); 118 const base::FilePath& previous_path);
110 119
111 // FileSelected and FileSelectionCanceled are called by the file picker. 120 // FileSelected and FileSelectionCanceled are called by the file picker.
112 void FileSelected(const base::FilePath& path, EntryType entry_type); 121 void FileSelected(const base::FilePath& path, EntryType entry_type);
113 void FileSelectionCanceled(); 122 void FileSelectionCanceled();
114 123
115 base::FilePath initial_path_; 124 base::FilePath initial_path_;
116 }; 125 };
117 126
127 class FileSystemRetainEntryFunction : public SyncExtensionFunction {
128 public:
129 DECLARE_EXTENSION_FUNCTION("fileSystem.retainEntry", FILESYSTEM_RETAINENTRY)
130
131 protected:
132 virtual ~FileSystemRetainEntryFunction() {}
133 virtual bool RunImpl() OVERRIDE;
134
135 private:
136 // Retains the file entry referenced by |entry_id| in apps::SavedFilesService.
137 // |entry_id| must refer to an entry in an isolated file system.
138 bool RetainFileEntry(const std::string& entry_id);
139 };
140
141 class FileSystemIsRestorableFunction : public SyncExtensionFunction {
142 public:
143 DECLARE_EXTENSION_FUNCTION("fileSystem.isRestorable", FILESYSTEM_ISRESTORABLE)
144
145 protected:
146 virtual ~FileSystemIsRestorableFunction() {}
147 virtual bool RunImpl() OVERRIDE;
148 };
149
150 class FileSystemRestoreEntryFunction : public FileSystemEntryFunction {
151 public:
152 DECLARE_EXTENSION_FUNCTION("fileSystem.restoreEntry", FILESYSTEM_RESTOREENTRY)
153
154 protected:
155 virtual ~FileSystemRestoreEntryFunction() {}
156 virtual bool RunImpl() OVERRIDE;
157 };
158
118 } // namespace extensions 159 } // namespace extensions
119 160
120 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ 161 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698