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

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

Powered by Google App Engine
This is Rietveld 408576698