[email protected] | 5c61cc9 | 2012-04-23 02:00:39 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 80772ed | 2011-08-09 21:11:38 | [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 | |
[email protected] | b50892c5f | 2012-05-13 07:34:14 | [diff] [blame] | 5 | #ifndef CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_ |
| 6 | #define CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_ |
[email protected] | 80772ed | 2011-08-09 21:11:38 | [diff] [blame] | 7 | |
[email protected] | f92d6588 | 2013-06-10 22:02:36 | [diff] [blame] | 8 | #include "base/strings/string16.h" |
[email protected] | 80772ed | 2011-08-09 21:11:38 | [diff] [blame] | 9 | #include "ui/gfx/native_widget_types.h" |
| 10 | |
[email protected] | d3322029 | 2012-07-04 01:41:27 | [diff] [blame] | 11 | namespace chrome { |
[email protected] | 80772ed | 2011-08-09 21:11:38 | [diff] [blame] | 12 | |
[email protected] | 5da155e | 2012-05-26 16:31:16 | [diff] [blame] | 13 | enum MessageBoxResult { |
afakhry | 7c9abe7 | 2016-08-05 17:33:19 | [diff] [blame] | 14 | // User chose NO or CANCEL. If there's a checkbox, then the checkbox was |
| 15 | // unchecked. |
| 16 | MESSAGE_BOX_RESULT_NO = 0, |
| 17 | |
| 18 | // User chose YES or OK. If there's a checkbox, then the checkbox was checked. |
| 19 | MESSAGE_BOX_RESULT_YES = 1, |
[email protected] | 5da155e | 2012-05-26 16:31:16 | [diff] [blame] | 20 | }; |
| 21 | |
[email protected] | d1f48ef5 | 2012-05-13 19:34:21 | [diff] [blame] | 22 | enum MessageBoxType { |
[email protected] | f8ef716 | 2013-11-22 01:56:41 | [diff] [blame] | 23 | MESSAGE_BOX_TYPE_WARNING, // Shows an OK button. |
| 24 | MESSAGE_BOX_TYPE_QUESTION, // Shows YES and NO buttons. |
[email protected] | d1f48ef5 | 2012-05-13 19:34:21 | [diff] [blame] | 25 | }; |
| 26 | |
[email protected] | 5da155e | 2012-05-26 16:31:16 | [diff] [blame] | 27 | // Shows a dialog box with the given |title| and |message|. If |parent| is |
| 28 | // non-NULL, the box will be made modal to the |parent|, except on Mac, where it |
[email protected] | 24ced7dc0 | 2013-04-04 08:32:39 | [diff] [blame] | 29 | // is always app-modal. |
[email protected] | 5da155e | 2012-05-26 16:31:16 | [diff] [blame] | 30 | // |
| 31 | // NOTE: In general, you should avoid this since it's usually poor UI. |
tfarina | 917cff5e | 2015-10-31 01:16:38 | [diff] [blame] | 32 | // We have a variety of other surfaces such as app menu notifications and |
[email protected] | 5da155e | 2012-05-26 16:31:16 | [diff] [blame] | 33 | // infobars; consult the UI leads for a recommendation. |
estade | e16f96ed | 2016-03-07 22:57:05 | [diff] [blame] | 34 | void ShowWarningMessageBox(gfx::NativeWindow parent, |
| 35 | const base::string16& title, |
| 36 | const base::string16& message); |
| 37 | |
afakhry | 7c9abe7 | 2016-08-05 17:33:19 | [diff] [blame] | 38 | // As above, but with a checkbox. Returns true if the checkbox was checked when |
| 39 | // the dialog was dismissed, false otherwise. |
| 40 | bool ShowWarningMessageBoxWithCheckbox(gfx::NativeWindow parent, |
| 41 | const base::string16& title, |
| 42 | const base::string16& message, |
| 43 | const base::string16& checkbox_text); |
| 44 | |
estade | e16f96ed | 2016-03-07 22:57:05 | [diff] [blame] | 45 | // As above, but two buttons are displayed and the return value indicates which |
| 46 | // is chosen. |
| 47 | MessageBoxResult ShowQuestionMessageBox(gfx::NativeWindow parent, |
| 48 | const base::string16& title, |
| 49 | const base::string16& message); |
[email protected] | 80772ed | 2011-08-09 21:11:38 | [diff] [blame] | 50 | |
[email protected] | f8ef716 | 2013-11-22 01:56:41 | [diff] [blame] | 51 | // Shows a dialog box with the given |title| and |message|, and with two buttons |
| 52 | // labeled with |yes_text| and |no_text|. If |parent| is non-NULL, the box will |
| 53 | // be made modal to the |parent|. (Aura only.) |
| 54 | // |
| 55 | // NOTE: In general, you should avoid this since it's usually poor UI. |
tfarina | 917cff5e | 2015-10-31 01:16:38 | [diff] [blame] | 56 | // We have a variety of other surfaces such as app menu notifications and |
[email protected] | f8ef716 | 2013-11-22 01:56:41 | [diff] [blame] | 57 | // infobars; consult the UI leads for a recommendation. |
| 58 | MessageBoxResult ShowMessageBoxWithButtonText(gfx::NativeWindow parent, |
[email protected] | dcd024987 | 2013-12-06 23:58:45 | [diff] [blame] | 59 | const base::string16& title, |
| 60 | const base::string16& message, |
| 61 | const base::string16& yes_text, |
| 62 | const base::string16& no_text); |
[email protected] | f8ef716 | 2013-11-22 01:56:41 | [diff] [blame] | 63 | |
[email protected] | d3322029 | 2012-07-04 01:41:27 | [diff] [blame] | 64 | } // namespace chrome |
[email protected] | 80772ed | 2011-08-09 21:11:38 | [diff] [blame] | 65 | |
[email protected] | b50892c5f | 2012-05-13 07:34:14 | [diff] [blame] | 66 | #endif // CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_ |