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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 base::DictionaryValue* response_; | 81 base::DictionaryValue* response_; |
82 }; | 82 }; |
83 | 83 |
84 class FileSystemGetWritableEntryFunction : public FileSystemEntryFunction { | 84 class FileSystemGetWritableEntryFunction : public FileSystemEntryFunction { |
85 public: | 85 public: |
86 DECLARE_EXTENSION_FUNCTION("fileSystem.getWritableEntry", | 86 DECLARE_EXTENSION_FUNCTION("fileSystem.getWritableEntry", |
87 FILESYSTEM_GETWRITABLEENTRY) | 87 FILESYSTEM_GETWRITABLEENTRY) |
88 | 88 |
89 protected: | 89 protected: |
90 virtual ~FileSystemGetWritableEntryFunction() {} | 90 virtual ~FileSystemGetWritableEntryFunction() {} |
91 virtual bool RunImpl() OVERRIDE; | 91 virtual bool RunAsync() OVERRIDE; |
92 | 92 |
93 private: | 93 private: |
94 void CheckPermissionAndSendResponse(); | 94 void CheckPermissionAndSendResponse(); |
95 void SetIsDirectoryOnFileThread(); | 95 void SetIsDirectoryOnFileThread(); |
96 | 96 |
97 // The path to the file for which a writable entry has been requested. | 97 // The path to the file for which a writable entry has been requested. |
98 base::FilePath path_; | 98 base::FilePath path_; |
99 }; | 99 }; |
100 | 100 |
101 class FileSystemIsWritableEntryFunction : public ChromeSyncExtensionFunction { | 101 class FileSystemIsWritableEntryFunction : public ChromeSyncExtensionFunction { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 const AcceptOptions* accepts, | 138 const AcceptOptions* accepts, |
139 const bool* acceptsAllTypes); | 139 const bool* acceptsAllTypes); |
140 static void BuildSuggestion(const std::string* opt_name, | 140 static void BuildSuggestion(const std::string* opt_name, |
141 base::FilePath* suggested_name, | 141 base::FilePath* suggested_name, |
142 base::FilePath::StringType* suggested_extension); | 142 base::FilePath::StringType* suggested_extension); |
143 | 143 |
144 protected: | 144 protected: |
145 class FilePicker; | 145 class FilePicker; |
146 | 146 |
147 virtual ~FileSystemChooseEntryFunction() {} | 147 virtual ~FileSystemChooseEntryFunction() {} |
148 virtual bool RunImpl() OVERRIDE; | 148 virtual bool RunAsync() OVERRIDE; |
149 void ShowPicker(const ui::SelectFileDialog::FileTypeInfo& file_type_info, | 149 void ShowPicker(const ui::SelectFileDialog::FileTypeInfo& file_type_info, |
150 ui::SelectFileDialog::Type picker_type); | 150 ui::SelectFileDialog::Type picker_type); |
151 | 151 |
152 private: | 152 private: |
153 void SetInitialPathOnFileThread(const base::FilePath& suggested_name, | 153 void SetInitialPathOnFileThread(const base::FilePath& suggested_name, |
154 const base::FilePath& previous_path); | 154 const base::FilePath& previous_path); |
155 | 155 |
156 // FilesSelected and FileSelectionCanceled are called by the file picker. | 156 // FilesSelected and FileSelectionCanceled are called by the file picker. |
157 void FilesSelected(const std::vector<base::FilePath>& path); | 157 void FilesSelected(const std::vector<base::FilePath>& path); |
158 void FileSelectionCanceled(); | 158 void FileSelectionCanceled(); |
(...skipping 10 matching lines...) Expand all Loading... |
169 | 169 |
170 base::FilePath initial_path_; | 170 base::FilePath initial_path_; |
171 }; | 171 }; |
172 | 172 |
173 class FileSystemRetainEntryFunction : public ChromeAsyncExtensionFunction { | 173 class FileSystemRetainEntryFunction : public ChromeAsyncExtensionFunction { |
174 public: | 174 public: |
175 DECLARE_EXTENSION_FUNCTION("fileSystem.retainEntry", FILESYSTEM_RETAINENTRY) | 175 DECLARE_EXTENSION_FUNCTION("fileSystem.retainEntry", FILESYSTEM_RETAINENTRY) |
176 | 176 |
177 protected: | 177 protected: |
178 virtual ~FileSystemRetainEntryFunction() {} | 178 virtual ~FileSystemRetainEntryFunction() {} |
179 virtual bool RunImpl() OVERRIDE; | 179 virtual bool RunAsync() OVERRIDE; |
180 | 180 |
181 private: | 181 private: |
182 // Retains the file entry referenced by |entry_id| in apps::SavedFilesService. | 182 // Retains the file entry referenced by |entry_id| in apps::SavedFilesService. |
183 // |entry_id| must refer to an entry in an isolated file system. | 183 // |entry_id| must refer to an entry in an isolated file system. |
184 void RetainFileEntry(const std::string& entry_id); | 184 void RetainFileEntry(const std::string& entry_id); |
185 | 185 |
186 void SetIsDirectoryOnFileThread(); | 186 void SetIsDirectoryOnFileThread(); |
187 | 187 |
188 // Whether the file being retained is a directory. | 188 // Whether the file being retained is a directory. |
189 bool is_directory_; | 189 bool is_directory_; |
(...skipping 10 matching lines...) Expand all Loading... |
200 virtual ~FileSystemIsRestorableFunction() {} | 200 virtual ~FileSystemIsRestorableFunction() {} |
201 virtual bool RunSync() OVERRIDE; | 201 virtual bool RunSync() OVERRIDE; |
202 }; | 202 }; |
203 | 203 |
204 class FileSystemRestoreEntryFunction : public FileSystemEntryFunction { | 204 class FileSystemRestoreEntryFunction : public FileSystemEntryFunction { |
205 public: | 205 public: |
206 DECLARE_EXTENSION_FUNCTION("fileSystem.restoreEntry", FILESYSTEM_RESTOREENTRY) | 206 DECLARE_EXTENSION_FUNCTION("fileSystem.restoreEntry", FILESYSTEM_RESTOREENTRY) |
207 | 207 |
208 protected: | 208 protected: |
209 virtual ~FileSystemRestoreEntryFunction() {} | 209 virtual ~FileSystemRestoreEntryFunction() {} |
210 virtual bool RunImpl() OVERRIDE; | 210 virtual bool RunAsync() OVERRIDE; |
211 }; | 211 }; |
212 | 212 |
213 } // namespace extensions | 213 } // namespace extensions |
214 | 214 |
215 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 215 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
OLD | NEW |