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/print_web_view_helper.h" | 5 #include "chrome/renderer/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 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1532 return true; | 1532 return true; |
1533 } | 1533 } |
1534 | 1534 |
1535 bool PrintWebViewHelper::GetPrintSettingsFromUser(WebKit::WebFrame* frame, | 1535 bool PrintWebViewHelper::GetPrintSettingsFromUser(WebKit::WebFrame* frame, |
1536 const WebKit::WebNode& node, | 1536 const WebKit::WebNode& node, |
1537 int expected_pages_count, | 1537 int expected_pages_count, |
1538 bool use_browser_overlays) { | 1538 bool use_browser_overlays) { |
1539 PrintHostMsg_ScriptedPrint_Params params; | 1539 PrintHostMsg_ScriptedPrint_Params params; |
1540 PrintMsg_PrintPages_Params print_settings; | 1540 PrintMsg_PrintPages_Params print_settings; |
1541 | 1541 |
1542 // host_window_ may be NULL at this point if the current window is a | |
1543 // popup and the print() command has been issued from the parent. The | |
1544 // receiver of this message has to deal with this. | |
1545 params.host_window_id = render_view()->GetHostWindow(); | |
Lei Zhang
2012/06/11 23:32:28
FYI, this is the only user of GetHostWindow(). Sha
Albert Bodenhamer
2012/06/12 01:19:02
Done.
| |
1546 params.cookie = print_pages_params_->params.document_cookie; | 1542 params.cookie = print_pages_params_->params.document_cookie; |
1547 params.has_selection = frame->hasSelection(); | 1543 params.has_selection = frame->hasSelection(); |
1548 params.expected_pages_count = expected_pages_count; | 1544 params.expected_pages_count = expected_pages_count; |
1549 printing::MarginType margin_type = printing::DEFAULT_MARGINS; | 1545 printing::MarginType margin_type = printing::DEFAULT_MARGINS; |
1550 if (PrintingNodeOrPdfFrame(frame, node)) | 1546 if (PrintingNodeOrPdfFrame(frame, node)) |
1551 margin_type = GetMarginsForPdf(frame, node); | 1547 margin_type = GetMarginsForPdf(frame, node); |
1552 params.margin_type = margin_type; | 1548 params.margin_type = margin_type; |
1553 | 1549 |
1554 Send(new PrintHostMsg_DidShowPrintDialog(routing_id())); | 1550 Send(new PrintHostMsg_DidShowPrintDialog(routing_id())); |
1555 | 1551 |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1945 DCHECK(IsRendering()); | 1941 DCHECK(IsRendering()); |
1946 return prep_frame_view_->GetPrintCanvasSize(); | 1942 return prep_frame_view_->GetPrintCanvasSize(); |
1947 } | 1943 } |
1948 | 1944 |
1949 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 1945 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
1950 prep_frame_view_.reset(); | 1946 prep_frame_view_.reset(); |
1951 metafile_.reset(); | 1947 metafile_.reset(); |
1952 pages_to_render_.clear(); | 1948 pages_to_render_.clear(); |
1953 error_ = PREVIEW_ERROR_NONE; | 1949 error_ = PREVIEW_ERROR_NONE; |
1954 } | 1950 } |
OLD | NEW |