Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 2 | // 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 Ferreiro | d67f047 | 2022-11-05 00:40:09 | [diff] [blame] | 8 | #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.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 10 | |
Shuhei Takahashi | 30458d6c | 2017-08-15 03:46:10 | [diff] [blame] | 11 | #include <memory> |
tbarzic | a8f25a0 | 2015-05-08 01:39:55 | [diff] [blame] | 12 | #include <string> |
Shuhei Takahashi | 30458d6c | 2017-08-15 03:46:10 | [diff] [blame] | 13 | #include <vector> |
tbarzic | a8f25a0 | 2015-05-08 01:39:55 | [diff] [blame] | 14 | |
mtomasz | d306ff2e | 2015-04-21 12:00:36 | [diff] [blame] | 15 | #include "base/files/file.h" |
François Degros | bfeae0a | 2021-05-27 02:33:03 | [diff] [blame] | 16 | #include "base/files/file_path.h" |
Henrique Ferreiro | d67f047 | 2022-11-05 00:40:09 | [diff] [blame] | 17 | #include "chrome/browser/ash/extensions/file_manager/logged_extension_function.h" |
Yeunjoo Choi | 627505b7 | 2021-05-13 15:56:31 | [diff] [blame] | 18 | #include "chrome/browser/ash/file_system_provider/provided_file_system_interface.h" |
Shuhei Takahashi | 0c37678e | 2017-08-23 10:00:10 | [diff] [blame] | 19 | #include "chrome/common/extensions/api/file_manager_private.h" |
DongJun Kim | febb3c2 | 2019-10-21 02:08:06 | [diff] [blame] | 20 | #include "storage/browser/file_system/file_system_url.h" |
yoshiki@chromium.org | d7c5f14d | 2013-09-09 11:25:25 | [diff] [blame] | 21 | |
Yeunjoo Choi | 3d9ed38a | 2022-11-10 02:51:24 | [diff] [blame] | 22 | namespace ash { |
Shuhei Takahashi | 11eb9b4f | 2017-08-30 07:09:21 | [diff] [blame] | 23 | class RecentFile; |
Yeunjoo Choi | 3d9ed38a | 2022-11-10 02:51:24 | [diff] [blame] | 24 | } |
Shuhei Takahashi | 11eb9b4f | 2017-08-30 07:09:21 | [diff] [blame] | 25 | |
Joel Hockey | f7f84ea | 2018-05-10 02:26:45 | [diff] [blame] | 26 | namespace crostini { |
Renee Wright | f09c5b7 | 2018-10-15 03:08:23 | [diff] [blame] | 27 | enum class CrostiniResult; |
Timothy Loh | 3358dab | 2018-10-23 01:12:23 | [diff] [blame] | 28 | struct LinuxPackageInfo; |
Jiaming Cheng | 78c5c73 | 2021-07-12 22:48:32 | [diff] [blame] | 29 | } // namespace crostini |
Joel Hockey | f7f84ea | 2018-05-10 02:26:45 | [diff] [blame] | 30 | |
Solomon Kinard | ccce03e7 | 2023-12-19 22:10:40 | [diff] [blame] | 31 | namespace file_manager::util { |
Shuhei Takahashi | 30458d6c | 2017-08-15 03:46:10 | [diff] [blame] | 32 | struct EntryDefinition; |
Solomon Kinard | ccce03e7 | 2023-12-19 22:10:40 | [diff] [blame] | 33 | using EntryDefinitionList = std::vector<EntryDefinition>; |
| 34 | } // namespace file_manager::util |
Shuhei Takahashi | 30458d6c | 2017-08-15 03:46:10 | [diff] [blame] | 35 | |
hirono@chromium.org | ce12f3c | 2013-08-30 02:43:11 | [diff] [blame] | 36 | namespace extensions { |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 37 | |
Satoru Takabayashi | 74e7c1c | 2014-09-10 04:20:24 | [diff] [blame] | 38 | // Implements the chrome.fileManagerPrivate.getPreferences method. |
yamaguchi | 8248bc0 | 2017-01-30 02:02:25 | [diff] [blame] | 39 | // Gets settings for the Files app. |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 40 | class FileManagerPrivateGetPreferencesFunction : public ExtensionFunction { |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 41 | public: |
Satoru Takabayashi | 74e7c1c | 2014-09-10 04:20:24 | [diff] [blame] | 42 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getPreferences", |
| 43 | FILEMANAGERPRIVATE_GETPREFERENCES) |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 44 | |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 45 | protected: |
Stuart Langley | 9441fc0 | 2018-06-19 19:01:07 | [diff] [blame] | 46 | ~FileManagerPrivateGetPreferencesFunction() override = default; |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 47 | |
rdevlin.cronin | 7c1cf988 | 2016-09-14 18:18:40 | [diff] [blame] | 48 | ResponseAction Run() override; |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 49 | }; |
| 50 | |
Satoru Takabayashi | 74e7c1c | 2014-09-10 04:20:24 | [diff] [blame] | 51 | // Implements the chrome.fileManagerPrivate.setPreferences method. |
yamaguchi | 8248bc0 | 2017-01-30 02:02:25 | [diff] [blame] | 52 | // Sets settings for the Files app. |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 53 | class FileManagerPrivateSetPreferencesFunction : public ExtensionFunction { |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 54 | public: |
Satoru Takabayashi | 74e7c1c | 2014-09-10 04:20:24 | [diff] [blame] | 55 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.setPreferences", |
| 56 | FILEMANAGERPRIVATE_SETPREFERENCES) |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 57 | |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 58 | protected: |
Stuart Langley | 9441fc0 | 2018-06-19 19:01:07 | [diff] [blame] | 59 | ~FileManagerPrivateSetPreferencesFunction() override = default; |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 60 | |
rdevlin.cronin | 7c1cf988 | 2016-09-14 18:18:40 | [diff] [blame] | 61 | ResponseAction Run() override; |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 62 | }; |
| 63 | |
Satoru Takabayashi | 74e7c1c | 2014-09-10 04:20:24 | [diff] [blame] | 64 | // Implements the chrome.fileManagerPrivate.zoom method. |
rdevlin.cronin | 17f4094 | 2016-08-17 15:27:43 | [diff] [blame] | 65 | // 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 DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 69 | class FileManagerPrivateZoomFunction : public ExtensionFunction { |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 70 | public: |
Nico Weber | 6e0f7aa | 2019-02-11 03:07:43 | [diff] [blame] | 71 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.zoom", FILEMANAGERPRIVATE_ZOOM) |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 72 | |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 73 | protected: |
Stuart Langley | 9441fc0 | 2018-06-19 19:01:07 | [diff] [blame] | 74 | ~FileManagerPrivateZoomFunction() override = default; |
hirono@chromium.org | faca74c | 2013-09-11 17:08:41 | [diff] [blame] | 75 | |
rdevlin.cronin | 7c1cf988 | 2016-09-14 18:18:40 | [diff] [blame] | 76 | // ExtensionFunction: |
| 77 | ResponseAction Run() override; |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 78 | }; |
| 79 | |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 80 | class FileManagerPrivateGetProfilesFunction : public ExtensionFunction { |
hirono@chromium.org | 51227335 | 2014-01-27 05:14:55 | [diff] [blame] | 81 | public: |
Satoru Takabayashi | 74e7c1c | 2014-09-10 04:20:24 | [diff] [blame] | 82 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getProfiles", |
Nico Weber | 6e0f7aa | 2019-02-11 03:07:43 | [diff] [blame] | 83 | FILEMANAGERPRIVATE_GETPROFILES) |
hirono@chromium.org | 51227335 | 2014-01-27 05:14:55 | [diff] [blame] | 84 | |
| 85 | protected: |
Stuart Langley | 9441fc0 | 2018-06-19 19:01:07 | [diff] [blame] | 86 | ~FileManagerPrivateGetProfilesFunction() override = default; |
hirono@chromium.org | 51227335 | 2014-01-27 05:14:55 | [diff] [blame] | 87 | |
rdevlin.cronin | 7c1cf988 | 2016-09-14 18:18:40 | [diff] [blame] | 88 | // ExtensionFunction: |
| 89 | ResponseAction Run() override; |
hirono@chromium.org | 51227335 | 2014-01-27 05:14:55 | [diff] [blame] | 90 | }; |
| 91 | |
Satoru Takabayashi | 74e7c1c | 2014-09-10 04:20:24 | [diff] [blame] | 92 | // Implements the chrome.fileManagerPrivate.openInspector method. |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 93 | class FileManagerPrivateOpenInspectorFunction : public ExtensionFunction { |
fukino@chromium.org | 3ff66cc | 2014-05-27 08:25:55 | [diff] [blame] | 94 | public: |
Satoru Takabayashi | 74e7c1c | 2014-09-10 04:20:24 | [diff] [blame] | 95 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.openInspector", |
Nico Weber | 6e0f7aa | 2019-02-11 03:07:43 | [diff] [blame] | 96 | FILEMANAGERPRIVATE_OPENINSPECTOR) |
fukino@chromium.org | 3ff66cc | 2014-05-27 08:25:55 | [diff] [blame] | 97 | |
| 98 | protected: |
Stuart Langley | 9441fc0 | 2018-06-19 19:01:07 | [diff] [blame] | 99 | ~FileManagerPrivateOpenInspectorFunction() override = default; |
fukino@chromium.org | 3ff66cc | 2014-05-27 08:25:55 | [diff] [blame] | 100 | |
rdevlin.cronin | 7c1cf988 | 2016-09-14 18:18:40 | [diff] [blame] | 101 | ResponseAction Run() override; |
fukino@chromium.org | 3ff66cc | 2014-05-27 08:25:55 | [diff] [blame] | 102 | }; |
| 103 | |
Alexey Baskakov | 6bbcab8 | 2018-04-10 05:55:33 | [diff] [blame] | 104 | // Implements the chrome.fileManagerPrivate.openSettingsSubpage method. |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 105 | class FileManagerPrivateOpenSettingsSubpageFunction : public ExtensionFunction { |
Alexey Baskakov | 6bbcab8 | 2018-04-10 05:55:33 | [diff] [blame] | 106 | public: |
| 107 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.openSettingsSubpage", |
Nico Weber | 6e0f7aa | 2019-02-11 03:07:43 | [diff] [blame] | 108 | FILEMANAGERPRIVATE_OPENSETTINGSSUBPAGE) |
Alexey Baskakov | 6bbcab8 | 2018-04-10 05:55:33 | [diff] [blame] | 109 | |
| 110 | protected: |
Stuart Langley | 9441fc0 | 2018-06-19 19:01:07 | [diff] [blame] | 111 | ~FileManagerPrivateOpenSettingsSubpageFunction() override = default; |
Alexey Baskakov | 6bbcab8 | 2018-04-10 05:55:33 | [diff] [blame] | 112 | |
| 113 | ResponseAction Run() override; |
| 114 | }; |
| 115 | |
yawano | 057e495 | 2015-01-08 12:56:58 | [diff] [blame] | 116 | // Implements the chrome.fileManagerPrivate.getMimeType method. |
Austin Tankiang | d48e8db | 2024-02-13 09:15:09 | [diff] [blame] | 117 | class FileManagerPrivateGetMimeTypeFunction : public LoggedExtensionFunction { |
yawano | 057e495 | 2015-01-08 12:56:58 | [diff] [blame] | 118 | public: |
Austin Tankiang | d48e8db | 2024-02-13 09:15:09 | [diff] [blame] | 119 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getMimeType", |
mtomasz | 9b275eb | 2015-07-14 06:25:22 | [diff] [blame] | 120 | FILEMANAGERPRIVATEINTERNAL_GETMIMETYPE) |
yawano | 057e495 | 2015-01-08 12:56:58 | [diff] [blame] | 121 | |
Austin Tankiang | d48e8db | 2024-02-13 09:15:09 | [diff] [blame] | 122 | FileManagerPrivateGetMimeTypeFunction(); |
yawano | 057e495 | 2015-01-08 12:56:58 | [diff] [blame] | 123 | |
| 124 | protected: |
Austin Tankiang | d48e8db | 2024-02-13 09:15:09 | [diff] [blame] | 125 | ~FileManagerPrivateGetMimeTypeFunction() override; |
yawano | 057e495 | 2015-01-08 12:56:58 | [diff] [blame] | 126 | |
Anand K. Mistry | 7055ce94 | 2019-02-22 05:52:47 | [diff] [blame] | 127 | // ExtensionFunction overrides. |
| 128 | ResponseAction Run() override; |
yawano | 057e495 | 2015-01-08 12:56:58 | [diff] [blame] | 129 | |
| 130 | void OnGetMimeType(const std::string& mimeType); |
| 131 | }; |
| 132 | |
Tomasz Mikolajewski | f631ba6 | 2017-12-08 07:03:37 | [diff] [blame] | 133 | // Implements the chrome.fileManagerPrivate.getProviders method. |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 134 | class FileManagerPrivateGetProvidersFunction : public ExtensionFunction { |
mtomasz | 6cac9ef | 2015-04-16 04:57:24 | [diff] [blame] | 135 | public: |
Tomasz Mikolajewski | f631ba6 | 2017-12-08 07:03:37 | [diff] [blame] | 136 | FileManagerPrivateGetProvidersFunction(); |
| 137 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getProviders", |
| 138 | FILEMANAGERPRIVATE_GETPROVIDERS) |
Bo Majewski | f750761 | 2020-09-14 04:08:49 | [diff] [blame] | 139 | |
| 140 | FileManagerPrivateGetProvidersFunction( |
| 141 | const FileManagerPrivateGetProvidersFunction&) = delete; |
| 142 | FileManagerPrivateGetProvidersFunction& operator=( |
| 143 | const FileManagerPrivateGetProvidersFunction&) = delete; |
| 144 | |
mtomasz | 6cac9ef | 2015-04-16 04:57:24 | [diff] [blame] | 145 | protected: |
Stuart Langley | 9441fc0 | 2018-06-19 19:01:07 | [diff] [blame] | 146 | ~FileManagerPrivateGetProvidersFunction() override = default; |
mtomasz | 6cac9ef | 2015-04-16 04:57:24 | [diff] [blame] | 147 | |
| 148 | private: |
| 149 | ResponseAction Run() override; |
mtomasz | 6cac9ef | 2015-04-16 04:57:24 | [diff] [blame] | 150 | }; |
mtomasz | a4b1351 | 2015-04-20 13:51:54 | [diff] [blame] | 151 | |
| 152 | // Implements the chrome.fileManagerPrivate.addProvidedFileSystem method. |
| 153 | class FileManagerPrivateAddProvidedFileSystemFunction |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 154 | : public ExtensionFunction { |
mtomasz | a4b1351 | 2015-04-20 13:51:54 | [diff] [blame] | 155 | public: |
| 156 | FileManagerPrivateAddProvidedFileSystemFunction(); |
| 157 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.addProvidedFileSystem", |
| 158 | FILEMANAGERPRIVATE_ADDPROVIDEDFILESYSTEM) |
Bo Majewski | f750761 | 2020-09-14 04:08:49 | [diff] [blame] | 159 | |
| 160 | FileManagerPrivateAddProvidedFileSystemFunction( |
| 161 | const FileManagerPrivateAddProvidedFileSystemFunction&) = delete; |
| 162 | FileManagerPrivateAddProvidedFileSystemFunction& operator=( |
| 163 | const FileManagerPrivateAddProvidedFileSystemFunction&) = delete; |
| 164 | |
mtomasz | a4b1351 | 2015-04-20 13:51:54 | [diff] [blame] | 165 | protected: |
Stuart Langley | 9441fc0 | 2018-06-19 19:01:07 | [diff] [blame] | 166 | ~FileManagerPrivateAddProvidedFileSystemFunction() override = default; |
mtomasz | a4b1351 | 2015-04-20 13:51:54 | [diff] [blame] | 167 | |
| 168 | private: |
| 169 | ResponseAction Run() override; |
mtomasz | a4b1351 | 2015-04-20 13:51:54 | [diff] [blame] | 170 | }; |
| 171 | |
mtomasz | 663f86d0 | 2015-05-16 09:49:20 | [diff] [blame] | 172 | // Implements the chrome.fileManagerPrivate.configureVolume method. |
| 173 | class FileManagerPrivateConfigureVolumeFunction |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 174 | : public LoggedExtensionFunction { |
mtomasz | d306ff2e | 2015-04-21 12:00:36 | [diff] [blame] | 175 | public: |
mtomasz | 663f86d0 | 2015-05-16 09:49:20 | [diff] [blame] | 176 | FileManagerPrivateConfigureVolumeFunction(); |
| 177 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.configureVolume", |
| 178 | FILEMANAGERPRIVATE_CONFIGUREVOLUME) |
Bo Majewski | f750761 | 2020-09-14 04:08:49 | [diff] [blame] | 179 | |
| 180 | FileManagerPrivateConfigureVolumeFunction( |
| 181 | const FileManagerPrivateConfigureVolumeFunction&) = delete; |
| 182 | FileManagerPrivateConfigureVolumeFunction& operator=( |
| 183 | const FileManagerPrivateConfigureVolumeFunction&) = delete; |
| 184 | |
mtomasz | d306ff2e | 2015-04-21 12:00:36 | [diff] [blame] | 185 | protected: |
Stuart Langley | 9441fc0 | 2018-06-19 19:01:07 | [diff] [blame] | 186 | ~FileManagerPrivateConfigureVolumeFunction() override = default; |
mtomasz | d306ff2e | 2015-04-21 12:00:36 | [diff] [blame] | 187 | |
| 188 | private: |
| 189 | ResponseAction Run() override; |
| 190 | void OnCompleted(base::File::Error result); |
mtomasz | d306ff2e | 2015-04-21 12:00:36 | [diff] [blame] | 191 | }; |
| 192 | |
Joel Hockey | 5529d27 | 2018-09-13 01:53:18 | [diff] [blame] | 193 | // Implements the chrome.fileManagerPrivate.mountCrostini method. |
Joel Hockey | 37fa72b | 2018-05-09 05:34:52 | [diff] [blame] | 194 | // Starts and mounts crostini container. |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 195 | class FileManagerPrivateMountCrostiniFunction : public LoggedExtensionFunction { |
Joel Hockey | 37fa72b | 2018-05-09 05:34:52 | [diff] [blame] | 196 | public: |
Joel Hockey | 5529d27 | 2018-09-13 01:53:18 | [diff] [blame] | 197 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.mountCrostini", |
| 198 | FILEMANAGERPRIVATE_MOUNTCROSTINI) |
| 199 | FileManagerPrivateMountCrostiniFunction(); |
Joel Hockey | 37fa72b | 2018-05-09 05:34:52 | [diff] [blame] | 200 | |
Bo Majewski | f750761 | 2020-09-14 04:08:49 | [diff] [blame] | 201 | FileManagerPrivateMountCrostiniFunction( |
| 202 | const FileManagerPrivateMountCrostiniFunction&) = delete; |
| 203 | FileManagerPrivateMountCrostiniFunction& operator=( |
| 204 | const FileManagerPrivateMountCrostiniFunction&) = delete; |
| 205 | |
Joel Hockey | 37fa72b | 2018-05-09 05:34:52 | [diff] [blame] | 206 | protected: |
Joel Hockey | 5529d27 | 2018-09-13 01:53:18 | [diff] [blame] | 207 | ~FileManagerPrivateMountCrostiniFunction() override; |
Joel Hockey | 37fa72b | 2018-05-09 05:34:52 | [diff] [blame] | 208 | |
Anand K. Mistry | 7055ce94 | 2019-02-22 05:52:47 | [diff] [blame] | 209 | ResponseAction Run() override; |
Renee Wright | f09c5b7 | 2018-10-15 03:08:23 | [diff] [blame] | 210 | void RestartCallback(crostini::CrostiniResult); |
David Munro | 828ce0e | 2021-05-03 22:10:54 | [diff] [blame] | 211 | void MountCallback(crostini::CrostiniResult); |
Joel Hockey | 37fa72b | 2018-05-09 05:34:52 | [diff] [blame] | 212 | }; |
| 213 | |
Julian Watson | 03cfb02 | 2019-07-31 12:49:37 | [diff] [blame] | 214 | // Implements the chrome.fileManagerPrivate.importCrostiniImage method. |
| 215 | // Starts importing the crostini .tini image. |
| 216 | class FileManagerPrivateInternalImportCrostiniImageFunction |
| 217 | : public LoggedExtensionFunction { |
| 218 | public: |
| 219 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.importCrostiniImage", |
| 220 | FILEMANAGERPRIVATEINTERNAL_IMPORTCROSTINIIMAGE) |
| 221 | FileManagerPrivateInternalImportCrostiniImageFunction(); |
| 222 | |
Bo Majewski | f750761 | 2020-09-14 04:08:49 | [diff] [blame] | 223 | FileManagerPrivateInternalImportCrostiniImageFunction( |
| 224 | const FileManagerPrivateInternalImportCrostiniImageFunction&) = delete; |
| 225 | FileManagerPrivateInternalImportCrostiniImageFunction& operator=( |
| 226 | const FileManagerPrivateInternalImportCrostiniImageFunction&) = delete; |
| 227 | |
Julian Watson | 03cfb02 | 2019-07-31 12:49:37 | [diff] [blame] | 228 | protected: |
| 229 | ~FileManagerPrivateInternalImportCrostiniImageFunction() override; |
| 230 | |
| 231 | private: |
| 232 | ResponseAction Run() override; |
| 233 | |
| 234 | std::string image_path_; |
Julian Watson | 03cfb02 | 2019-07-31 12:49:37 | [diff] [blame] | 235 | }; |
| 236 | |
Joel Hockey | 7606b46e | 2018-10-24 07:00:21 | [diff] [blame] | 237 | // Implements the chrome.fileManagerPrivate.sharePathsWithCrostini |
| 238 | // method. Shares specified paths. |
| 239 | class FileManagerPrivateInternalSharePathsWithCrostiniFunction |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 240 | : public LoggedExtensionFunction { |
Joel Hockey | ff5b5b8 | 2018-09-03 08:54:05 | [diff] [blame] | 241 | public: |
Joel Hockey | 7606b46e | 2018-10-24 07:00:21 | [diff] [blame] | 242 | DECLARE_EXTENSION_FUNCTION( |
| 243 | "fileManagerPrivateInternal.sharePathsWithCrostini", |
| 244 | FILEMANAGERPRIVATEINTERNAL_SHAREPATHSWITHCROSTINI) |
| 245 | FileManagerPrivateInternalSharePathsWithCrostiniFunction() = default; |
Joel Hockey | ff5b5b8 | 2018-09-03 08:54:05 | [diff] [blame] | 246 | |
Bo Majewski | f750761 | 2020-09-14 04:08:49 | [diff] [blame] | 247 | FileManagerPrivateInternalSharePathsWithCrostiniFunction( |
| 248 | const FileManagerPrivateInternalSharePathsWithCrostiniFunction&) = delete; |
| 249 | FileManagerPrivateInternalSharePathsWithCrostiniFunction& operator=( |
| 250 | const FileManagerPrivateInternalSharePathsWithCrostiniFunction&) = delete; |
| 251 | |
Joel Hockey | ff5b5b8 | 2018-09-03 08:54:05 | [diff] [blame] | 252 | protected: |
Joel Hockey | 7606b46e | 2018-10-24 07:00:21 | [diff] [blame] | 253 | ~FileManagerPrivateInternalSharePathsWithCrostiniFunction() override = |
| 254 | default; |
Joel Hockey | ff5b5b8 | 2018-09-03 08:54:05 | [diff] [blame] | 255 | |
| 256 | private: |
| 257 | ResponseAction Run() override; |
Joel Hockey | 0eeace5 | 2019-08-16 03:30:03 | [diff] [blame] | 258 | void SharePathsCallback(bool success, const std::string& failure_reason); |
Joel Hockey | dee2de1 | 2018-09-18 21:41:52 | [diff] [blame] | 259 | }; |
| 260 | |
Joel Hockey | 71a4de0 | 2018-11-30 04:09:16 | [diff] [blame] | 261 | // Implements the chrome.fileManagerPrivate.unsharePathWithCrostini |
| 262 | // method. Unshares specified path. |
| 263 | class FileManagerPrivateInternalUnsharePathWithCrostiniFunction |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 264 | : public LoggedExtensionFunction { |
Joel Hockey | 71a4de0 | 2018-11-30 04:09:16 | [diff] [blame] | 265 | public: |
| 266 | DECLARE_EXTENSION_FUNCTION( |
| 267 | "fileManagerPrivateInternal.unsharePathWithCrostini", |
| 268 | FILEMANAGERPRIVATEINTERNAL_UNSHAREPATHWITHCROSTINI) |
| 269 | FileManagerPrivateInternalUnsharePathWithCrostiniFunction() = default; |
| 270 | |
Bo Majewski | f750761 | 2020-09-14 04:08:49 | [diff] [blame] | 271 | FileManagerPrivateInternalUnsharePathWithCrostiniFunction( |
| 272 | const FileManagerPrivateInternalUnsharePathWithCrostiniFunction&) = |
| 273 | delete; |
| 274 | FileManagerPrivateInternalUnsharePathWithCrostiniFunction& operator=( |
| 275 | const FileManagerPrivateInternalUnsharePathWithCrostiniFunction&) = |
| 276 | delete; |
| 277 | |
Joel Hockey | 71a4de0 | 2018-11-30 04:09:16 | [diff] [blame] | 278 | protected: |
| 279 | ~FileManagerPrivateInternalUnsharePathWithCrostiniFunction() override = |
| 280 | default; |
| 281 | |
| 282 | private: |
| 283 | ResponseAction Run() override; |
Joel Hockey | 0eeace5 | 2019-08-16 03:30:03 | [diff] [blame] | 284 | void UnsharePathCallback(bool success, const std::string& failure_reason); |
Joel Hockey | 71a4de0 | 2018-11-30 04:09:16 | [diff] [blame] | 285 | }; |
| 286 | |
Joel Hockey | dee2de1 | 2018-09-18 21:41:52 | [diff] [blame] | 287 | // Implements the chrome.fileManagerPrivate.getCrostiniSharedPaths |
| 288 | // method. Returns list of file entries. |
| 289 | class FileManagerPrivateInternalGetCrostiniSharedPathsFunction |
Bo Majewski | 7d6302e | 2021-07-01 05:54:36 | [diff] [blame] | 290 | : public ExtensionFunction { |
Joel Hockey | dee2de1 | 2018-09-18 21:41:52 | [diff] [blame] | 291 | public: |
| 292 | DECLARE_EXTENSION_FUNCTION( |
| 293 | "fileManagerPrivateInternal.getCrostiniSharedPaths", |
| 294 | FILEMANAGERPRIVATEINTERNAL_GETCROSTINISHAREDPATHS) |
| 295 | FileManagerPrivateInternalGetCrostiniSharedPathsFunction() = default; |
| 296 | |
Bo Majewski | f750761 | 2020-09-14 04:08:49 | [diff] [blame] | 297 | FileManagerPrivateInternalGetCrostiniSharedPathsFunction( |
| 298 | const FileManagerPrivateInternalGetCrostiniSharedPathsFunction&) = delete; |
| 299 | FileManagerPrivateInternalGetCrostiniSharedPathsFunction operator=( |
| 300 | const FileManagerPrivateInternalGetCrostiniSharedPathsFunction&) = delete; |
| 301 | |
Joel Hockey | dee2de1 | 2018-09-18 21:41:52 | [diff] [blame] | 302 | protected: |
| 303 | ~FileManagerPrivateInternalGetCrostiniSharedPathsFunction() override = |
| 304 | default; |
| 305 | |
| 306 | private: |
| 307 | ResponseAction Run() override; |
Joel Hockey | ff5b5b8 | 2018-09-03 08:54:05 | [diff] [blame] | 308 | }; |
| 309 | |
Timothy Loh | 3358dab | 2018-10-23 01:12:23 | [diff] [blame] | 310 | // Implements the chrome.fileManagerPrivate.getLinuxPackageInfo method. |
| 311 | // Retrieves information about a Linux package. |
| 312 | class FileManagerPrivateInternalGetLinuxPackageInfoFunction |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 313 | : public LoggedExtensionFunction { |
Timothy Loh | 3358dab | 2018-10-23 01:12:23 | [diff] [blame] | 314 | public: |
| 315 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getLinuxPackageInfo", |
| 316 | FILEMANAGERPRIVATEINTERNAL_GETLINUXPACKAGEINFO) |
| 317 | FileManagerPrivateInternalGetLinuxPackageInfoFunction() = default; |
| 318 | |
Bo Majewski | f750761 | 2020-09-14 04:08:49 | [diff] [blame] | 319 | FileManagerPrivateInternalGetLinuxPackageInfoFunction( |
| 320 | const FileManagerPrivateInternalGetLinuxPackageInfoFunction&) = delete; |
| 321 | FileManagerPrivateInternalGetLinuxPackageInfoFunction operator=( |
| 322 | const FileManagerPrivateInternalGetLinuxPackageInfoFunction&) = delete; |
| 323 | |
Timothy Loh | 3358dab | 2018-10-23 01:12:23 | [diff] [blame] | 324 | protected: |
| 325 | ~FileManagerPrivateInternalGetLinuxPackageInfoFunction() override = default; |
| 326 | |
| 327 | private: |
| 328 | ResponseAction Run() override; |
| 329 | void OnGetLinuxPackageInfo( |
| 330 | const crostini::LinuxPackageInfo& linux_package_info); |
Timothy Loh | 3358dab | 2018-10-23 01:12:23 | [diff] [blame] | 331 | }; |
| 332 | |
Timothy Loh | 8136e7a0 | 2018-07-19 04:11:45 | [diff] [blame] | 333 | // Implements the chrome.fileManagerPrivate.installLinuxPackage method. |
| 334 | // Starts installation of a Linux package. |
| 335 | class FileManagerPrivateInternalInstallLinuxPackageFunction |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 336 | : public LoggedExtensionFunction { |
Timothy Loh | 8136e7a0 | 2018-07-19 04:11:45 | [diff] [blame] | 337 | public: |
| 338 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.installLinuxPackage", |
| 339 | FILEMANAGERPRIVATEINTERNAL_INSTALLLINUXPACKAGE) |
Joel Hockey | dee2de1 | 2018-09-18 21:41:52 | [diff] [blame] | 340 | FileManagerPrivateInternalInstallLinuxPackageFunction() = default; |
Timothy Loh | 8136e7a0 | 2018-07-19 04:11:45 | [diff] [blame] | 341 | |
Bo Majewski | f750761 | 2020-09-14 04:08:49 | [diff] [blame] | 342 | FileManagerPrivateInternalInstallLinuxPackageFunction( |
| 343 | const FileManagerPrivateInternalInstallLinuxPackageFunction&) = delete; |
| 344 | FileManagerPrivateInternalInstallLinuxPackageFunction operator=( |
| 345 | const FileManagerPrivateInternalInstallLinuxPackageFunction&) = delete; |
| 346 | |
Timothy Loh | 8136e7a0 | 2018-07-19 04:11:45 | [diff] [blame] | 347 | protected: |
| 348 | ~FileManagerPrivateInternalInstallLinuxPackageFunction() override = default; |
| 349 | |
| 350 | private: |
| 351 | ResponseAction Run() override; |
Ian Barkley-Yeung | 42f06e96 | 2018-12-14 03:00:41 | [diff] [blame] | 352 | void OnInstallLinuxPackage(crostini::CrostiniResult result); |
Timothy Loh | 8136e7a0 | 2018-07-19 04:11:45 | [diff] [blame] | 353 | }; |
| 354 | |
mtomasz | 365c582 | 2015-09-28 14:08:08 | [diff] [blame] | 355 | // Implements the chrome.fileManagerPrivate.getCustomActions method. |
| 356 | class FileManagerPrivateInternalGetCustomActionsFunction |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 357 | : public LoggedExtensionFunction { |
mtomasz | 562a289 | 2015-06-29 06:17:32 | [diff] [blame] | 358 | public: |
mtomasz | 365c582 | 2015-09-28 14:08:08 | [diff] [blame] | 359 | FileManagerPrivateInternalGetCustomActionsFunction(); |
| 360 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getCustomActions", |
| 361 | FILEMANAGERPRIVATEINTERNAL_GETCUSTOMACTIONS) |
Bo Majewski | f750761 | 2020-09-14 04:08:49 | [diff] [blame] | 362 | |
| 363 | FileManagerPrivateInternalGetCustomActionsFunction( |
| 364 | const FileManagerPrivateInternalGetCustomActionsFunction&) = delete; |
| 365 | FileManagerPrivateInternalGetCustomActionsFunction operator=( |
| 366 | const FileManagerPrivateInternalGetCustomActionsFunction&) = delete; |
| 367 | |
mtomasz | 562a289 | 2015-06-29 06:17:32 | [diff] [blame] | 368 | protected: |
Stuart Langley | 9441fc0 | 2018-06-19 19:01:07 | [diff] [blame] | 369 | ~FileManagerPrivateInternalGetCustomActionsFunction() override = default; |
mtomasz | 562a289 | 2015-06-29 06:17:32 | [diff] [blame] | 370 | |
| 371 | private: |
| 372 | ResponseAction Run() override; |
Yeunjoo Choi | c4e54fe | 2021-06-09 02:11:39 | [diff] [blame] | 373 | void OnCompleted(const ash::file_system_provider::Actions& actions, |
mtomasz | 562a289 | 2015-06-29 06:17:32 | [diff] [blame] | 374 | base::File::Error result); |
mtomasz | 562a289 | 2015-06-29 06:17:32 | [diff] [blame] | 375 | }; |
| 376 | |
mtomasz | 365c582 | 2015-09-28 14:08:08 | [diff] [blame] | 377 | // Implements the chrome.fileManagerPrivate.executeCustomAction method. |
| 378 | class FileManagerPrivateInternalExecuteCustomActionFunction |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 379 | : public LoggedExtensionFunction { |
mtomasz | 562a289 | 2015-06-29 06:17:32 | [diff] [blame] | 380 | public: |
mtomasz | 365c582 | 2015-09-28 14:08:08 | [diff] [blame] | 381 | FileManagerPrivateInternalExecuteCustomActionFunction(); |
| 382 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.executeCustomAction", |
| 383 | FILEMANAGERPRIVATEINTERNAL_EXECUTECUSTOMACTION) |
Bo Majewski | f750761 | 2020-09-14 04:08:49 | [diff] [blame] | 384 | |
| 385 | FileManagerPrivateInternalExecuteCustomActionFunction( |
| 386 | const FileManagerPrivateInternalExecuteCustomActionFunction&) = delete; |
| 387 | FileManagerPrivateInternalExecuteCustomActionFunction operator=( |
| 388 | const FileManagerPrivateInternalExecuteCustomActionFunction&) = delete; |
| 389 | |
mtomasz | 562a289 | 2015-06-29 06:17:32 | [diff] [blame] | 390 | protected: |
Stuart Langley | 9441fc0 | 2018-06-19 19:01:07 | [diff] [blame] | 391 | ~FileManagerPrivateInternalExecuteCustomActionFunction() override = default; |
mtomasz | 562a289 | 2015-06-29 06:17:32 | [diff] [blame] | 392 | |
| 393 | private: |
| 394 | ResponseAction Run() override; |
| 395 | void OnCompleted(base::File::Error result); |
mtomasz | 562a289 | 2015-06-29 06:17:32 | [diff] [blame] | 396 | }; |
| 397 | |
Shuhei Takahashi | 30458d6c | 2017-08-15 03:46:10 | [diff] [blame] | 398 | // Implements the chrome.fileManagerPrivateInternal.getRecentFiles method. |
| 399 | class FileManagerPrivateInternalGetRecentFilesFunction |
Clark DuVall | fd4db3d | 2019-07-30 19:10:43 | [diff] [blame] | 400 | : public LoggedExtensionFunction { |
Shuhei Takahashi | 30458d6c | 2017-08-15 03:46:10 | [diff] [blame] | 401 | public: |
| 402 | FileManagerPrivateInternalGetRecentFilesFunction(); |
| 403 | DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getRecentFiles", |
| 404 | FILEMANAGERPRIVATE_GETRECENTFILES) |
Bo Majewski | f750761 | 2020-09-14 04:08:49 | [diff] [blame] | 405 | |
| 406 | FileManagerPrivateInternalGetRecentFilesFunction( |
| 407 | const FileManagerPrivateInternalGetRecentFilesFunction&) = delete; |
| 408 | FileManagerPrivateInternalGetRecentFilesFunction& operator=( |
| 409 | FileManagerPrivateInternalGetRecentFilesFunction&) = delete; |
| 410 | |
Shuhei Takahashi | 30458d6c | 2017-08-15 03:46:10 | [diff] [blame] | 411 | protected: |
Stuart Langley | 9441fc0 | 2018-06-19 19:01:07 | [diff] [blame] | 412 | ~FileManagerPrivateInternalGetRecentFilesFunction() override = default; |
Shuhei Takahashi | 30458d6c | 2017-08-15 03:46:10 | [diff] [blame] | 413 | |
| 414 | private: |
| 415 | ResponseAction Run() override; |
Shuhei Takahashi | 0c37678e | 2017-08-23 10:00:10 | [diff] [blame] | 416 | void OnGetRecentFiles( |
| 417 | api::file_manager_private::SourceRestriction restriction, |
Yeunjoo Choi | 3d9ed38a | 2022-11-10 02:51:24 | [diff] [blame] | 418 | const std::vector<ash::RecentFile>& files); |
Shuhei Takahashi | 30458d6c | 2017-08-15 03:46:10 | [diff] [blame] | 419 | void OnConvertFileDefinitionListToEntryDefinitionList( |
| 420 | std::unique_ptr<file_manager::util::EntryDefinitionList> |
| 421 | entry_definition_list); |
Shuhei Takahashi | 30458d6c | 2017-08-15 03:46:10 | [diff] [blame] | 422 | }; |
| 423 | |
David Black | 090e13a | 2020-12-22 00:48:52 | [diff] [blame] | 424 | // Implements the chrome.fileManagerPrivate.isTabletModeEnabled method. |
| 425 | class 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 Boulic | 565553a | 2022-01-18 05:40:13 | [diff] [blame] | 437 | // Implements the chrome.fileManagerPrivate.openURL method. |
| 438 | class 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 Pacheco | e19c8aa | 2021-09-03 02:43:00 | [diff] [blame] | 450 | // Implements the chrome.fileManagerPrivate.openWindow method. |
| 451 | class 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 Boulic | 29aaf68 | 2022-05-04 10:16:06 | [diff] [blame] | 463 | // Implements the chrome.fileManagerPrivate.sendFeedback method. |
| 464 | class 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 Boulic | d8bcb9d | 2023-08-24 04:45:07 | [diff] [blame] | 476 | // Implements the chrome.fileManagerPrivate.getDeviceConnectionState method. |
| 477 | class 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.org | ce12f3c | 2013-08-30 02:43:11 | [diff] [blame] | 489 | } // namespace extensions |
satorux@chromium.org | d708ef6 | 2013-08-02 05:10:45 | [diff] [blame] | 490 | |
Henrique Ferreiro | d67f047 | 2022-11-05 00:40:09 | [diff] [blame] | 491 | #endif // CHROME_BROWSER_ASH_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_ |