Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Side by Side Diff: chrome/browser/ui/simple_message_box.h

Issue 2929953002: Make profile error dialog async (Closed)
Patch Set: for #3 comments Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/callback_forward.h"
8 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
9 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
10 #include "ui/gfx/native_widget_types.h" 11 #include "ui/gfx/native_widget_types.h"
11 12
12 namespace chrome { 13 namespace chrome {
13 14
14 enum MessageBoxResult { 15 enum MessageBoxResult {
15 // User chose NO or CANCEL. If there's a checkbox, then the checkbox was 16 // User chose NO or CANCEL. If there's a checkbox, then the checkbox was
16 // unchecked. 17 // unchecked.
17 MESSAGE_BOX_RESULT_NO = 0, 18 MESSAGE_BOX_RESULT_NO = 0,
(...skipping 11 matching lines...) Expand all
29 // non-NULL, the box will be made modal to the |parent|, except on Mac, where it 30 // non-NULL, the box will be made modal to the |parent|, except on Mac, where it
30 // is always app-modal. 31 // is always app-modal.
31 // 32 //
32 // NOTE: In general, you should avoid this since it's usually poor UI. 33 // NOTE: In general, you should avoid this since it's usually poor UI.
33 // We have a variety of other surfaces such as app menu notifications and 34 // We have a variety of other surfaces such as app menu notifications and
34 // infobars; consult the UI leads for a recommendation. 35 // infobars; consult the UI leads for a recommendation.
35 void ShowWarningMessageBox(gfx::NativeWindow parent, 36 void ShowWarningMessageBox(gfx::NativeWindow parent,
36 const base::string16& title, 37 const base::string16& title,
37 const base::string16& message); 38 const base::string16& message);
38 39
39 // As above, but with a checkbox. Returns true if the checkbox was checked when 40 // As above, but shows the dialog box asynchronously with a checkbox.
40 // the dialog was dismissed, false otherwise. 41 // |callback| will be invoked after the dialog is dismissed. It is invoked with
41 bool ShowWarningMessageBoxWithCheckbox(gfx::NativeWindow parent, 42 // true if the checkbox is checked and false otherwise.
42 const base::string16& title, 43 void ShowWarningMessageBoxWithCheckbox(
43 const base::string16& message, 44 gfx::NativeWindow parent,
44 const base::string16& checkbox_text); 45 const base::string16& title,
46 const base::string16& message,
47 const base::string16& checkbox_text,
48 base::OnceCallback<void(bool checked)> callback);
45 49
46 // As above, but two buttons are displayed and the return value indicates which 50 // As above, but two buttons are displayed and the return value indicates which
47 // is chosen. 51 // is chosen.
48 MessageBoxResult ShowQuestionMessageBox(gfx::NativeWindow parent, 52 MessageBoxResult ShowQuestionMessageBox(gfx::NativeWindow parent,
49 const base::string16& title, 53 const base::string16& title,
50 const base::string16& message); 54 const base::string16& message);
51 55
52 // Shows a dialog box with the given |title| and |message|, and with two buttons 56 // Shows a dialog box with the given |title| and |message|, and with two buttons
53 // labeled with |yes_text| and |no_text|. If |parent| is non-NULL, the box will 57 // labeled with |yes_text| and |no_text|. If |parent| is non-NULL, the box will
54 // be made modal to the |parent|. (Aura only.) 58 // be made modal to the |parent|. (Aura only.)
55 // 59 //
56 // NOTE: In general, you should avoid this since it's usually poor UI. 60 // NOTE: In general, you should avoid this since it's usually poor UI.
57 // We have a variety of other surfaces such as app menu notifications and 61 // We have a variety of other surfaces such as app menu notifications and
58 // infobars; consult the UI leads for a recommendation. 62 // infobars; consult the UI leads for a recommendation.
59 MessageBoxResult ShowMessageBoxWithButtonText(gfx::NativeWindow parent, 63 MessageBoxResult ShowMessageBoxWithButtonText(gfx::NativeWindow parent,
60 const base::string16& title, 64 const base::string16& title,
61 const base::string16& message, 65 const base::string16& message,
62 const base::string16& yes_text, 66 const base::string16& yes_text,
63 const base::string16& no_text); 67 const base::string16& no_text);
64 68
65 // Closes the current message box, if any, accepting or declining based on 69 // Closes the current message box, if any, accepting or declining based on
66 // |accept|. Returns whether there was a message box showing. 70 // |accept|. Returns whether there was a message box showing.
67 bool CloseMessageBoxForTest(bool accept) WARN_UNUSED_RESULT; 71 bool CloseMessageBoxForTest(bool accept) WARN_UNUSED_RESULT;
68 72
69 } // namespace chrome 73 } // namespace chrome
70 74
71 #endif // CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_ 75 #endif // CHROME_BROWSER_UI_SIMPLE_MESSAGE_BOX_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/profile_error_dialog.cc ('k') | chrome/browser/ui/views/simple_message_box_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698