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

Unified Diff: chrome/browser/printing/print_view_manager_base.cc

Issue 1083433003: Fix crash from ipc_fuzzer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fri Apr 10 17:22:28 PDT 2015 Created 5 years, 8 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/printing/print_job_worker.cc ('k') | printing/printing_context_system_dialog_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « chrome/browser/printing/print_job_worker.cc ('k') | printing/printing_context_system_dialog_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698