OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/renderer/printing/print_web_view_helper.h" | 5 #include "chrome/renderer/printing/print_web_view_helper.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1457 modified_job_settings.SetBoolean(kSettingHeaderFooterEnabled, false); | 1457 modified_job_settings.SetBoolean(kSettingHeaderFooterEnabled, false); |
1458 modified_job_settings.SetInteger(kSettingMarginsType, NO_MARGINS); | 1458 modified_job_settings.SetInteger(kSettingMarginsType, NO_MARGINS); |
1459 job_settings = &modified_job_settings; | 1459 job_settings = &modified_job_settings; |
1460 } | 1460 } |
1461 | 1461 |
1462 // Send the cookie so that UpdatePrintSettings can reuse PrinterQuery when | 1462 // Send the cookie so that UpdatePrintSettings can reuse PrinterQuery when |
1463 // possible. | 1463 // possible. |
1464 int cookie = print_pages_params_ ? | 1464 int cookie = print_pages_params_ ? |
1465 print_pages_params_->params.document_cookie : 0; | 1465 print_pages_params_->params.document_cookie : 0; |
1466 PrintMsg_PrintPages_Params settings; | 1466 PrintMsg_PrintPages_Params settings; |
| 1467 bool canceled = false; |
1467 Send(new PrintHostMsg_UpdatePrintSettings( | 1468 Send(new PrintHostMsg_UpdatePrintSettings( |
1468 routing_id(), cookie, *job_settings, &settings)); | 1469 routing_id(), cookie, *job_settings, &settings, &canceled)); |
| 1470 if (canceled) { |
| 1471 notify_browser_of_print_failure_ = false; |
| 1472 return false; |
| 1473 } |
1469 | 1474 |
1470 if (!job_settings->GetInteger(kPreviewUIID, &settings.params.preview_ui_id)) { | 1475 if (!job_settings->GetInteger(kPreviewUIID, &settings.params.preview_ui_id)) { |
1471 NOTREACHED(); | 1476 NOTREACHED(); |
1472 print_preview_context_.set_error(PREVIEW_ERROR_BAD_SETTING); | 1477 print_preview_context_.set_error(PREVIEW_ERROR_BAD_SETTING); |
1473 return false; | 1478 return false; |
1474 } | 1479 } |
1475 | 1480 |
1476 if (!print_for_preview_) { | 1481 if (!print_for_preview_) { |
1477 // Validate expected print preview settings. | 1482 // Validate expected print preview settings. |
1478 if (!job_settings->GetInteger(kPreviewRequestID, | 1483 if (!job_settings->GetInteger(kPreviewRequestID, |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 } | 1964 } |
1960 | 1965 |
1961 void PrintWebViewHelper::SetPrintPagesParams( | 1966 void PrintWebViewHelper::SetPrintPagesParams( |
1962 const PrintMsg_PrintPages_Params& settings) { | 1967 const PrintMsg_PrintPages_Params& settings) { |
1963 print_pages_params_.reset(new PrintMsg_PrintPages_Params(settings)); | 1968 print_pages_params_.reset(new PrintMsg_PrintPages_Params(settings)); |
1964 Send(new PrintHostMsg_DidGetDocumentCookie(routing_id(), | 1969 Send(new PrintHostMsg_DidGetDocumentCookie(routing_id(), |
1965 settings.params.document_cookie)); | 1970 settings.params.document_cookie)); |
1966 } | 1971 } |
1967 | 1972 |
1968 } // namespace printing | 1973 } // namespace printing |
OLD | NEW |