[email protected] | c5e22aee5 | 2012-01-19 16:10:51 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | c96531e8 | 2011-01-26 03:11:14 | [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 | #ifndef CHROME_BROWSER_UI_BROWSER_DIALOGS_H_ |
| 6 | #define CHROME_BROWSER_UI_BROWSER_DIALOGS_H_ |
[email protected] | c96531e8 | 2011-01-26 03:11:14 | [diff] [blame] | 7 | |
David Benjamin | 78fe596 | 2019-01-29 22:22:38 | [diff] [blame^] | 8 | #include <memory> |
djacobo | 21e56e0 | 2016-07-02 01:14:31 | [diff] [blame] | 9 | #include <string> |
| 10 | #include <utility> |
| 11 | #include <vector> |
| 12 | |
[email protected] | 6684dc816 | 2013-06-03 14:05:08 | [diff] [blame] | 13 | #include "base/callback.h" |
constantina | e4c513e7 | 2017-02-07 02:14:10 | [diff] [blame] | 14 | #include "base/optional.h" |
| 15 | #include "base/strings/string16.h" |
avi | 655876a | 2015-12-25 07:18:15 | [diff] [blame] | 16 | #include "build/build_config.h" |
jackhou | b42a1f3d | 2015-08-24 05:53:28 | [diff] [blame] | 17 | #include "chrome/browser/ui/bookmarks/bookmark_editor.h" |
Mark Pilgrim | 7cfcd11 | 2018-05-08 00:07:56 | [diff] [blame] | 18 | #include "content/public/browser/content_browser_client.h" |
Jun Cai | bc561f41 | 2018-02-28 18:41:39 | [diff] [blame] | 19 | #include "content/public/browser/resource_request_info.h" |
[email protected] | cb80545 | 2013-05-22 15:16:21 | [diff] [blame] | 20 | #include "third_party/skia/include/core/SkColor.h" |
[email protected] | 08397d5 | 2011-02-05 01:53:38 | [diff] [blame] | 21 | #include "ui/gfx/native_widget_types.h" |
[email protected] | c96531e8 | 2011-01-26 03:11:14 | [diff] [blame] | 22 | |
[email protected] | c60e248 | 2011-02-11 23:46:32 | [diff] [blame] | 23 | class Browser; |
tapted | 081286e | 2015-08-10 06:36:30 | [diff] [blame] | 24 | class LoginHandler; |
[email protected] | 6684dc816 | 2013-06-03 14:05:08 | [diff] [blame] | 25 | class Profile; |
Giovanni Ortuño Urquidi | 97f8bd52 | 2017-06-16 04:04:37 | [diff] [blame] | 26 | class WebShareTarget; |
tapted | 712c1b8 | 2017-06-08 03:10:05 | [diff] [blame] | 27 | struct WebApplicationInfo; |
[email protected] | eb2d790 | 2011-02-02 18:19:56 | [diff] [blame] | 28 | |
Peter Boström | 2a02a69 | 2018-02-22 22:25:46 | [diff] [blame] | 29 | namespace base { |
| 30 | class FilePath; |
| 31 | } |
| 32 | |
[email protected] | 2a6bc3e | 2011-12-28 23:51:33 | [diff] [blame] | 33 | namespace content { |
[email protected] | 6ae4f14 | 2012-06-13 19:48:20 | [diff] [blame] | 34 | class BrowserContext; |
[email protected] | 2a6bc3e | 2011-12-28 23:51:33 | [diff] [blame] | 35 | class WebContents; |
Josh Pratt | f80ffb8 | 2019-01-22 07:13:51 | [diff] [blame] | 36 | } // namespace content |
[email protected] | 2a6bc3e | 2011-12-28 23:51:33 | [diff] [blame] | 37 | |
[email protected] | 1c321ee | 2012-05-21 03:02:34 | [diff] [blame] | 38 | namespace extensions { |
| 39 | class Extension; |
| 40 | } |
| 41 | |
tapted | 081286e | 2015-08-10 06:36:30 | [diff] [blame] | 42 | namespace net { |
| 43 | class AuthChallengeInfo; |
tapted | 081286e | 2015-08-10 06:36:30 | [diff] [blame] | 44 | } |
| 45 | |
anthonyvd | 3d7f972 | 2016-12-07 18:43:54 | [diff] [blame] | 46 | namespace payments { |
mathp | f709499d | 2017-01-09 20:48:36 | [diff] [blame] | 47 | class PaymentRequest; |
mathp | f4bc50e | 2017-01-24 05:17:50 | [diff] [blame] | 48 | class PaymentRequestDialog; |
Josh Pratt | f80ffb8 | 2019-01-22 07:13:51 | [diff] [blame] | 49 | } // namespace payments |
anthonyvd | 3d7f972 | 2016-12-07 18:43:54 | [diff] [blame] | 50 | |
alito | e82b14b | 2017-04-06 23:11:29 | [diff] [blame] | 51 | namespace safe_browsing { |
Ali Tofigh | f5baba98 | 2017-07-21 23:15:23 | [diff] [blame] | 52 | class ChromeCleanerController; |
alito | f8f753f6 | 2017-04-28 23:04:10 | [diff] [blame] | 53 | class ChromeCleanerDialogController; |
Fabio Tirelo | 8825aab4 | 2017-10-19 13:23:31 | [diff] [blame] | 54 | class ChromeCleanerRebootDialogController; |
Ali Tofigh | 525f78bdd | 2017-09-15 15:37:20 | [diff] [blame] | 55 | class SettingsResetPromptController; |
Josh Pratt | f80ffb8 | 2019-01-22 07:13:51 | [diff] [blame] | 56 | } // namespace safe_browsing |
alito | e82b14b | 2017-04-06 23:11:29 | [diff] [blame] | 57 | |
avi | 24d693f | 2016-08-06 18:03:52 | [diff] [blame] | 58 | namespace task_manager { |
nick | bb57d2ca | 2016-07-25 23:08:04 | [diff] [blame] | 59 | class TaskManagerTableModel; |
| 60 | } |
| 61 | |
[email protected] | 20c07f8e | 2012-05-31 08:43:14 | [diff] [blame] | 62 | namespace ui { |
| 63 | class WebDialogDelegate; |
Peter Boström | 2a02a69 | 2018-02-22 22:25:46 | [diff] [blame] | 64 | struct SelectedFileInfo; |
Josh Pratt | f80ffb8 | 2019-01-22 07:13:51 | [diff] [blame] | 65 | } // namespace ui |
[email protected] | 20c07f8e | 2012-05-31 08:43:14 | [diff] [blame] | 66 | |
[email protected] | 87586fb7 | 2012-07-02 13:15:02 | [diff] [blame] | 67 | namespace chrome { |
[email protected] | c96531e8 | 2011-01-26 03:11:14 | [diff] [blame] | 68 | |
tapted | e0eec37 | 2016-01-28 02:45:33 | [diff] [blame] | 69 | // Shows or hides the Task Manager. |browser| can be NULL when called from Ash. |
nick | 399f1066 | 2016-05-06 16:20:26 | [diff] [blame] | 70 | // Returns a pointer to the underlying TableModel, which can be ignored, or used |
| 71 | // for testing. |
avi | 24d693f | 2016-08-06 18:03:52 | [diff] [blame] | 72 | task_manager::TaskManagerTableModel* ShowTaskManager(Browser* browser); |
tapted | e0eec37 | 2016-01-28 02:45:33 | [diff] [blame] | 73 | void HideTaskManager(); |
| 74 | |
| 75 | #if !defined(OS_MACOSX) |
[email protected] | d7db4cd | 2012-06-27 04:58:44 | [diff] [blame] | 76 | // Creates and shows an HTML dialog with the given delegate and context. |
| 77 | // The window is automatically destroyed when it is closed. |
[email protected] | eb2d790 | 2011-02-02 18:19:56 | [diff] [blame] | 78 | // Returns the created window. |
| 79 | // |
| 80 | // Make sure to use the returned window only when you know it is safe |
| 81 | // to do so, i.e. before OnDialogClosed() is called on the delegate. |
andresantoso | ba3ef5d7 | 2014-12-15 20:30:08 | [diff] [blame] | 82 | gfx::NativeWindow ShowWebDialog(gfx::NativeView parent, |
[email protected] | 6ae4f14 | 2012-06-13 19:48:20 | [diff] [blame] | 83 | content::BrowserContext* context, |
[email protected] | 20c07f8e | 2012-05-31 08:43:14 | [diff] [blame] | 84 | ui::WebDialogDelegate* delegate); |
jamescook | 1c6343d | 2016-10-25 16:58:50 | [diff] [blame] | 85 | #endif // !defined(OS_MACOSX) |
[email protected] | eb2d790 | 2011-02-02 18:19:56 | [diff] [blame] | 86 | |
[email protected] | 497783c | 2013-10-17 15:54:57 | [diff] [blame] | 87 | // Shows the create chrome app shortcut dialog box. |
[email protected] | 497783c | 2013-10-17 15:54:57 | [diff] [blame] | 88 | // |close_callback| may be null. |
[email protected] | 1148990bb | 2014-05-02 10:04:02 | [diff] [blame] | 89 | void ShowCreateChromeAppShortcutsDialog( |
| 90 | gfx::NativeWindow parent_window, |
| 91 | Profile* profile, |
| 92 | const extensions::Extension* app, |
| 93 | const base::Callback<void(bool /* created */)>& close_callback); |
[email protected] | 497783c | 2013-10-17 15:54:57 | [diff] [blame] | 94 | |
Michael McGreevy | 556227a5 | 2017-11-16 07:47:24 | [diff] [blame] | 95 | // Callback used to indicate whether a user has accepted the installation of a |
| 96 | // web app. The boolean parameter is true when the user accepts the dialog. The |
| 97 | // WebApplicationInfo parameter contains the information about the app, |
| 98 | // possibly modified by the user. |
| 99 | using AppInstallationAcceptanceCallback = |
tapted | 712c1b8 | 2017-06-08 03:10:05 | [diff] [blame] | 100 | base::OnceCallback<void(bool, const WebApplicationInfo&)>; |
| 101 | |
| 102 | // Shows the Bookmark App bubble. |
| 103 | // See Extension::InitFromValueFlags::FROM_BOOKMARK for a description of |
| 104 | // bookmark apps. |
| 105 | // |
| 106 | // |web_app_info| is the WebApplicationInfo being converted into an app. |
Michael McGreevy | 556227a5 | 2017-11-16 07:47:24 | [diff] [blame] | 107 | void ShowBookmarkAppDialog(content::WebContents* web_contents, |
tapted | 712c1b8 | 2017-06-08 03:10:05 | [diff] [blame] | 108 | const WebApplicationInfo& web_app_info, |
Michael McGreevy | 556227a5 | 2017-11-16 07:47:24 | [diff] [blame] | 109 | AppInstallationAcceptanceCallback callback); |
| 110 | |
Alan Cutter | 81ac72668 | 2018-09-25 00:18:36 | [diff] [blame] | 111 | // Sets whether |ShowBookmarkAppDialog| should accept immediately without any |
| 112 | // user interaction. |
| 113 | void SetAutoAcceptBookmarkAppDialogForTesting(bool auto_accept); |
| 114 | |
Michael McGreevy | 556227a5 | 2017-11-16 07:47:24 | [diff] [blame] | 115 | // Shows the PWA installation confirmation bubble. |
| 116 | // |
| 117 | // |web_app_info| is the WebApplicationInfo to be installed. |
| 118 | void ShowPWAInstallDialog(content::WebContents* web_contents, |
| 119 | const WebApplicationInfo& web_app_info, |
| 120 | AppInstallationAcceptanceCallback callback); |
tapted | 712c1b8 | 2017-06-08 03:10:05 | [diff] [blame] | 121 | |
Alan Cutter | 81ac72668 | 2018-09-25 00:18:36 | [diff] [blame] | 122 | // Sets whether |ShowPWAInstallDialog| should accept immediately without any |
| 123 | // user interaction. |
| 124 | void SetAutoAcceptPWAInstallDialogForTesting(bool auto_accept); |
| 125 | |
tapted | 081286e | 2015-08-10 06:36:30 | [diff] [blame] | 126 | #if defined(OS_MACOSX) |
| 127 | |
spqchan | d33344a | 2016-04-13 02:10:51 | [diff] [blame] | 128 | // Bridging methods that show/hide the toolkit-views based Task Manager on Mac. |
avi | 24d693f | 2016-08-06 18:03:52 | [diff] [blame] | 129 | task_manager::TaskManagerTableModel* ShowTaskManagerViews(Browser* browser); |
spqchan | d33344a | 2016-04-13 02:10:51 | [diff] [blame] | 130 | void HideTaskManagerViews(); |
| 131 | |
kerrnel | 28a279f9 | 2017-01-27 05:22:26 | [diff] [blame] | 132 | // Show the Views "Chrome Update" dialog. |
| 133 | void ShowUpdateChromeDialogViews(gfx::NativeWindow parent); |
| 134 | |
tapted | 081286e | 2015-08-10 06:36:30 | [diff] [blame] | 135 | #endif // OS_MACOSX |
| 136 | |
| 137 | #if defined(TOOLKIT_VIEWS) |
| 138 | |
| 139 | // Creates a toolkit-views based LoginHandler (e.g. HTTP-Auth dialog). |
David Benjamin | 78fe596 | 2019-01-29 22:22:38 | [diff] [blame^] | 140 | std::unique_ptr<LoginHandler> CreateLoginHandlerViews( |
Jun Cai | bc561f41 | 2018-02-28 18:41:39 | [diff] [blame] | 141 | net::AuthChallengeInfo* auth_info, |
David Benjamin | 78fe596 | 2019-01-29 22:22:38 | [
|