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

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

Issue 261753015: SimpleMessageBoxViews: UI message loop does not need to be running on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test if ResourceBundle is initialized Created 6 years, 7 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 | « no previous file | no next file » | 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 29d9e6d4848cc7376057960cd0273f955977f63a..b3da0901933a542012603837be33fd5d410e7141 100644
--- a/chrome/browser/ui/views/simple_message_box_views.cc
+++ b/chrome/browser/ui/views/simple_message_box_views.cc
@@ -11,6 +11,7 @@
#include "grit/generated_resources.h"
#include "ui/aura/window.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/controls/message_box_view.h"
#include "ui/views/widget/widget.h"
@@ -195,21 +196,26 @@ MessageBoxResult ShowMessageBoxImpl(gfx::NativeWindow parent,
MessageBoxType type,
const base::string16& yes_text,
const base::string16& no_text) {
- // Views dialogs cannot be shown outside the UI thread message loop.
+ // Views dialogs cannot be shown outside the UI thread message loop or if the
+ // ResourceBundle is not initialized yet.
// Fallback to logging with a default response or a Windows MessageBox.
- if (!base::MessageLoopForUI::IsCurrent() ||
- !base::MessageLoopForUI::current()->is_running()) {
#if defined(OS_WIN)
+ if (!base::MessageLoopForUI::IsCurrent() ||
+ !base::MessageLoopForUI::current()->is_running() ||
+ !ResourceBundle::HasSharedInstance()) {
int result = ui::MessageBox(views::HWNDForNativeWindow(parent), message,
title, GetMessageBoxFlagsFromType(type));
return (result == IDYES || result == IDOK) ?
MESSAGE_BOX_RESULT_YES : MESSAGE_BOX_RESULT_NO;
+ }
#else
+ if (!base::MessageLoopForUI::IsCurrent() ||
+ !ResourceBundle::HasSharedInstance()) {
LOG(ERROR) << "Unable to show a dialog outside the UI thread message loop: "
<< title << " - " << message;
return MESSAGE_BOX_RESULT_NO;
-#endif
}
+#endif
MessageBoxResult result = MESSAGE_BOX_RESULT_NO;
SimpleMessageBoxViews* dialog = new SimpleMessageBoxViews(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698