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 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1005 notify_browser_of_print_failure_ = false; // Already sent. | 1005 notify_browser_of_print_failure_ = false; // Already sent. |
| 1006 } | 1006 } |
| 1007 DidFinishPrinting(FAIL_PREVIEW); | 1007 DidFinishPrinting(FAIL_PREVIEW); |
| 1008 return; | 1008 return; |
| 1009 } | 1009 } |
| 1010 | 1010 |
| 1011 // Set the options from document if we are previewing a pdf and send a | 1011 // Set the options from document if we are previewing a pdf and send a |
| 1012 // message to browser. | 1012 // message to browser. |
| 1013 if (print_pages_params_->params.is_first_request && | 1013 if (print_pages_params_->params.is_first_request && |
| 1014 !print_preview_context_.IsModifiable()) { | 1014 !print_preview_context_.IsModifiable()) { |
| 1015 PrintHostMsg_SetOptionsFromDocument_Params params; | 1015 PrintHostMsg_SetOptionsFromDocument_Params params; |
|
Vitaly Buka (NO REVIEWS)
2014/09/03 21:36:24
Why this one is not enough? becase of out-of-proce
Nikhil
2014/09/04 11:42:53
This one is enough when we use PPP interfaces i.e.
Vitaly Buka (NO REVIEWS)
2014/09/08 18:52:26
Discussed in chat.
On 2014/09/04 11:42:53, Nikhil
| |
| 1016 SetOptionsFromDocument(params); | 1016 SetOptionsFromDocument(params); |
| 1017 Send(new PrintHostMsg_SetOptionsFromDocument(routing_id(), params)); | 1017 Send(new PrintHostMsg_SetOptionsFromDocument(routing_id(), params)); |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 is_print_ready_metafile_sent_ = false; | 1020 is_print_ready_metafile_sent_ = false; |
| 1021 | 1021 |
| 1022 // PDF printer device supports alpha blending. | 1022 // PDF printer device supports alpha blending. |
| 1023 print_pages_params_->params.supports_alpha_blend = true; | 1023 print_pages_params_->params.supports_alpha_blend = true; |
| 1024 | 1024 |
| 1025 bool generate_draft_pages = false; | 1025 bool generate_draft_pages = false; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1219 print_node_in_progress_ = true; | 1219 print_node_in_progress_ = true; |
| 1220 | 1220 |
| 1221 // Make a copy of the node, in case RenderView::OnContextMenuClosed resets | 1221 // Make a copy of the node, in case RenderView::OnContextMenuClosed resets |
| 1222 // its |context_menu_node_|. | 1222 // its |context_menu_node_|. |
| 1223 print_preview_context_.InitWithNode(node); | 1223 print_preview_context_.InitWithNode(node); |
| 1224 RequestPrintPreview(PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE); | 1224 RequestPrintPreview(PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE); |
| 1225 | 1225 |
| 1226 print_node_in_progress_ = false; | 1226 print_node_in_progress_ = false; |
| 1227 } | 1227 } |
| 1228 | 1228 |
| 1229 void PrintWebViewHelper::SetPrintPresetOptionsFromDocument( | |
| 1230 PrintHostMsg_SetOptionsFromDocument_Params& params) { | |
| 1231 // FIXME: Send message to browser to set print preset options. | |
| 1232 Send(new PrintHostMsg_SetOptionsFromDocument(routing_id(), params)); | |
| 1233 } | |
| 1234 | |
| 1229 #if !defined(OS_WIN) | 1235 #if !defined(OS_WIN) |
| 1230 void PrintWebViewHelper::Print(blink::WebLocalFrame* frame, | 1236 void PrintWebViewHelper::Print(blink::WebLocalFrame* frame, |
| 1231 const blink::WebNode& node) { | 1237 const blink::WebNode& node) { |
| 1232 // If still not finished with earlier print request simply ignore. | 1238 // If still not finished with earlier print request simply ignore. |
| 1233 if (prep_frame_view_) | 1239 if (prep_frame_view_) |
| 1234 return; | 1240 return; |
| 1235 | 1241 |
| 1236 FrameReference frame_ref(frame); | 1242 FrameReference frame_ref(frame); |
| 1237 | 1243 |
| 1238 int expected_page_count = 0; | 1244 int expected_page_count = 0; |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1964 } | 1970 } |
| 1965 | 1971 |
| 1966 void PrintWebViewHelper::SetPrintPagesParams( | 1972 void PrintWebViewHelper::SetPrintPagesParams( |
| 1967 const PrintMsg_PrintPages_Params& settings) { | 1973 const PrintMsg_PrintPages_Params& settings) { |
| 1968 print_pages_params_.reset(new PrintMsg_PrintPages_Params(settings)); | 1974 print_pages_params_.reset(new PrintMsg_PrintPages_Params(settings)); |
| 1969 Send(new PrintHostMsg_DidGetDocumentCookie(routing_id(), | 1975 Send(new PrintHostMsg_DidGetDocumentCookie(routing_id(), |
| 1970 settings.params.document_cookie)); | 1976 settings.params.document_cookie)); |
| 1971 } | 1977 } |
| 1972 | 1978 |
| 1973 } // namespace printing | 1979 } // namespace printing |
| OLD | NEW |