[go: nahoru, domu]

blob: 52703b956d44d43f856290b7e5bd048134508bae [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2013 The Chromium Authors
satorux@chromium.orgd708ef62013-08-02 05:10:452// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4//
5// This file provides miscellaneous API functions, which don't belong to
6// other files.
7
Henrique Ferreirod67f0472022-11-05 00:40:098#ifndef CHROME_BROWSER_ASH_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_
9#define CHROME_BROWSER_ASH_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_
satorux@chromium.orgd708ef62013-08-02 05:10:4510
Shuhei Takahashi30458d6c2017-08-15 03:46:1011#include <memory>
tbarzica8f25a02015-05-08 01:39:5512#include <string>
Shuhei Takahashi30458d6c2017-08-15 03:46:1013#include <vector>
tbarzica8f25a02015-05-08 01:39:5514
mtomaszd306ff2e2015-04-21 12:00:3615#include "base/files/file.h"
François Degrosbfeae0a2021-05-27 02:33:0316#include "base/files/file_path.h"
Henrique Ferreirod67f0472022-11-05 00:40:0917#include "chrome/browser/ash/extensions/file_manager/logged_extension_function.h"
Yeunjoo Choi627505b72021-05-13 15:56:3118#include "chrome/browser/ash/file_system_provider/provided_file_system_interface.h"
Shuhei Takahashi0c37678e2017-08-23 10:00:1019#include "chrome/common/extensions/api/file_manager_private.h"
DongJun Kimfebb3c22019-10-21 02:08:0620#include "storage/browser/file_system/file_system_url.h"
yoshiki@chromium.orgd7c5f14d2013-09-09 11:25:2521
Yeunjoo Choi3d9ed38a2022-11-10 02:51:2422namespace ash {
Shuhei Takahashi11eb9b4f2017-08-30 07:09:2123class RecentFile;
Yeunjoo Choi3d9ed38a2022-11-10 02:51:2424}
Shuhei Takahashi11eb9b4f2017-08-30 07:09:2125
Joel Hockeyf7f84ea2018-05-10 02:26:4526namespace crostini {
Renee Wrightf09c5b72018-10-15 03:08:2327enum class CrostiniResult;
Timothy Loh3358dab2018-10-23 01:12:2328struct LinuxPackageInfo;
Jiaming Cheng78c5c732021-07-12 22:48:3229} // namespace crostini
Joel Hockeyf7f84ea2018-05-10 02:26:4530
Solomon Kinardccce03e72023-12-19 22:10:4031namespace file_manager::util {
Shuhei Takahashi30458d6c2017-08-15 03:46:1032struct EntryDefinition;
Solomon Kinardccce03e72023-12-19 22:10:4033using EntryDefinitionList = std::vector<EntryDefinition>;
34} // namespace file_manager::util
Shuhei Takahashi30458d6c2017-08-15 03:46:1035
hirono@chromium.orgce12f3c2013-08-30 02:43:1136namespace extensions {
satorux@chromium.orgd708ef62013-08-02 05:10:4537
Satoru Takabayashi74e7c1c2014-09-10 04:20:2438// Implements the chrome.fileManagerPrivate.getPreferences method.
yamaguchi8248bc02017-01-30 02:02:2539// Gets settings for the Files app.
Clark DuVallfd4db3d2019-07-30 19:10:4340class FileManagerPrivateGetPreferencesFunction : public ExtensionFunction {
satorux@chromium.orgd708ef62013-08-02 05:10:4541 public:
Satoru Takabayashi74e7c1c2014-09-10 04:20:2442 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getPreferences",
43 FILEMANAGERPRIVATE_GETPREFERENCES)
satorux@chromium.orgd708ef62013-08-02 05:10:4544
satorux@chromium.orgd708ef62013-08-02 05:10:4545 protected:
Stuart Langley9441fc02018-06-19 19:01:0746 ~FileManagerPrivateGetPreferencesFunction() override = default;
satorux@chromium.orgd708ef62013-08-02 05:10:4547
rdevlin.cronin7c1cf9882016-09-14 18:18:4048 ResponseAction Run() override;
satorux@chromium.orgd708ef62013-08-02 05:10:4549};
50
Satoru Takabayashi74e7c1c2014-09-10 04:20:2451// Implements the chrome.fileManagerPrivate.setPreferences method.
yamaguchi8248bc02017-01-30 02:02:2552// Sets settings for the Files app.
Clark DuVallfd4db3d2019-07-30 19:10:4353class FileManagerPrivateSetPreferencesFunction : public ExtensionFunction {
satorux@chromium.orgd708ef62013-08-02 05:10:4554 public:
Satoru Takabayashi74e7c1c2014-09-10 04:20:2455 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.setPreferences",
56 FILEMANAGERPRIVATE_SETPREFERENCES)
satorux@chromium.orgd708ef62013-08-02 05:10:4557
satorux@chromium.orgd708ef62013-08-02 05:10:4558 protected:
Stuart Langley9441fc02018-06-19 19:01:0759 ~FileManagerPrivateSetPreferencesFunction() override = default;
satorux@chromium.orgd708ef62013-08-02 05:10:4560
rdevlin.cronin7c1cf9882016-09-14 18:18:4061 ResponseAction Run() override;
satorux@chromium.orgd708ef62013-08-02 05:10:4562};
63
Satoru Takabayashi74e7c1c2014-09-10 04:20:2464// Implements the chrome.fileManagerPrivate.zoom method.
rdevlin.cronin17f40942016-08-17 15:27:4365// Changes the zoom level of the file manager by modifying the zoom level of the
66// WebContents.
67// TODO(hirono): Remove this function once the zoom level change is supported
68// for all apps. crbug.com/227175.
Clark DuVallfd4db3d2019-07-30 19:10:4369class FileManagerPrivateZoomFunction : public ExtensionFunction {
satorux@chromium.orgd708ef62013-08-02 05:10:4570 public:
Nico Weber6e0f7aa2019-02-11 03:07:4371 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.zoom", FILEMANAGERPRIVATE_ZOOM)
satorux@chromium.orgd708ef62013-08-02 05:10:4572
satorux@chromium.orgd708ef62013-08-02 05:10:4573 protected:
Stuart Langley9441fc02018-06-19 19:01:0774 ~FileManagerPrivateZoomFunction() override = default;
hirono@chromium.orgfaca74c2013-09-11 17:08:4175
rdevlin.cronin7c1cf9882016-09-14 18:18:4076 // ExtensionFunction:
77 ResponseAction Run() override;
satorux@chromium.orgd708ef62013-08-02 05:10:4578};
79
Clark DuVallfd4db3d2019-07-30 19:10:4380class FileManagerPrivateGetProfilesFunction : public ExtensionFunction {
hirono@chromium.org512273352014-01-27 05:14:5581 public:
Satoru Takabayashi74e7c1c2014-09-10 04:20:2482 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getProfiles",
Nico Weber6e0f7aa2019-02-11 03:07:4383 FILEMANAGERPRIVATE_GETPROFILES)
hirono@chromium.org512273352014-01-27 05:14:5584
85 protected:
Stuart Langley9441fc02018-06-19 19:01:0786 ~FileManagerPrivateGetProfilesFunction() override = default;
hirono@chromium.org512273352014-01-27 05:14:5587
rdevlin.cronin7c1cf9882016-09-14 18:18:4088 // ExtensionFunction:
89 ResponseAction Run() override;
hirono@chromium.org512273352014-01-27 05:14:5590};
91
Satoru Takabayashi74e7c1c2014-09-10 04:20:2492// Implements the chrome.fileManagerPrivate.openInspector method.
Clark DuVallfd4db3d2019-07-30 19:10:4393class FileManagerPrivateOpenInspectorFunction : public ExtensionFunction {
fukino@chromium.org3ff66cc2014-05-27 08:25:5594 public:
Satoru Takabayashi74e7c1c2014-09-10 04:20:2495 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.openInspector",
Nico Weber6e0f7aa2019-02-11 03:07:4396 FILEMANAGERPRIVATE_OPENINSPECTOR)
fukino@chromium.org3ff66cc2014-05-27 08:25:5597
98 protected:
Stuart Langley9441fc02018-06-19 19:01:0799 ~FileManagerPrivateOpenInspectorFunction() override = default;
fukino@chromium.org3ff66cc2014-05-27 08:25:55100
rdevlin.cronin7c1cf9882016-09-14 18:18:40101 ResponseAction Run() override;
fukino@chromium.org3ff66cc2014-05-27 08:25:55102};
103
Alexey Baskakov6bbcab82018-04-10 05:55:33104// Implements the chrome.fileManagerPrivate.openSettingsSubpage method.
Clark DuVallfd4db3d2019-07-30 19:10:43105class FileManagerPrivateOpenSettingsSubpageFunction : public ExtensionFunction {
Alexey Baskakov6bbcab82018-04-10 05:55:33106 public:
107 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.openSettingsSubpage",
Nico Weber6e0f7aa2019-02-11 03:07:43108 FILEMANAGERPRIVATE_OPENSETTINGSSUBPAGE)
Alexey Baskakov6bbcab82018-04-10 05:55:33109
110 protected:
Stuart Langley9441fc02018-06-19 19:01:07111 ~FileManagerPrivateOpenSettingsSubpageFunction() override = default;
Alexey Baskakov6bbcab82018-04-10 05:55:33112
113 ResponseAction Run() override;
114};
115
yawano057e4952015-01-08 12:56:58116// Implements the chrome.fileManagerPrivate.getMimeType method.
Austin Tankiangd48e8db2024-02-13 09:15:09117class FileManagerPrivateGetMimeTypeFunction : public LoggedExtensionFunction {
yawano057e4952015-01-08 12:56:58118 public:
Austin Tankiangd48e8db2024-02-13 09:15:09119 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getMimeType",
mtomasz9b275eb2015-07-14 06:25:22120 FILEMANAGERPRIVATEINTERNAL_GETMIMETYPE)
yawano057e4952015-01-08 12:56:58121
Austin Tankiangd48e8db2024-02-13 09:15:09122 FileManagerPrivateGetMimeTypeFunction();
yawano057e4952015-01-08 12:56:58123
124 protected:
Austin Tankiangd48e8db2024-02-13 09:15:09125 ~FileManagerPrivateGetMimeTypeFunction() override;
yawano057e4952015-01-08 12:56:58126
Anand K. Mistry7055ce942019-02-22 05:52:47127 // ExtensionFunction overrides.
128 ResponseAction Run() override;
yawano057e4952015-01-08 12:56:58129
130 void OnGetMimeType(const std::string& mimeType);
131};
132
Tomasz Mikolajewskif631ba62017-12-08 07:03:37133// Implements the chrome.fileManagerPrivate.getProviders method.
Clark DuVallfd4db3d2019-07-30 19:10:43134class FileManagerPrivateGetProvidersFunction : public ExtensionFunction {
mtomasz6cac9ef2015-04-16 04:57:24135 public:
Tomasz Mikolajewskif631ba62017-12-08 07:03:37136 FileManagerPrivateGetProvidersFunction();
137 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getProviders",
138 FILEMANAGERPRIVATE_GETPROVIDERS)
Bo Majewskif7507612020-09-14 04:08:49139
140 FileManagerPrivateGetProvidersFunction(
141 const FileManagerPrivateGetProvidersFunction&) = delete;
142 FileManagerPrivateGetProvidersFunction& operator=(
143 const FileManagerPrivateGetProvidersFunction&) = delete;
144
mtomasz6cac9ef2015-04-16 04:57:24145 protected:
Stuart Langley9441fc02018-06-19 19:01:07146 ~FileManagerPrivateGetProvidersFunction() override = default;
mtomasz6cac9ef2015-04-16 04:57:24147
148 private:
149 ResponseAction Run() override;
mtomasz6cac9ef2015-04-16 04:57:24150};
mtomasza4b13512015-04-20 13:51:54151
152// Implements the chrome.fileManagerPrivate.addProvidedFileSystem method.
153class FileManagerPrivateAddProvidedFileSystemFunction
Clark DuVallfd4db3d2019-07-30 19:10:43154 : public ExtensionFunction {
mtomasza4b13512015-04-20 13:51:54155 public:
156 FileManagerPrivateAddProvidedFileSystemFunction();
157 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.addProvidedFileSystem",
158 FILEMANAGERPRIVATE_ADDPROVIDEDFILESYSTEM)
Bo Majewskif7507612020-09-14 04:08:49159
160 FileManagerPrivateAddProvidedFileSystemFunction(
161 const FileManagerPrivateAddProvidedFileSystemFunction&) = delete;
162 FileManagerPrivateAddProvidedFileSystemFunction& operator=(
163 const FileManagerPrivateAddProvidedFileSystemFunction&) = delete;
164
mtomasza4b13512015-04-20 13:51:54165 protected:
Stuart Langley9441fc02018-06-19 19:01:07166 ~FileManagerPrivateAddProvidedFileSystemFunction() override = default;
mtomasza4b13512015-04-20 13:51:54167
168 private:
169 ResponseAction Run() override;
mtomasza4b13512015-04-20 13:51:54170};
171
mtomasz663f86d02015-05-16 09:49:20172// Implements the chrome.fileManagerPrivate.configureVolume method.
173class FileManagerPrivateConfigureVolumeFunction
Clark DuVallfd4db3d2019-07-30 19:10:43174 : public LoggedExtensionFunction {
mtomaszd306ff2e2015-04-21 12:00:36175 public:
mtomasz663f86d02015-05-16 09:49:20176 FileManagerPrivateConfigureVolumeFunction();
177 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.configureVolume",
178 FILEMANAGERPRIVATE_CONFIGUREVOLUME)
Bo Majewskif7507612020-09-14 04:08:49179
180 FileManagerPrivateConfigureVolumeFunction(
181 const FileManagerPrivateConfigureVolumeFunction&) = delete;
182 FileManagerPrivateConfigureVolumeFunction& operator=(
183 const FileManagerPrivateConfigureVolumeFunction&) = delete;
184
mtomaszd306ff2e2015-04-21 12:00:36185 protected:
Stuart Langley9441fc02018-06-19 19:01:07186 ~FileManagerPrivateConfigureVolumeFunction() override = default;
mtomaszd306ff2e2015-04-21 12:00:36187
188 private:
189 ResponseAction Run() override;
190 void OnCompleted(base::File::Error result);
mtomaszd306ff2e2015-04-21 12:00:36191};
192
Joel Hockey5529d272018-09-13 01:53:18193// Implements the chrome.fileManagerPrivate.mountCrostini method.
Joel Hockey37fa72b2018-05-09 05:34:52194// Starts and mounts crostini container.
Clark DuVallfd4db3d2019-07-30 19:10:43195class FileManagerPrivateMountCrostiniFunction : public LoggedExtensionFunction {
Joel Hockey37fa72b2018-05-09 05:34:52196 public:
Joel Hockey5529d272018-09-13 01:53:18197 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.mountCrostini",
198 FILEMANAGERPRIVATE_MOUNTCROSTINI)
199 FileManagerPrivateMountCrostiniFunction();
Joel Hockey37fa72b2018-05-09 05:34:52200
Bo Majewskif7507612020-09-14 04:08:49201 FileManagerPrivateMountCrostiniFunction(
202 const FileManagerPrivateMountCrostiniFunction&) = delete;
203 FileManagerPrivateMountCrostiniFunction& operator=(
204 const FileManagerPrivateMountCrostiniFunction&) = delete;
205
Joel Hockey37fa72b2018-05-09 05:34:52206 protected:
Joel Hockey5529d272018-09-13 01:53:18207 ~FileManagerPrivateMountCrostiniFunction() override;
Joel Hockey37fa72b2018-05-09 05:34:52208
Anand K. Mistry7055ce942019-02-22 05:52:47209 ResponseAction Run() override;
Renee Wrightf09c5b72018-10-15 03:08:23210 void RestartCallback(crostini::CrostiniResult);
David Munro828ce0e2021-05-03 22:10:54211 void MountCallback(crostini::CrostiniResult);
Joel Hockey37fa72b2018-05-09 05:34:52212};
213
Julian Watson03cfb022019-07-31 12:49:37214// Implements the chrome.fileManagerPrivate.importCrostiniImage method.
215// Starts importing the crostini .tini image.
216class FileManagerPrivateInternalImportCrostiniImageFunction
217 : public LoggedExtensionFunction {
218 public:
219 DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.importCrostiniImage",
220 FILEMANAGERPRIVATEINTERNAL_IMPORTCROSTINIIMAGE)
221 FileManagerPrivateInternalImportCrostiniImageFunction();
222
Bo Majewskif7507612020-09-14 04:08:49223 FileManagerPrivateInternalImportCrostiniImageFunction(
224 const FileManagerPrivateInternalImportCrostiniImageFunction&) = delete;
225 FileManagerPrivateInternalImportCrostiniImageFunction& operator=(
226 const FileManagerPrivateInternalImportCrostiniImageFunction&) = delete;
227
Julian Watson03cfb022019-07-31 12:49:37228 protected:
229 ~FileManagerPrivateInternalImportCrostiniImageFunction() override;
230
231 private:
232 ResponseAction Run() override;
233
234 std::string image_path_;
Julian Watson03cfb022019-07-31 12:49:37235};
236
Joel Hockey7606b46e2018-10-24 07:00:21237// Implements the chrome.fileManagerPrivate.sharePathsWithCrostini
238// method. Shares specified paths.
239class FileManagerPrivateInternalSharePathsWithCrostiniFunction
Clark DuVallfd4db3d2019-07-30 19:10:43240 : public LoggedExtensionFunction {
Joel Hockeyff5b5b82018-09-03 08:54:05241 public:
Joel Hockey7606b46e2018-10-24 07:00:21242 DECLARE_EXTENSION_FUNCTION(
243 "fileManagerPrivateInternal.sharePathsWithCrostini",
244 FILEMANAGERPRIVATEINTERNAL_SHAREPATHSWITHCROSTINI)
245 FileManagerPrivateInternalSharePathsWithCrostiniFunction() = default;
Joel Hockeyff5b5b82018-09-03 08:54:05246
Bo Majewskif7507612020-09-14 04:08:49247 FileManagerPrivateInternalSharePathsWithCrostiniFunction(
248 const FileManagerPrivateInternalSharePathsWithCrostiniFunction&) = delete;
249 FileManagerPrivateInternalSharePathsWithCrostiniFunction& operator=(
250 const FileManagerPrivateInternalSharePathsWithCrostiniFunction&) = delete;
251
Joel Hockeyff5b5b82018-09-03 08:54:05252 protected:
Joel Hockey7606b46e2018-10-24 07:00:21253 ~FileManagerPrivateInternalSharePathsWithCrostiniFunction() override =
254 default;
Joel Hockeyff5b5b82018-09-03 08:54:05255
256 private:
257 ResponseAction Run() override;
Joel Hockey0eeace52019-08-16 03:30:03258 void SharePathsCallback(bool success, const std::string& failure_reason);
Joel Hockeydee2de12018-09-18 21:41:52259};
260
Joel Hockey71a4de02018-11-30 04:09:16261// Implements the chrome.fileManagerPrivate.unsharePathWithCrostini
262// method. Unshares specified path.
263class FileManagerPrivateInternalUnsharePathWithCrostiniFunction
Clark DuVallfd4db3d2019-07-30 19:10:43264 : public LoggedExtensionFunction {
Joel Hockey71a4de02018-11-30 04:09:16265 public:
266 DECLARE_EXTENSION_FUNCTION(
267 "fileManagerPrivateInternal.unsharePathWithCrostini",
268 FILEMANAGERPRIVATEINTERNAL_UNSHAREPATHWITHCROSTINI)
269 FileManagerPrivateInternalUnsharePathWithCrostiniFunction() = default;
270
Bo Majewskif7507612020-09-14 04:08:49271 FileManagerPrivateInternalUnsharePathWithCrostiniFunction(
272 const FileManagerPrivateInternalUnsharePathWithCrostiniFunction&) =
273 delete;
274 FileManagerPrivateInternalUnsharePathWithCrostiniFunction& operator=(
275 const FileManagerPrivateInternalUnsharePathWithCrostiniFunction&) =
276 delete;
277
Joel Hockey71a4de02018-11-30 04:09:16278 protected:
279 ~FileManagerPrivateInternalUnsharePathWithCrostiniFunction() override =
280 default;
281
282 private:
283 ResponseAction Run() override;
Joel Hockey0eeace52019-08-16 03:30:03284 void UnsharePathCallback(bool success, const std::string& failure_reason);
Joel Hockey71a4de02018-11-30 04:09:16285};
286
Joel Hockeydee2de12018-09-18 21:41:52287// Implements the chrome.fileManagerPrivate.getCrostiniSharedPaths
288// method. Returns list of file entries.
289class FileManagerPrivateInternalGetCrostiniSharedPathsFunction
Bo Majewski7d6302e2021-07-01 05:54:36290 : public ExtensionFunction {
Joel Hockeydee2de12018-09-18 21:41:52291 public:
292 DECLARE_EXTENSION_FUNCTION(
293 "fileManagerPrivateInternal.getCrostiniSharedPaths",
294 FILEMANAGERPRIVATEINTERNAL_GETCROSTINISHAREDPATHS)
295 FileManagerPrivateInternalGetCrostiniSharedPathsFunction() = default;
296
Bo Majewskif7507612020-09-14 04:08:49297 FileManagerPrivateInternalGetCrostiniSharedPathsFunction(
298 const FileManagerPrivateInternalGetCrostiniSharedPathsFunction&) = delete;
299 FileManagerPrivateInternalGetCrostiniSharedPathsFunction operator=(
300 const FileManagerPrivateInternalGetCrostiniSharedPathsFunction&) = delete;
301
Joel Hockeydee2de12018-09-18 21:41:52302 protected:
303 ~FileManagerPrivateInternalGetCrostiniSharedPathsFunction() override =
304 default;
305
306 private:
307 ResponseAction Run() override;
Joel Hockeyff5b5b82018-09-03 08:54:05308};
309
Timothy Loh3358dab2018-10-23 01:12:23310// Implements the chrome.fileManagerPrivate.getLinuxPackageInfo method.
311// Retrieves information about a Linux package.
312class FileManagerPrivateInternalGetLinuxPackageInfoFunction
Clark DuVallfd4db3d2019-07-30 19:10:43313 : public LoggedExtensionFunction {
Timothy Loh3358dab2018-10-23 01:12:23314 public:
315 DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getLinuxPackageInfo",
316 FILEMANAGERPRIVATEINTERNAL_GETLINUXPACKAGEINFO)
317 FileManagerPrivateInternalGetLinuxPackageInfoFunction() = default;
318
Bo Majewskif7507612020-09-14 04:08:49319 FileManagerPrivateInternalGetLinuxPackageInfoFunction(
320 const FileManagerPrivateInternalGetLinuxPackageInfoFunction&) = delete;
321 FileManagerPrivateInternalGetLinuxPackageInfoFunction operator=(
322 const FileManagerPrivateInternalGetLinuxPackageInfoFunction&) = delete;
323
Timothy Loh3358dab2018-10-23 01:12:23324 protected:
325 ~FileManagerPrivateInternalGetLinuxPackageInfoFunction() override = default;
326
327 private:
328 ResponseAction Run() override;
329 void OnGetLinuxPackageInfo(
330 const crostini::LinuxPackageInfo& linux_package_info);
Timothy Loh3358dab2018-10-23 01:12:23331};
332
Timothy Loh8136e7a02018-07-19 04:11:45333// Implements the chrome.fileManagerPrivate.installLinuxPackage method.
334// Starts installation of a Linux package.
335class FileManagerPrivateInternalInstallLinuxPackageFunction
Clark DuVallfd4db3d2019-07-30 19:10:43336 : public LoggedExtensionFunction {
Timothy Loh8136e7a02018-07-19 04:11:45337 public:
338 DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.installLinuxPackage",
339 FILEMANAGERPRIVATEINTERNAL_INSTALLLINUXPACKAGE)
Joel Hockeydee2de12018-09-18 21:41:52340 FileManagerPrivateInternalInstallLinuxPackageFunction() = default;
Timothy Loh8136e7a02018-07-19 04:11:45341
Bo Majewskif7507612020-09-14 04:08:49342 FileManagerPrivateInternalInstallLinuxPackageFunction(
343 const FileManagerPrivateInternalInstallLinuxPackageFunction&) = delete;
344 FileManagerPrivateInternalInstallLinuxPackageFunction operator=(
345 const FileManagerPrivateInternalInstallLinuxPackageFunction&) = delete;
346
Timothy Loh8136e7a02018-07-19 04:11:45347 protected:
348 ~FileManagerPrivateInternalInstallLinuxPackageFunction() override = default;
349
350 private:
351 ResponseAction Run() override;
Ian Barkley-Yeung42f06e962018-12-14 03:00:41352 void OnInstallLinuxPackage(crostini::CrostiniResult result);
Timothy Loh8136e7a02018-07-19 04:11:45353};
354
mtomasz365c5822015-09-28 14:08:08355// Implements the chrome.fileManagerPrivate.getCustomActions method.
356class FileManagerPrivateInternalGetCustomActionsFunction
Clark DuVallfd4db3d2019-07-30 19:10:43357 : public LoggedExtensionFunction {
mtomasz562a2892015-06-29 06:17:32358 public:
mtomasz365c5822015-09-28 14:08:08359 FileManagerPrivateInternalGetCustomActionsFunction();
360 DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getCustomActions",
361 FILEMANAGERPRIVATEINTERNAL_GETCUSTOMACTIONS)
Bo Majewskif7507612020-09-14 04:08:49362
363 FileManagerPrivateInternalGetCustomActionsFunction(
364 const FileManagerPrivateInternalGetCustomActionsFunction&) = delete;
365 FileManagerPrivateInternalGetCustomActionsFunction operator=(
366 const FileManagerPrivateInternalGetCustomActionsFunction&) = delete;
367
mtomasz562a2892015-06-29 06:17:32368 protected:
Stuart Langley9441fc02018-06-19 19:01:07369 ~FileManagerPrivateInternalGetCustomActionsFunction() override = default;
mtomasz562a2892015-06-29 06:17:32370
371 private:
372 ResponseAction Run() override;
Yeunjoo Choic4e54fe2021-06-09 02:11:39373 void OnCompleted(const ash::file_system_provider::Actions& actions,
mtomasz562a2892015-06-29 06:17:32374 base::File::Error result);
mtomasz562a2892015-06-29 06:17:32375};
376
mtomasz365c5822015-09-28 14:08:08377// Implements the chrome.fileManagerPrivate.executeCustomAction method.
378class FileManagerPrivateInternalExecuteCustomActionFunction
Clark DuVallfd4db3d2019-07-30 19:10:43379 : public LoggedExtensionFunction {
mtomasz562a2892015-06-29 06:17:32380 public:
mtomasz365c5822015-09-28 14:08:08381 FileManagerPrivateInternalExecuteCustomActionFunction();
382 DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.executeCustomAction",
383 FILEMANAGERPRIVATEINTERNAL_EXECUTECUSTOMACTION)
Bo Majewskif7507612020-09-14 04:08:49384
385 FileManagerPrivateInternalExecuteCustomActionFunction(
386 const FileManagerPrivateInternalExecuteCustomActionFunction&) = delete;
387 FileManagerPrivateInternalExecuteCustomActionFunction operator=(
388 const FileManagerPrivateInternalExecuteCustomActionFunction&) = delete;
389
mtomasz562a2892015-06-29 06:17:32390 protected:
Stuart Langley9441fc02018-06-19 19:01:07391 ~FileManagerPrivateInternalExecuteCustomActionFunction() override = default;
mtomasz562a2892015-06-29 06:17:32392
393 private:
394 ResponseAction Run() override;
395 void OnCompleted(base::File::Error result);
mtomasz562a2892015-06-29 06:17:32396};
397
Shuhei Takahashi30458d6c2017-08-15 03:46:10398// Implements the chrome.fileManagerPrivateInternal.getRecentFiles method.
399class FileManagerPrivateInternalGetRecentFilesFunction
Clark DuVallfd4db3d2019-07-30 19:10:43400 : public LoggedExtensionFunction {
Shuhei Takahashi30458d6c2017-08-15 03:46:10401 public:
402 FileManagerPrivateInternalGetRecentFilesFunction();
403 DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getRecentFiles",
404 FILEMANAGERPRIVATE_GETRECENTFILES)
Bo Majewskif7507612020-09-14 04:08:49405
406 FileManagerPrivateInternalGetRecentFilesFunction(
407 const FileManagerPrivateInternalGetRecentFilesFunction&) = delete;
408 FileManagerPrivateInternalGetRecentFilesFunction& operator=(
409 FileManagerPrivateInternalGetRecentFilesFunction&) = delete;
410
Shuhei Takahashi30458d6c2017-08-15 03:46:10411 protected:
Stuart Langley9441fc02018-06-19 19:01:07412 ~FileManagerPrivateInternalGetRecentFilesFunction() override = default;
Shuhei Takahashi30458d6c2017-08-15 03:46:10413
414 private:
415 ResponseAction Run() override;
Shuhei Takahashi0c37678e2017-08-23 10:00:10416 void OnGetRecentFiles(
417 api::file_manager_private::SourceRestriction restriction,
Yeunjoo Choi3d9ed38a2022-11-10 02:51:24418 const std::vector<ash::RecentFile>& files);
Shuhei Takahashi30458d6c2017-08-15 03:46:10419 void OnConvertFileDefinitionListToEntryDefinitionList(
420 std::unique_ptr<file_manager::util::EntryDefinitionList>
421 entry_definition_list);
Shuhei Takahashi30458d6c2017-08-15 03:46:10422};
423
David Black090e13a2020-12-22 00:48:52424// Implements the chrome.fileManagerPrivate.isTabletModeEnabled method.
425class FileManagerPrivateIsTabletModeEnabledFunction : public ExtensionFunction {
426 public:
427 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.isTabletModeEnabled",
428 FILEMANAGERPRIVATE_ISTABLETMODEENABLED)
429
430 protected:
431 ~FileManagerPrivateIsTabletModeEnabledFunction() override = default;
432
433 private:
434 ResponseAction Run() override;
435};
436
Jérémie Boulic565553a2022-01-18 05:40:13437// Implements the chrome.fileManagerPrivate.openURL method.
438class FileManagerPrivateOpenURLFunction : public ExtensionFunction {
439 public:
440 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.openURL",
441 FILEMANAGERPRIVATE_OPENURL)
442
443 protected:
444 ~FileManagerPrivateOpenURLFunction() override = default;
445
446 private:
447 ResponseAction Run() override;
448};
449
Luciano Pachecoe19c8aa2021-09-03 02:43:00450// Implements the chrome.fileManagerPrivate.openWindow method.
451class FileManagerPrivateOpenWindowFunction : public LoggedExtensionFunction {
452 public:
453 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.openWindow",
454 FILEMANAGERPRIVATE_OPENWINDOW)
455
456 protected:
457 ~FileManagerPrivateOpenWindowFunction() override = default;
458
459 private:
460 ResponseAction Run() override;
461};
462
Jérémie Boulic29aaf682022-05-04 10:16:06463// Implements the chrome.fileManagerPrivate.sendFeedback method.
464class FileManagerPrivateSendFeedbackFunction : public ExtensionFunction {
465 public:
466 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.sendFeedback",
467 FILEMANAGERPRIVATE_SENDFEEDBACK)
468
469 protected:
470 ~FileManagerPrivateSendFeedbackFunction() override = default;
471
472 private:
473 ResponseAction Run() override;
474};
475
Jérémie Boulicd8bcb9d2023-08-24 04:45:07476// Implements the chrome.fileManagerPrivate.getDeviceConnectionState method.
477class FileManagerPrivateGetDeviceConnectionStateFunction
478 : public ExtensionFunction {
479 public:
480 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getDeviceConnectionState",
481 FILEMANAGERPRIVATE_GETDEVICECONNECTIONSTATE)
482
483 protected:
484 ~FileManagerPrivateGetDeviceConnectionStateFunction() override = default;
485
486 ResponseAction Run() override;
487};
488
hirono@chromium.orgce12f3c2013-08-30 02:43:11489} // namespace extensions
satorux@chromium.orgd708ef62013-08-02 05:10:45490
Henrique Ferreirod67f0472022-11-05 00:40:09491#endif // CHROME_BROWSER_ASH_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_