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

Unified Diff: chrome/renderer/render_view.cc

Issue 149644: Print only the focused frame. This makes more sense than trying to print all... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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') | chrome/renderer/render_view_unittest.cc » ('j') | 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 20864)
+++ chrome/renderer/render_view.cc (working copy)
@@ -451,8 +451,14 @@
void RenderView::OnPrintPages() {
DCHECK(webview());
- if (webview())
- Print(webview()->GetMainFrame(), false);
+ 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()->GetFocusedFrame()->HasSelection())
+ Print(webview()->GetFocusedFrame(), false);
+ else
+ Print(webview()->GetMainFrame(), false);
+ }
}
void RenderView::OnPrintingDone(int document_cookie, bool success) {
@@ -2309,7 +2315,11 @@
}
void RenderView::ScriptedPrint(WebFrame* frame) {
- Print(frame, true);
+ DCHECK(webview());
+ if (webview()) {
+ // Print the full page - not just the frame the javascript is running from.
+ Print(webview()->GetMainFrame(), true);
darin (slow to review) 2009/09/16 16:28:50 this seems like it is introducing a potential web
M-A Ruel 2009/09/16 16:35:03 That is interesting, I didn't realize that change.
+ }
}
void RenderView::UserMetricsRecordAction(const std::wstring& action) {
« no previous file with comments | « chrome/renderer/render_view.h ('k') | chrome/renderer/render_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698