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

Unified Diff: components/printing/renderer/print_web_view_helper.cc

Issue 2962983002: Print Preview: change getPreview to cr.sendWithPromise (Closed)
Patch Set: Fix check Created 3 years, 6 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
Index: components/printing/renderer/print_web_view_helper.cc
diff --git a/components/printing/renderer/print_web_view_helper.cc b/components/printing/renderer/print_web_view_helper.cc
index b92da73ac14a2a332f8bbf03cb33e84bb2bbd29e..ca63359c7dc6669a3c85285513dca86c7aa97b24 100644
--- a/components/printing/renderer/print_web_view_helper.cc
+++ b/components/printing/renderer/print_web_view_helper.cc
@@ -1187,13 +1187,10 @@ void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) {
if (!UpdatePrintSettings(print_preview_context_.source_frame(),
print_preview_context_.source_node(), settings)) {
if (print_preview_context_.last_error() != PREVIEW_ERROR_BAD_SETTING) {
- Send(new PrintHostMsg_PrintPreviewInvalidPrinterSettings(
- routing_id(), print_pages_params_
- ? print_pages_params_->params.document_cookie
- : 0));
- notify_browser_of_print_failure_ = false; // Already sent.
+ DidFinishPrinting(INVALID_SETTINGS);
+ } else {
+ DidFinishPrinting(FAIL_PREVIEW);
}
- DidFinishPrinting(FAIL_PREVIEW);
return;
}
@@ -1557,6 +1554,8 @@ void PrintWebViewHelper::Print(blink::WebLocalFrame* frame,
#endif // BUILDFLAG(ENABLE_BASIC_PRINTING)
void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) {
+ int cookie =
+ print_pages_params_ ? print_pages_params_->params.document_cookie : 0;
switch (result) {
case OK:
break;
@@ -1567,15 +1566,12 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) {
case FAIL_PRINT:
if (notify_browser_of_print_failure_ && print_pages_params_) {
- int cookie = print_pages_params_->params.document_cookie;
Send(new PrintHostMsg_PrintingFailed(routing_id(), cookie));
}
break;
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
case FAIL_PREVIEW:
- int cookie =
- print_pages_params_ ? print_pages_params_->params.document_cookie : 0;
if (notify_browser_of_print_failure_) {
LOG(ERROR) << "CreatePreviewDocument failed";
Send(new PrintHostMsg_PrintPreviewFailed(routing_id(), cookie));
@@ -1584,6 +1580,11 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) {
}
print_preview_context_.Failed(notify_browser_of_print_failure_);
break;
+ case INVALID_SETTINGS:
+ Send(new PrintHostMsg_PrintPreviewInvalidPrinterSettings(routing_id(),
+ cookie));
+ print_preview_context_.Failed(false);
+ break;
#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
}
prep_frame_view_.reset();
« no previous file with comments | « components/printing/renderer/print_web_view_helper.h ('k') | components/printing/test/print_web_view_helper_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698