Index: chrome/renderer/render_view.cc |
=================================================================== |
--- chrome/renderer/render_view.cc (revision 71761) |
+++ chrome/renderer/render_view.cc (working copy) |
@@ -1144,15 +1144,7 @@ |
} |
void RenderView::OnPrintPages() { |
- DCHECK(webview()); |
- if (webview()) { |
- // If the user has selected text in the currently focused frame we print |
- // only that frame (this makes print selection work for multiple frames). |
- if (webview()->focusedFrame()->hasSelection()) |
- Print(webview()->focusedFrame(), false, false); |
- else |
- Print(webview()->mainFrame(), false, false); |
- } |
+ OnPrint(false); |
} |
void RenderView::OnPrintingDone(int document_cookie, bool success) { |
@@ -1165,15 +1157,7 @@ |
} |
void RenderView::OnPrintPreview() { |
- DCHECK(webview()); |
- if (webview()) { |
- // If the user has selected text in the currently focused frame we print |
- // only that frame (this makes print selection work for multiple frames). |
- if (webview()->focusedFrame()->hasSelection()) |
- Print(webview()->focusedFrame(), false, true); |
- else |
- Print(webview()->focusedFrame(), false, true); |
Lei Zhang
2011/01/20 05:47:03
Was this a copy+paste mistake or was this intentio
kmadhusu
2011/01/20 17:17:23
It is a mistake. Thanks for fixing it.
|
- } |
+ OnPrint(true); |
} |
void RenderView::OnPrintNodeUnderContextMenu() { |
@@ -5288,6 +5272,18 @@ |
} |
} |
+void RenderView::OnPrint(bool is_preview) { |
+ DCHECK(webview()); |
+ if (webview()) { |
+ // If the user has selected text in the currently focused frame we print |
+ // only that frame (this makes print selection work for multiple frames). |
+ if (webview()->focusedFrame()->hasSelection()) |
+ Print(webview()->focusedFrame(), false, is_preview); |
+ else |
+ Print(webview()->mainFrame(), false, is_preview); |
+ } |
+} |
+ |
void RenderView::Print(WebFrame* frame, |
bool script_initiated, |
bool is_preview) { |