Chromium Code Reviews| 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 cc6211df372d6dd9b458c1467dc8570c52d91417..087e064dd004150fdb5616f2f73732684c904904 100644 |
| --- a/chrome/browser/ui/views/simple_message_box_views.cc |
| +++ b/chrome/browser/ui/views/simple_message_box_views.cc |
| @@ -22,6 +22,9 @@ |
| #include "ui/aura/client/dispatcher_client.h" |
| #include "ui/aura/env.h" |
| #include "ui/aura/root_window.h" |
| +#if defined(OS_WIN) |
| +#include "ui/base/win/message_box_win.h" |
| +#endif |
| #endif |
| namespace chrome { |
| @@ -174,6 +177,26 @@ MessageBoxResult ShowMessageBox(gfx::NativeWindow parent, |
| const string16& title, |
| const string16& message, |
| MessageBoxType type) { |
| +#if defined(USE_AURA) && defined(OS_WIN) |
|
sky
2013/08/19 16:56:12
Can you refactor simple_message_box_win.cc so that
|
| + // If we're very early, we can't show a GPU-based dialog, so fallback to |
| + // plain Windows MessageBox. |
| + if (!ui::ContextFactory::GetInstance()) { |
| + UINT flags = MB_SETFOREGROUND; |
| + if (type == MESSAGE_BOX_TYPE_QUESTION) { |
| + flags |= MB_YESNO; |
| + } else if (type == MESSAGE_BOX_TYPE_OK_CANCEL) { |
| + flags |= MB_OKCANCEL; |
| + } else { |
| + flags |= MB_OK; |
| + } |
| + flags |= ((type == MESSAGE_BOX_TYPE_INFORMATION) ? |
| + MB_ICONINFORMATION : MB_ICONWARNING); |
| + int result = ui::MessageBox(NULL, message, title, flags); |
| + return (result == IDYES || result == IDOK) ? |
| + MESSAGE_BOX_RESULT_YES : MESSAGE_BOX_RESULT_NO; |
| + } |
| +#endif |
| + |
| scoped_refptr<SimpleMessageBoxViews> dialog( |
| new SimpleMessageBoxViews(title, message, type)); |
| CreateBrowserModalDialogViews(dialog.get(), parent)->Show(); |