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

Unified Diff: chrome/browser/ui/views/simple_message_box_views.cc

Issue 2441403003: Use a standard message box for DesktopCastingWarningView. (Closed)
Patch Set: msw review Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/simple_message_box.h ('k') | components/constrained_window/constrained_window_views.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/simple_message_box_views.cc
diff --git a/chrome/browser/ui/views/simple_message_box_views.cc b/chrome/browser/ui/views/simple_message_box_views.cc
index 4eee13d9bbbd578f364f10bd44db81ef41033ce1..91c219394eff2a5b098cd8d88d6deecae3c9b67b 100644
--- a/chrome/browser/ui/views/simple_message_box_views.cc
+++ b/chrome/browser/ui/views/simple_message_box_views.cc
@@ -73,6 +73,9 @@ class SimpleMessageBoxViews : public views::DialogDelegate {
DISALLOW_COPY_AND_ASSIGN(SimpleMessageBoxViews);
};
+// The currently showing message box, if there is one. Used for tests.
+SimpleMessageBoxViews* g_current_message_box = nullptr;
+
////////////////////////////////////////////////////////////////////////////////
// SimpleMessageBoxViews, public:
@@ -112,6 +115,7 @@ SimpleMessageBoxViews::~SimpleMessageBoxViews() {
}
MessageBoxResult SimpleMessageBoxViews::RunDialogAndGetResult() {
+ g_current_message_box = this;
MessageBoxResult result = MESSAGE_BOX_RESULT_NO;
result_ = &result;
// TODO(pkotwicz): Exit message loop when the dialog is closed by some other
@@ -121,6 +125,7 @@ MessageBoxResult SimpleMessageBoxViews::RunDialogAndGetResult() {
base::RunLoop run_loop;
quit_runloop_ = run_loop.QuitClosure();
run_loop.Run();
+ g_current_message_box = nullptr;
return result;
}
@@ -247,6 +252,17 @@ MessageBoxResult ShowMessageBoxImpl(gfx::NativeWindow parent,
} // namespace
+bool CloseMessageBoxForTest(bool accept) {
+ if (!g_current_message_box)
+ return false;
+
+ if (accept)
+ g_current_message_box->Accept();
+ else
+ g_current_message_box->Cancel();
+ return true;
+}
+
void ShowWarningMessageBox(gfx::NativeWindow parent,
const base::string16& title,
const base::string16& message) {
« no previous file with comments | « chrome/browser/ui/simple_message_box.h ('k') | components/constrained_window/constrained_window_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698