Index: chrome/renderer/printing/print_web_view_helper.cc |
diff --git a/chrome/renderer/printing/print_web_view_helper.cc b/chrome/renderer/printing/print_web_view_helper.cc |
index d9a5cd79ef509c466e68112439e74d7e1de0588e..f6181d4655400b032acf6b70886b6712aef23471 100644 |
--- a/chrome/renderer/printing/print_web_view_helper.cc |
+++ b/chrome/renderer/printing/print_web_view_helper.cc |
@@ -1106,12 +1106,14 @@ void PrintWebViewHelper::OnPrintNodeUnderContextMenu() { |
PrintNode(render_view()->GetContextMenuNode()); |
} |
-void PrintWebViewHelper::OnInitiatePrintPreview() { |
+void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) { |
DCHECK(is_preview_enabled_); |
WebKit::WebFrame* frame; |
if (GetPrintFrame(&frame)) { |
print_preview_context_.InitWithFrame(frame); |
- RequestPrintPreview(PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME); |
+ RequestPrintPreview(selection_only ? |
+ PRINT_PREVIEW_USER_INITIATED_SELECTION : |
+ PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME); |
} else { |
// This should not happen. Let's add a CHECK here to see how often this |
// gets hit. |
@@ -1577,15 +1579,18 @@ void PrintWebViewHelper::RequestPrintPreview(PrintPreviewRequestType type) { |
const bool is_modifiable = print_preview_context_.IsModifiable(); |
const bool has_selection = print_preview_context_.HasSelection(); |
old_print_pages_params_.reset(); |
+ PrintHostMsg_RequestPrintPreview_Params params = {0}; |
+ params.is_modifiable = is_modifiable; |
+ params.has_selection = has_selection; |
switch (type) { |
case PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME: { |
- Send(new PrintHostMsg_RequestPrintPreview(routing_id(), is_modifiable, |
- false, has_selection)); |
+ Send(new PrintHostMsg_RequestPrintPreview(routing_id(), params)); |
break; |
} |
- case PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE: { |
- Send(new PrintHostMsg_RequestPrintPreview(routing_id(), is_modifiable, |
- true, has_selection)); |
+ case PRINT_PREVIEW_USER_INITIATED_SELECTION: { |
+ DCHECK(has_selection); |
+ params.selection_only = has_selection; |
+ Send(new PrintHostMsg_RequestPrintPreview(routing_id(), params)); |
break; |
} |
case PRINT_PREVIEW_SCRIPTED: { |