Marijn Kruisselbrink | 0e6871a | 2020-03-06 22:31:46 | [diff] [blame] | 1 | // Copyright 2020 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 | |
Austin Sullivan | afefb72 | 2021-01-14 01:26:39 | [diff] [blame] | 5 | #ifndef CHROME_BROWSER_UI_FILE_SYSTEM_ACCESS_DIALOGS_H_ |
| 6 | #define CHROME_BROWSER_UI_FILE_SYSTEM_ACCESS_DIALOGS_H_ |
Marijn Kruisselbrink | 0e6871a | 2020-03-06 22:31:46 | [diff] [blame] | 7 | |
Marijn Kruisselbrink | 0e6871a | 2020-03-06 22:31:46 | [diff] [blame] | 8 | #include "base/callback.h" |
Avi Drissman | 1a55a9d6 | 2020-03-10 18:56:45 | [diff] [blame] | 9 | #include "base/callback_helpers.h" |
Marijn Kruisselbrink | 0e6871a | 2020-03-06 22:31:46 | [diff] [blame] | 10 | #include "build/build_config.h" |
Austin Sullivan | afefb72 | 2021-01-14 01:26:39 | [diff] [blame] | 11 | #include "chrome/browser/file_system_access/file_system_access_permission_request_manager.h" |
| 12 | #include "content/public/browser/file_system_access_permission_context.h" |
Marijn Kruisselbrink | 0e6871a | 2020-03-06 22:31:46 | [diff] [blame] | 13 | |
| 14 | namespace base { |
| 15 | class FilePath; |
| 16 | } |
| 17 | |
| 18 | namespace content { |
| 19 | class WebContents; |
| 20 | } |
| 21 | |
| 22 | namespace permissions { |
| 23 | enum class PermissionAction; |
| 24 | } |
| 25 | |
| 26 | namespace url { |
| 27 | class Origin; |
| 28 | } // namespace url |
| 29 | |
| 30 | // Displays a dialog to ask for write access to the given file or directory for |
Austin Sullivan | afefb72 | 2021-01-14 01:26:39 | [diff] [blame] | 31 | // the File System Access API. |
| 32 | void ShowFileSystemAccessPermissionDialog( |
| 33 | const FileSystemAccessPermissionRequestManager::RequestData& request, |
Marijn Kruisselbrink | 0e6871a | 2020-03-06 22:31:46 | [diff] [blame] | 34 | base::OnceCallback<void(permissions::PermissionAction result)> callback, |
| 35 | content::WebContents* web_contents); |
| 36 | |
| 37 | // Displays a dialog to inform the user that the |path| they picked using the |
Austin Sullivan | afefb72 | 2021-01-14 01:26:39 | [diff] [blame] | 38 | // File System Access API is blocked by chrome. |is_directory| is true if the |
Marijn Kruisselbrink | 0e6871a | 2020-03-06 22:31:46 | [diff] [blame] | 39 | // user was selecting a directory, otherwise the user was selecting files within |
| 40 | // a directory. |callback| is called when the user has dismissed the dialog. |
Austin Sullivan | afefb72 | 2021-01-14 01:26:39 | [diff] [blame] | 41 | void ShowFileSystemAccessRestrictedDirectoryDialog( |
Marijn Kruisselbrink | 0e6871a | 2020-03-06 22:31:46 | [diff] [blame] | 42 | const url::Origin& origin, |
| 43 | const base::FilePath& path, |
Austin Sullivan | afefb72 | 2021-01-14 01:26:39 | [diff] [blame] | 44 | content::FileSystemAccessPermissionContext::HandleType handle_type, |
Marijn Kruisselbrink | 0e6871a | 2020-03-06 22:31:46 | [diff] [blame] | 45 | base::OnceCallback<void( |
Austin Sullivan | afefb72 | 2021-01-14 01:26:39 | [diff] [blame] | 46 | content::FileSystemAccessPermissionContext::SensitiveDirectoryResult)> |
Marijn Kruisselbrink | 0e6871a | 2020-03-06 22:31:46 | [diff] [blame] | 47 | callback, |
| 48 | content::WebContents* web_contents); |
| 49 | |
Austin Sullivan | afefb72 | 2021-01-14 01:26:39 | [diff] [blame] | 50 | #endif // CHROME_BROWSER_UI_FILE_SYSTEM_ACCESS_DIALOGS_H_ |