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

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

Issue 985533004: Implement chrome.fileSystem.requestFileSystem(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed. Created 5 years, 9 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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/files/file.h" 11 #include "base/files/file.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "chrome/browser/extensions/chrome_extension_function.h" 13 #include "chrome/browser/extensions/chrome_extension_function.h"
14 #include "chrome/browser/extensions/chrome_extension_function_details.h"
14 #include "chrome/common/extensions/api/file_system.h" 15 #include "chrome/common/extensions/api/file_system.h"
16 #include "extensions/browser/extension_function.h"
15 #include "ui/shell_dialogs/select_file_dialog.h" 17 #include "ui/shell_dialogs/select_file_dialog.h"
16 18
19 namespace storage {
20 class FileSystemContext;
benwells 2015/03/20 00:42:39 Is this used?
mtomasz 2015/03/20 01:56:00 Removed.
21 } // namespace storage
22
17 namespace extensions { 23 namespace extensions {
18 class ExtensionPrefs; 24 class ExtensionPrefs;
19 25
20 namespace file_system_api { 26 namespace file_system_api {
21 27
22 // Methods to get and set the path of the directory containing the last file 28 // Methods to get and set the path of the directory containing the last file
23 // chosen by the user in response to a chrome.fileSystem.chooseEntry() call for 29 // chosen by the user in response to a chrome.fileSystem.chooseEntry() call for
24 // the given extension. 30 // the given extension.
25 31
26 // Returns an empty path on failure. 32 // Returns an empty path on failure.
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 : public ChromeSyncExtensionFunction { 239 : public ChromeSyncExtensionFunction {
234 public: 240 public:
235 DECLARE_EXTENSION_FUNCTION("fileSystem.getObservedEntries", 241 DECLARE_EXTENSION_FUNCTION("fileSystem.getObservedEntries",
236 FILESYSTEM_GETOBSERVEDENTRIES); 242 FILESYSTEM_GETOBSERVEDENTRIES);
237 243
238 protected: 244 protected:
239 ~FileSystemGetObservedEntriesFunction() override {} 245 ~FileSystemGetObservedEntriesFunction() override {}
240 bool RunSync() override; 246 bool RunSync() override;
241 }; 247 };
242 248
249 // Requests a file system for the specified volume id.
250 class FileSystemRequestFileSystemFunction : public UIThreadExtensionFunction {
251 public:
252 DECLARE_EXTENSION_FUNCTION("fileSystem.requestFileSystem",
253 FILESYSTEM_REQUESTFILESYSTEM)
254 FileSystemRequestFileSystemFunction();
255
256 protected:
257 ~FileSystemRequestFileSystemFunction() override {}
258
259 // AsyncExtensionFunction overrides.
260 ExtensionFunction::ResponseAction Run() override;
261
262 private:
263 ChromeExtensionFunctionDetails chrome_details_;
264
265 #if defined(OS_CHROMEOS)
266 // Requests user consent for accessing the volume identified by |name|.
267 void RequestConsent(const std::string& display_name,
268 bool writable,
269 const base::Callback<void(bool)>& callback);
270 // Called when a user grants or rejects permissions for the file system
271 // access.
272 void OnConsentReceived(const std::string& volume_id,
273 bool writable,
274 bool granted);
275 #endif
276 };
277
243 } // namespace extensions 278 } // namespace extensions
244 279
245 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ 280 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698