Chromium Code Reviews| 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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1026 | 1026 |
| 1027 // If we are previewing a pdf and the print scaling is disabled, send a | 1027 // If we are previewing a pdf and the print scaling is disabled, send a |
| 1028 // message to browser. | 1028 // message to browser. |
| 1029 if (print_pages_params_->params.is_first_request && | 1029 if (print_pages_params_->params.is_first_request && |
| 1030 !print_preview_context_.IsModifiable() && | 1030 !print_preview_context_.IsModifiable() && |
| 1031 print_preview_context_.source_frame()->isPrintScalingDisabledForPlugin( | 1031 print_preview_context_.source_frame()->isPrintScalingDisabledForPlugin( |
| 1032 print_preview_context_.source_node())) { | 1032 print_preview_context_.source_node())) { |
| 1033 Send(new PrintHostMsg_PrintPreviewScalingDisabled(routing_id())); | 1033 Send(new PrintHostMsg_PrintPreviewScalingDisabled(routing_id())); |
| 1034 } | 1034 } |
| 1035 | 1035 |
| 1036 // FIXME: Is this right approach? | |
| 1037 // Send a message to browser if number of copies to be printed information is | |
|
Vitaly Buka (NO REVIEWS)
2014/07/10 01:13:05
Should be inside of:
if (print_pages_params_->para
| |
| 1038 // available. | |
| 1039 int num_copies = print_preview_context_.source_frame()->getNumCopiesForPlugin( | |
| 1040 print_preview_context_.source_node()); | |
| 1041 if (print_pages_params_->params.is_first_request && num_copies) | |
| 1042 Send(new PrintHostMsg_PrintPreviewNumCopies(routing_id(), num_copies)); | |
|
Nikhil
2014/07/09 09:36:47
Is this right approach?
Vitaly Buka (NO REVIEWS)
2014/07/10 01:13:05
yes
| |
| 1043 | |
| 1036 is_print_ready_metafile_sent_ = false; | 1044 is_print_ready_metafile_sent_ = false; |
| 1037 | 1045 |
| 1038 // PDF printer device supports alpha blending. | 1046 // PDF printer device supports alpha blending. |
| 1039 print_pages_params_->params.supports_alpha_blend = true; | 1047 print_pages_params_->params.supports_alpha_blend = true; |
| 1040 | 1048 |
| 1041 bool generate_draft_pages = false; | 1049 bool generate_draft_pages = false; |
| 1042 if (!settings.GetBoolean(kSettingGenerateDraftData, | 1050 if (!settings.GetBoolean(kSettingGenerateDraftData, |
| 1043 &generate_draft_pages)) { | 1051 &generate_draft_pages)) { |
| 1044 NOTREACHED(); | 1052 NOTREACHED(); |
| 1045 } | 1053 } |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2022 } | 2030 } |
| 2023 | 2031 |
| 2024 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 2032 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
| 2025 prep_frame_view_.reset(); | 2033 prep_frame_view_.reset(); |
| 2026 metafile_.reset(); | 2034 metafile_.reset(); |
| 2027 pages_to_render_.clear(); | 2035 pages_to_render_.clear(); |
| 2028 error_ = PREVIEW_ERROR_NONE; | 2036 error_ = PREVIEW_ERROR_NONE; |
| 2029 } | 2037 } |
| 2030 | 2038 |
| 2031 } // namespace printing | 2039 } // namespace printing |
| OLD | NEW |