blob: 697dbdcd1a9cbf5ca33ac03359bb9b28508d9c5e [file] [log] [blame]
[email protected]c5e22aee52012-01-19 16:10:511// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]c96531e82011-01-26 03:11:142// 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]c96531e82011-01-26 03:11:147
David Benjamin78fe5962019-01-29 22:22:388#include <memory>
djacobo21e56e02016-07-02 01:14:319#include <string>
10#include <utility>
11#include <vector>
12
[email protected]6684dc8162013-06-03 14:05:0813#include "base/callback.h"
constantinae4c513e72017-02-07 02:14:1014#include "base/optional.h"
15#include "base/strings/string16.h"
avi655876a2015-12-25 07:18:1516#include "build/build_config.h"
jackhoub42a1f3d2015-08-24 05:53:2817#include "chrome/browser/ui/bookmarks/bookmark_editor.h"
Mark Pilgrim7cfcd112018-05-08 00:07:5618#include "content/public/browser/content_browser_client.h"
Jun Caibc561f412018-02-28 18:41:3919#include "content/public/browser/resource_request_info.h"
[email protected]cb805452013-05-22 15:16:2120#include "third_party/skia/include/core/SkColor.h"
[email protected]08397d52011-02-05 01:53:3821#include "ui/gfx/native_widget_types.h"
[email protected]c96531e82011-01-26 03:11:1422
[email protected]c60e2482011-02-11 23:46:3223class Browser;
tapted081286e2015-08-10 06:36:3024class LoginHandler;
[email protected]6684dc8162013-06-03 14:05:0825class Profile;
Giovanni Ortuño Urquidi97f8bd522017-06-16 04:04:3726class WebShareTarget;
tapted712c1b82017-06-08 03:10:0527struct WebApplicationInfo;
[email protected]eb2d7902011-02-02 18:19:5628
Peter Boström2a02a692018-02-22 22:25:4629namespace base {
30class FilePath;
31}
32
[email protected]2a6bc3e2011-12-28 23:51:3333namespace content {
[email protected]6ae4f142012-06-13 19:48:2034class BrowserContext;
[email protected]2a6bc3e2011-12-28 23:51:3335class WebContents;
Josh Prattf80ffb82019-01-22 07:13:5136} // namespace content
[email protected]2a6bc3e2011-12-28 23:51:3337
[email protected]1c321ee2012-05-21 03:02:3438namespace extensions {
39class Extension;
40}
41
tapted081286e2015-08-10 06:36:3042namespace net {
43class AuthChallengeInfo;
tapted081286e2015-08-10 06:36:3044}
45
anthonyvd3d7f9722016-12-07 18:43:5446namespace payments {
mathpf709499d2017-01-09 20:48:3647class PaymentRequest;
mathpf4bc50e2017-01-24 05:17:5048class PaymentRequestDialog;
Josh Prattf80ffb82019-01-22 07:13:5149} // namespace payments
anthonyvd3d7f9722016-12-07 18:43:5450
alitoe82b14b2017-04-06 23:11:2951namespace safe_browsing {
Ali Tofighf5baba982017-07-21 23:15:2352class ChromeCleanerController;
alitof8f753f62017-04-28 23:04:1053class ChromeCleanerDialogController;
Fabio Tirelo8825aab42017-10-19 13:23:3154class ChromeCleanerRebootDialogController;
Ali Tofigh525f78bdd2017-09-15 15:37:2055class SettingsResetPromptController;
Josh Prattf80ffb82019-01-22 07:13:5156} // namespace safe_browsing
alitoe82b14b2017-04-06 23:11:2957
avi24d693f2016-08-06 18:03:5258namespace task_manager {
nickbb57d2ca2016-07-25 23:08:0459class TaskManagerTableModel;
60}
61
[email protected]20c07f8e2012-05-31 08:43:1462namespace ui {
63class WebDialogDelegate;
Peter Boström2a02a692018-02-22 22:25:4664struct SelectedFileInfo;
Josh Prattf80ffb82019-01-22 07:13:5165} // namespace ui
[email protected]20c07f8e2012-05-31 08:43:1466
[email protected]87586fb72012-07-02 13:15:0267namespace chrome {
[email protected]c96531e82011-01-26 03:11:1468
taptede0eec372016-01-28 02:45:3369// Shows or hides the Task Manager. |browser| can be NULL when called from Ash.
nick399f10662016-05-06 16:20:2670// Returns a pointer to the underlying TableModel, which can be ignored, or used
71// for testing.
avi24d693f2016-08-06 18:03:5272task_manager::TaskManagerTableModel* ShowTaskManager(Browser* browser);
taptede0eec372016-01-28 02:45:3373void HideTaskManager();
74
75#if !defined(OS_MACOSX)
[email protected]d7db4cd2012-06-27 04:58:4476// Creates and shows an HTML dialog with the given delegate and context.
77// The window is automatically destroyed when it is closed.
[email protected]eb2d7902011-02-02 18:19:5678// 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.
andresantosoba3ef5d72014-12-15 20:30:0882gfx::NativeWindow ShowWebDialog(gfx::NativeView parent,
[email protected]6ae4f142012-06-13 19:48:2083 content::BrowserContext* context,
[email protected]20c07f8e2012-05-31 08:43:1484 ui::WebDialogDelegate* delegate);
jamescook1c6343d2016-10-25 16:58:5085#endif // !defined(OS_MACOSX)
[email protected]eb2d7902011-02-02 18:19:5686
[email protected]497783c2013-10-17 15:54:5787// Shows the create chrome app shortcut dialog box.
[email protected]497783c2013-10-17 15:54:5788// |close_callback| may be null.
[email protected]1148990bb2014-05-02 10:04:0289void 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]497783c2013-10-17 15:54:5794
Michael McGreevy556227a52017-11-16 07:47:2495// 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.
99using AppInstallationAcceptanceCallback =
tapted712c1b82017-06-08 03:10:05100 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 McGreevy556227a52017-11-16 07:47:24107void ShowBookmarkAppDialog(content::WebContents* web_contents,
tapted712c1b82017-06-08 03:10:05108 const WebApplicationInfo& web_app_info,
Michael McGreevy556227a52017-11-16 07:47:24109 AppInstallationAcceptanceCallback callback);
110
Alan Cutter81ac726682018-09-25 00:18:36111// Sets whether |ShowBookmarkAppDialog| should accept immediately without any
112// user interaction.
113void SetAutoAcceptBookmarkAppDialogForTesting(bool auto_accept);
114
Michael McGreevy556227a52017-11-16 07:47:24115// Shows the PWA installation confirmation bubble.
116//
117// |web_app_info| is the WebApplicationInfo to be installed.
118void ShowPWAInstallDialog(content::WebContents* web_contents,
119 const WebApplicationInfo& web_app_info,
120 AppInstallationAcceptanceCallback callback);
tapted712c1b82017-06-08 03:10:05121
Alan Cutter81ac726682018-09-25 00:18:36122// Sets whether |ShowPWAInstallDialog| should accept immediately without any
123// user interaction.
124void SetAutoAcceptPWAInstallDialogForTesting(bool auto_accept);
125
tapted081286e2015-08-10 06:36:30126#if defined(OS_MACOSX)
127
spqchand33344a2016-04-13 02:10:51128// Bridging methods that show/hide the toolkit-views based Task Manager on Mac.
avi24d693f2016-08-06 18:03:52129task_manager::TaskManagerTableModel* ShowTaskManagerViews(Browser* browser);
spqchand33344a2016-04-13 02:10:51130void HideTaskManagerViews();
131
kerrnel28a279f92017-01-27 05:22:26132// Show the Views "Chrome Update" dialog.
133void ShowUpdateChromeDialogViews(gfx::NativeWindow parent);
134
tapted081286e2015-08-10 06:36:30135#endif // OS_MACOSX
136
137#if defined(TOOLKIT_VIEWS)
138
139// Creates a toolkit-views based LoginHandler (e.g. HTTP-Auth dialog).
David Benjamin78fe5962019-01-29 22:22:38140std::unique_ptr<LoginHandler> CreateLoginHandlerViews(
Jun Caibc561f412018-02-28 18:41:39141 net::AuthChallengeInfo* auth_info,
David Benjamin78fe5962019-01-29 22:22:38