| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_ | 5 #ifndef CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_ |
| 6 #define CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_ | 6 #define CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_ |
| 7 | 7 |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
| 10 | 10 |
| 11 namespace chrome { | 11 namespace chrome { |
| 12 | 12 |
| 13 enum MessageBoxResult { | 13 enum MessageBoxResult { |
| 14 MESSAGE_BOX_RESULT_NO = 0, // User chose NO or CANCEL. | 14 // User chose NO or CANCEL. If there's a checkbox, then the checkbox was |
| 15 MESSAGE_BOX_RESULT_YES = 1, // User chose YES or OK. | 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, |
| 16 }; | 20 }; |
| 17 | 21 |
| 18 enum MessageBoxType { | 22 enum MessageBoxType { |
| 19 MESSAGE_BOX_TYPE_WARNING, // Shows an OK button. | 23 MESSAGE_BOX_TYPE_WARNING, // Shows an OK button. |
| 20 MESSAGE_BOX_TYPE_QUESTION, // Shows YES and NO buttons. | 24 MESSAGE_BOX_TYPE_QUESTION, // Shows YES and NO buttons. |
| 21 }; | 25 }; |
| 22 | 26 |
| 23 // Shows a dialog box with the given |title| and |message|. If |parent| is | 27 // Shows a dialog box with the given |title| and |message|. If |parent| is |
| 24 // non-NULL, the box will be made modal to the |parent|, except on Mac, where it | 28 // non-NULL, the box will be made modal to the |parent|, except on Mac, where it |
| 25 // is always app-modal. | 29 // is always app-modal. |
| 26 // | 30 // |
| 27 // NOTE: In general, you should avoid this since it's usually poor UI. | 31 // NOTE: In general, you should avoid this since it's usually poor UI. |
| 28 // We have a variety of other surfaces such as app menu notifications and | 32 // We have a variety of other surfaces such as app menu notifications and |
| 29 // infobars; consult the UI leads for a recommendation. | 33 // infobars; consult the UI leads for a recommendation. |
| 30 void ShowWarningMessageBox(gfx::NativeWindow parent, | 34 void ShowWarningMessageBox(gfx::NativeWindow parent, |
| 31 const base::string16& title, | 35 const base::string16& title, |
| 32 const base::string16& message); | 36 const base::string16& message); |
| 33 | 37 |
| 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 |
| 34 // As above, but two buttons are displayed and the return value indicates which | 45 // As above, but two buttons are displayed and the return value indicates which |
| 35 // is chosen. | 46 // is chosen. |
| 36 MessageBoxResult ShowQuestionMessageBox(gfx::NativeWindow parent, | 47 MessageBoxResult ShowQuestionMessageBox(gfx::NativeWindow parent, |
| 37 const base::string16& title, | 48 const base::string16& title, |
| 38 const base::string16& message); | 49 const base::string16& message); |
| 39 | 50 |
| 40 // Shows a dialog box with the given |title| and |message|, and with two buttons | 51 // Shows a dialog box with the given |title| and |message|, and with two buttons |
| 41 // labeled with |yes_text| and |no_text|. If |parent| is non-NULL, the box will | 52 // labeled with |yes_text| and |no_text|. If |parent| is non-NULL, the box will |
| 42 // be made modal to the |parent|. (Aura only.) | 53 // be made modal to the |parent|. (Aura only.) |
| 43 // | 54 // |
| 44 // NOTE: In general, you should avoid this since it's usually poor UI. | 55 // NOTE: In general, you should avoid this since it's usually poor UI. |
| 45 // We have a variety of other surfaces such as app menu notifications and | 56 // We have a variety of other surfaces such as app menu notifications and |
| 46 // infobars; consult the UI leads for a recommendation. | 57 // infobars; consult the UI leads for a recommendation. |
| 47 MessageBoxResult ShowMessageBoxWithButtonText(gfx::NativeWindow parent, | 58 MessageBoxResult ShowMessageBoxWithButtonText(gfx::NativeWindow parent, |
| 48 const base::string16& title, | 59 const base::string16& title, |
| 49 const base::string16& message, | 60 const base::string16& message, |
| 50 const base::string16& yes_text, | 61 const base::string16& yes_text, |
| 51 const base::string16& no_text); | 62 const base::string16& no_text); |
| 52 | 63 |
| 53 } // namespace chrome | 64 } // namespace chrome |
| 54 | 65 |
| 55 #endif // CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_ | 66 #endif // CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_ |
| OLD | NEW |