[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 { |
[email protected] | 24ced7dc0 | 2013-04-04 08:32:39 | [diff] [blame] | 14 | MESSAGE_BOX_RESULT_NO = 0, // User chose NO or CANCEL. |
| 15 | MESSAGE_BOX_RESULT_YES = 1, // User chose YES or OK. |
[email protected] | 5da155e | 2012-05-26 16:31:16 | [diff] [blame] | 16 | }; |
| 17 | |
[email protected] | d1f48ef5 | 2012-05-13 19:34:21 | [diff] [blame] | 18 | enum MessageBoxType { |
[email protected] | f8ef716 | 2013-11-22 01:56:41 | [diff] [blame] | 19 | MESSAGE_BOX_TYPE_INFORMATION, // Shows an OK button. |
| 20 | MESSAGE_BOX_TYPE_WARNING, // Shows an OK button. |
| 21 | MESSAGE_BOX_TYPE_QUESTION, // Shows YES and NO buttons. |
[email protected] | a6539cd | 2014-02-20 12:50:36 | [diff] [blame^] | 22 | MESSAGE_BOX_TYPE_OK_CANCEL, // Shows OK and CANCEL buttons (Aura only). |
[email protected] | d1f48ef5 | 2012-05-13 19:34:21 | [diff] [blame] | 23 | }; |
| 24 | |
[email protected] | 5da155e | 2012-05-26 16:31:16 | [diff] [blame] | 25 | // Shows a dialog box with the given |title| and |message|. If |parent| is |
| 26 | // 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] | 27 | // is always app-modal. |
[email protected] | 5da155e | 2012-05-26 16:31:16 | [diff] [blame] | 28 | // |
| 29 | // NOTE: In general, you should avoid this since it's usually poor UI. |
| 30 | // We have a variety of other surfaces such as wrench menu notifications and |
| 31 | // infobars; consult the UI leads for a recommendation. |
| 32 | MessageBoxResult ShowMessageBox(gfx::NativeWindow parent, |
[email protected] | dcd024987 | 2013-12-06 23:58:45 | [diff] [blame] | 33 | const base::string16& title, |
| 34 | const base::string16& message, |
[email protected] | 5da155e | 2012-05-26 16:31:16 | [diff] [blame] | 35 | MessageBoxType type); |
[email protected] | 80772ed | 2011-08-09 21:11:38 | [diff] [blame] | 36 | |
[email protected] | f8ef716 | 2013-11-22 01:56:41 | [diff] [blame] | 37 | // Shows a dialog box with the given |title| and |message|, and with two buttons |
| 38 | // labeled with |yes_text| and |no_text|. If |parent| is non-NULL, the box will |
| 39 | // be made modal to the |parent|. (Aura only.) |
| 40 | // |
| 41 | // NOTE: In general, you should avoid this since it's usually poor UI. |
| 42 | // We have a variety of other surfaces such as wrench menu notifications and |
| 43 | // infobars; consult the UI leads for a recommendation. |
| 44 | MessageBoxResult ShowMessageBoxWithButtonText(gfx::NativeWindow parent, |
[email protected] | dcd024987 | 2013-12-06 23:58:45 | [diff] [blame] | 45 | const base::string16& title, |
| 46 | const base::string16& message, |
| 47 | const base::string16& yes_text, |
| 48 | const base::string16& no_text); |
[email protected] | f8ef716 | 2013-11-22 01:56:41 | [diff] [blame] | 49 | |
[email protected] | d3322029 | 2012-07-04 01:41:27 | [diff] [blame] | 50 | } // namespace chrome |
[email protected] | 80772ed | 2011-08-09 21:11:38 | [diff] [blame] | 51 | |
[email protected] | b50892c5f | 2012-05-13 07:34:14 | [diff] [blame] | 52 | #endif // CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_ |