| Index: chrome/browser/printing/print_view_manager_base.cc
|
| diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc
|
| index a13e643a67cec6ad83b1041ea6f4d79305c332e7..edc5aa6deafb237f1771bda5f952d41bf8c04fb2 100644
|
| --- a/chrome/browser/printing/print_view_manager_base.cc
|
| +++ b/chrome/browser/printing/print_view_manager_base.cc
|
| @@ -4,6 +4,7 @@
|
|
|
| #include "chrome/browser/printing/print_view_manager_base.h"
|
|
|
| +#include "base/auto_reset.h"
|
| #include "base/bind.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/prefs/pref_service.h"
|
| @@ -40,6 +41,18 @@ namespace printing {
|
|
|
| namespace {
|
|
|
| +void ShowWarningMessageBox(const base::string16& message) {
|
| + // Runs always on the UI thread.
|
| + static bool is_dialog_shown = false;
|
| + if (is_dialog_shown)
|
| + return;
|
| + // Block opening dialog from nested task.
|
| + base::AutoReset<bool> auto_reset(&is_dialog_shown, true);
|
| +
|
| + chrome::ShowMessageBox(nullptr, base::string16(), message,
|
| + chrome::MESSAGE_BOX_TYPE_WARNING);
|
| +}
|
| +
|
| } // namespace
|
|
|
| PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
|
| @@ -195,11 +208,10 @@ void PrintViewManagerBase::OnPrintingFailed(int cookie) {
|
| }
|
|
|
| void PrintViewManagerBase::OnShowInvalidPrinterSettingsError() {
|
| - chrome::ShowMessageBox(NULL,
|
| - base::string16(),
|
| - l10n_util::GetStringUTF16(
|
| - IDS_PRINT_INVALID_PRINTER_SETTINGS),
|
| - chrome::MESSAGE_BOX_TYPE_WARNING);
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE, base::Bind(&ShowWarningMessageBox,
|
| + l10n_util::GetStringUTF16(
|
| + IDS_PRINT_INVALID_PRINTER_SETTINGS)));
|
| }
|
|
|
| void PrintViewManagerBase::DidStartLoading() {
|
|
|