Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4818)

Unified Diff: chrome/renderer/render_view.cc

Issue 6296018: Cleanup: Merge common code in RenderView::OnPrintPages and RenderView::OnPrin... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/render_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « chrome/renderer/render_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698