OLD | NEW |
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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 } // namespace file_system_api | 35 } // namespace file_system_api |
36 | 36 |
37 class FileSystemGetDisplayPathFunction : public ChromeSyncExtensionFunction { | 37 class FileSystemGetDisplayPathFunction : public ChromeSyncExtensionFunction { |
38 public: | 38 public: |
39 DECLARE_EXTENSION_FUNCTION("fileSystem.getDisplayPath", | 39 DECLARE_EXTENSION_FUNCTION("fileSystem.getDisplayPath", |
40 FILESYSTEM_GETDISPLAYPATH) | 40 FILESYSTEM_GETDISPLAYPATH) |
41 | 41 |
42 protected: | 42 protected: |
43 virtual ~FileSystemGetDisplayPathFunction() {} | 43 virtual ~FileSystemGetDisplayPathFunction() {} |
44 virtual bool RunSync() OVERRIDE; | 44 virtual bool RunSync() override; |
45 }; | 45 }; |
46 | 46 |
47 class FileSystemEntryFunction : public ChromeAsyncExtensionFunction { | 47 class FileSystemEntryFunction : public ChromeAsyncExtensionFunction { |
48 protected: | 48 protected: |
49 FileSystemEntryFunction(); | 49 FileSystemEntryFunction(); |
50 | 50 |
51 virtual ~FileSystemEntryFunction() {} | 51 virtual ~FileSystemEntryFunction() {} |
52 | 52 |
53 // This is called when writable file entries are being returned. The function | 53 // This is called when writable file entries are being returned. The function |
54 // will ensure the files exist, creating them if necessary, and also check | 54 // will ensure the files exist, creating them if necessary, and also check |
(...skipping 27 matching lines...) Expand all Loading... |
82 base::DictionaryValue* response_; | 82 base::DictionaryValue* response_; |
83 }; | 83 }; |
84 | 84 |
85 class FileSystemGetWritableEntryFunction : public FileSystemEntryFunction { | 85 class FileSystemGetWritableEntryFunction : public FileSystemEntryFunction { |
86 public: | 86 public: |
87 DECLARE_EXTENSION_FUNCTION("fileSystem.getWritableEntry", | 87 DECLARE_EXTENSION_FUNCTION("fileSystem.getWritableEntry", |
88 FILESYSTEM_GETWRITABLEENTRY) | 88 FILESYSTEM_GETWRITABLEENTRY) |
89 | 89 |
90 protected: | 90 protected: |
91 virtual ~FileSystemGetWritableEntryFunction() {} | 91 virtual ~FileSystemGetWritableEntryFunction() {} |
92 virtual bool RunAsync() OVERRIDE; | 92 virtual bool RunAsync() override; |
93 | 93 |
94 private: | 94 private: |
95 void CheckPermissionAndSendResponse(); | 95 void CheckPermissionAndSendResponse(); |
96 void SetIsDirectoryOnFileThread(); | 96 void SetIsDirectoryOnFileThread(); |
97 | 97 |
98 // The path to the file for which a writable entry has been requested. | 98 // The path to the file for which a writable entry has been requested. |
99 base::FilePath path_; | 99 base::FilePath path_; |
100 }; | 100 }; |
101 | 101 |
102 class FileSystemIsWritableEntryFunction : public ChromeSyncExtensionFunction { | 102 class FileSystemIsWritableEntryFunction : public ChromeSyncExtensionFunction { |
103 public: | 103 public: |
104 DECLARE_EXTENSION_FUNCTION("fileSystem.isWritableEntry", | 104 DECLARE_EXTENSION_FUNCTION("fileSystem.isWritableEntry", |
105 FILESYSTEM_ISWRITABLEENTRY) | 105 FILESYSTEM_ISWRITABLEENTRY) |
106 | 106 |
107 protected: | 107 protected: |
108 virtual ~FileSystemIsWritableEntryFunction() {} | 108 virtual ~FileSystemIsWritableEntryFunction() {} |
109 virtual bool RunSync() OVERRIDE; | 109 virtual bool RunSync() override; |
110 }; | 110 }; |
111 | 111 |
112 class FileSystemChooseEntryFunction : public FileSystemEntryFunction { | 112 class FileSystemChooseEntryFunction : public FileSystemEntryFunction { |
113 public: | 113 public: |
114 // Allow picker UI to be skipped in testing. | 114 // Allow picker UI to be skipped in testing. |
115 static void SkipPickerAndAlwaysSelectPathForTest(base::FilePath* path); | 115 static void SkipPickerAndAlwaysSelectPathForTest(base::FilePath* path); |
116 static void SkipPickerAndAlwaysSelectPathsForTest( | 116 static void SkipPickerAndAlwaysSelectPathsForTest( |
117 std::vector<base::FilePath>* paths); | 117 std::vector<base::FilePath>* paths); |
118 static void SkipPickerAndSelectSuggestedPathForTest(); | 118 static void SkipPickerAndSelectSuggestedPathForTest(); |
119 static void SkipPickerAndAlwaysCancelForTest(); | 119 static void SkipPickerAndAlwaysCancelForTest(); |
(...skipping 19 matching lines...) Expand all Loading... |
139 const AcceptOptions* accepts, | 139 const AcceptOptions* accepts, |
140 const bool* acceptsAllTypes); | 140 const bool* acceptsAllTypes); |
141 static void BuildSuggestion(const std::string* opt_name, | 141 static void BuildSuggestion(const std::string* opt_name, |
142 base::FilePath* suggested_name, | 142 base::FilePath* suggested_name, |
143 base::FilePath::StringType* suggested_extension); | 143 base::FilePath::StringType* suggested_extension); |
144 | 144 |
145 protected: | 145 protected: |
146 class FilePicker; | 146 class FilePicker; |
147 | 147 |
148 virtual ~FileSystemChooseEntryFunction() {} | 148 virtual ~FileSystemChooseEntryFunction() {} |
149 virtual bool RunAsync() OVERRIDE; | 149 virtual bool RunAsync() override; |
150 void ShowPicker(const ui::SelectFileDialog::FileTypeInfo& file_type_info, | 150 void ShowPicker(const ui::SelectFileDialog::FileTypeInfo& file_type_info, |
151 ui::SelectFileDialog::Type picker_type); | 151 ui::SelectFileDialog::Type picker_type); |
152 | 152 |
153 private: | 153 private: |
154 void SetInitialPathOnFileThread(const base::FilePath& suggested_name, | 154 void SetInitialPathOnFileThread(const base::FilePath& suggested_name, |
155 const base::FilePath& previous_path); | 155 const base::FilePath& previous_path); |
156 | 156 |
157 // FilesSelected and FileSelectionCanceled are called by the file picker. | 157 // FilesSelected and FileSelectionCanceled are called by the file picker. |
158 void FilesSelected(const std::vector<base::FilePath>& path); | 158 void FilesSelected(const std::vector<base::FilePath>& path); |
159 void FileSelectionCanceled(); | 159 void FileSelectionCanceled(); |
(...skipping 11 matching lines...) Expand all Loading... |
171 | 171 |
172 base::FilePath initial_path_; | 172 base::FilePath initial_path_; |
173 }; | 173 }; |
174 | 174 |
175 class FileSystemRetainEntryFunction : public ChromeAsyncExtensionFunction { | 175 class FileSystemRetainEntryFunction : public ChromeAsyncExtensionFunction { |
176 public: | 176 public: |
177 DECLARE_EXTENSION_FUNCTION("fileSystem.retainEntry", FILESYSTEM_RETAINENTRY) | 177 DECLARE_EXTENSION_FUNCTION("fileSystem.retainEntry", FILESYSTEM_RETAINENTRY) |
178 | 178 |
179 protected: | 179 protected: |
180 virtual ~FileSystemRetainEntryFunction() {} | 180 virtual ~FileSystemRetainEntryFunction() {} |
181 virtual bool RunAsync() OVERRIDE; | 181 virtual bool RunAsync() override; |
182 | 182 |
183 private: | 183 private: |
184 // Retains the file entry referenced by |entry_id| in apps::SavedFilesService. | 184 // Retains the file entry referenced by |entry_id| in apps::SavedFilesService. |
185 // |entry_id| must refer to an entry in an isolated file system. | 185 // |entry_id| must refer to an entry in an isolated file system. |
186 void RetainFileEntry(const std::string& entry_id); | 186 void RetainFileEntry(const std::string& entry_id); |
187 | 187 |
188 void SetIsDirectoryOnFileThread(); | 188 void SetIsDirectoryOnFileThread(); |
189 | 189 |
190 // Whether the file being retained is a directory. | 190 // Whether the file being retained is a directory. |
191 bool is_directory_; | 191 bool is_directory_; |
192 | 192 |
193 // The path to the file to retain. | 193 // The path to the file to retain. |
194 base::FilePath path_; | 194 base::FilePath path_; |
195 }; | 195 }; |
196 | 196 |
197 class FileSystemIsRestorableFunction : public ChromeSyncExtensionFunction { | 197 class FileSystemIsRestorableFunction : public ChromeSyncExtensionFunction { |
198 public: | 198 public: |
199 DECLARE_EXTENSION_FUNCTION("fileSystem.isRestorable", FILESYSTEM_ISRESTORABLE) | 199 DECLARE_EXTENSION_FUNCTION("fileSystem.isRestorable", FILESYSTEM_ISRESTORABLE) |
200 | 200 |
201 protected: | 201 protected: |
202 virtual ~FileSystemIsRestorableFunction() {} | 202 virtual ~FileSystemIsRestorableFunction() {} |
203 virtual bool RunSync() OVERRIDE; | 203 virtual bool RunSync() override; |
204 }; | 204 }; |
205 | 205 |
206 class FileSystemRestoreEntryFunction : public FileSystemEntryFunction { | 206 class FileSystemRestoreEntryFunction : public FileSystemEntryFunction { |
207 public: | 207 public: |
208 DECLARE_EXTENSION_FUNCTION("fileSystem.restoreEntry", FILESYSTEM_RESTOREENTRY) | 208 DECLARE_EXTENSION_FUNCTION("fileSystem.restoreEntry", FILESYSTEM_RESTOREENTRY) |
209 | 209 |
210 protected: | 210 protected: |
211 virtual ~FileSystemRestoreEntryFunction() {} | 211 virtual ~FileSystemRestoreEntryFunction() {} |
212 virtual bool RunAsync() OVERRIDE; | 212 virtual bool RunAsync() override; |
213 }; | 213 }; |
214 | 214 |
215 class FileSystemObserveDirectoryFunction : public ChromeSyncExtensionFunction { | 215 class FileSystemObserveDirectoryFunction : public ChromeSyncExtensionFunction { |
216 public: | 216 public: |
217 DECLARE_EXTENSION_FUNCTION("fileSystem.observeDirectory", | 217 DECLARE_EXTENSION_FUNCTION("fileSystem.observeDirectory", |
218 FILESYSTEM_OBSERVEDIRECTORY) | 218 FILESYSTEM_OBSERVEDIRECTORY) |
219 | 219 |
220 protected: | 220 protected: |
221 virtual ~FileSystemObserveDirectoryFunction() {} | 221 virtual ~FileSystemObserveDirectoryFunction() {} |
222 virtual bool RunSync() OVERRIDE; | 222 virtual bool RunSync() override; |
223 }; | 223 }; |
224 | 224 |
225 class FileSystemUnobserveEntryFunction : public ChromeSyncExtensionFunction { | 225 class FileSystemUnobserveEntryFunction : public ChromeSyncExtensionFunction { |
226 public: | 226 public: |
227 DECLARE_EXTENSION_FUNCTION("fileSystem.unobserveEntry", | 227 DECLARE_EXTENSION_FUNCTION("fileSystem.unobserveEntry", |
228 FILESYSTEM_UNOBSERVEENTRY) | 228 FILESYSTEM_UNOBSERVEENTRY) |
229 | 229 |
230 protected: | 230 protected: |
231 virtual ~FileSystemUnobserveEntryFunction() {} | 231 virtual ~FileSystemUnobserveEntryFunction() {} |
232 virtual bool RunSync() OVERRIDE; | 232 virtual bool RunSync() override; |
233 }; | 233 }; |
234 | 234 |
235 class FileSystemGetObservedEntriesFunction | 235 class FileSystemGetObservedEntriesFunction |
236 : public ChromeSyncExtensionFunction { | 236 : public ChromeSyncExtensionFunction { |
237 public: | 237 public: |
238 DECLARE_EXTENSION_FUNCTION("fileSystem.getObservedEntries", | 238 DECLARE_EXTENSION_FUNCTION("fileSystem.getObservedEntries", |
239 FILESYSTEM_GETOBSERVEDENTRIES); | 239 FILESYSTEM_GETOBSERVEDENTRIES); |
240 | 240 |
241 protected: | 241 protected: |
242 virtual ~FileSystemGetObservedEntriesFunction() {} | 242 virtual ~FileSystemGetObservedEntriesFunction() {} |
243 virtual bool RunSync() OVERRIDE; | 243 virtual bool RunSync() override; |
244 }; | 244 }; |
245 | 245 |
246 } // namespace extensions | 246 } // namespace extensions |
247 | 247 |
248 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 248 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
OLD | NEW |