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

Side by Side Diff: extensions/browser/api/file_system/file_system_delegate.h

Issue 2934143002: Move chrome.fileSystem implementation to //extensions (Closed)
Patch Set: benwells, test fix Created 3 years, 6 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef EXTENSIONS_BROWSER_API_FILE_SYSTEM_FILE_SYSTEM_DELEGATE_H_
6 #define EXTENSIONS_BROWSER_API_FILE_SYSTEM_FILE_SYSTEM_DELEGATE_H_
7
8 #include <memory>
9 #include <string>
10 #include <vector>
11
12 #include "base/callback_forward.h"
13 #include "base/macros.h"
14 #include "base/memory/ref_counted.h"
15 #include "build/build_config.h"
16 #include "extensions/browser/api/file_system/saved_files_service_delegate.h"
17 #include "extensions/common/api/file_system.h"
18 #include "ui/shell_dialogs/select_file_dialog.h"
19
20 #if defined(OS_CHROMEOS)
21 class UIThreadExtensionFunction;
22 #endif
23
24 namespace base {
25 class FilePath;
26 } // namespace base
27
28 namespace content {
29 class BrowserContext;
30 class RenderFrameHost;
31 class WebContents;
32 } // namespace content
33
34 namespace ui {
35 class SelectFilePolicy;
36 } // namespace ui
37
38 namespace extensions {
39
40 class Extension;
41
42 // Delegate class for embedder-specific file system access.
43 class FileSystemDelegate {
44 public:
45 using ErrorCallback = base::Callback<void(const std::string&)>;
46 using FileSystemCallback =
47 base::Callback<void(const std::string& id, const std::string& path)>;
48 using VolumeListCallback =
49 base::Callback<void(const std::vector<api::file_system::Volume>&)>;
50
51 virtual ~FileSystemDelegate() {}
52
53 virtual base::FilePath GetDefaultDirectory() = 0;
54
55 virtual std::unique_ptr<ui::SelectFilePolicy> CreateSelectFilePolicy(
Devlin 2017/06/14 14:53:22 add function comments
michaelpg 2017/06/21 00:40:08 Done.
56 content::WebContents* web_contents) = 0;
57
58 virtual scoped_refptr<ui::SelectFileDialog> CreateSelectFileDialog(
59 ui::SelectFileDialog::Listener* listener,
60 std::unique_ptr<ui::SelectFilePolicy> policy) = 0;
61
62 virtual void ShowSelectFileDialogForWebContents(
63 scoped_refptr<ui::SelectFileDialog> dialog,
64 content::WebContents* web_contents,
65 ui::SelectFileDialog::Type type,
66 const base::FilePath& default_path,
67 const ui::SelectFileDialog::FileTypeInfo* file_types) = 0;
68
69 virtual void ConfirmSensitiveDirectoryAccess(
70 bool writable,
71 const base::string16& app_name,
72 content::WebContents* web_contents,
73 const base::Closure& on_accept,
74 const base::Closure& on_cancel) = 0;
75
76 // Finds a string describing the accept type. On success, returns true and
77 // populates |description_id|.
78 virtual bool GetDescriptionIdForAcceptType(const std::string& accept_type,
79 int* description_id) = 0;
80
81 #if defined(OS_CHROMEOS)
82 virtual bool IsGrantable(content::BrowserContext* browser_context,
83 content::RenderFrameHost* render_frame_host,
84 const Extension& extension) = 0;
85
86 // Grants or denies an extension's request for access to the named file
87 // system. May prompt the user for consent.
88 virtual void RequestFileSystem(
89 content::BrowserContext* browser_context,
90 scoped_refptr<UIThreadExtensionFunction> requester,
91 const Extension& extension,
92 std::string volume_id,
93 bool writable,
94 const FileSystemCallback& success_callback,
95 const ErrorCallback& error_callback) = 0;
96
97 // Immediately calls VolumeListCallback or ErrorCallback.
98 virtual void GetVolumeList(content::BrowserContext* browser_context,
99 const VolumeListCallback& success_callback,
100 const ErrorCallback& error_callback) = 0;
101 #endif
102
103 virtual std::unique_ptr<file_system_api::SavedFilesServiceDelegate>
104 CreateSavedFilesServiceDelegate(content::BrowserContext* browser_context) = 0;
105 };
106
107 } // namespace extensions
108
109 #endif // EXTENSIONS_BROWSER_API_FILE_SYSTEM_FILE_SYSTEM_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698