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

Side by Side Diff: chrome/renderer/render_view.cc

Issue 6479004: Print Preview: Hook up the print button to initiate a normal print operation.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/render_view.h" 5 #include "chrome/renderer/render_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 969
970 bool handled = true; 970 bool handled = true;
971 IPC_BEGIN_MESSAGE_MAP(RenderView, message) 971 IPC_BEGIN_MESSAGE_MAP(RenderView, message)
972 IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, OnCaptureThumbnail) 972 IPC_MESSAGE_HANDLER(ViewMsg_CaptureThumbnail, OnCaptureThumbnail)
973 IPC_MESSAGE_HANDLER(ViewMsg_CaptureSnapshot, OnCaptureSnapshot) 973 IPC_MESSAGE_HANDLER(ViewMsg_CaptureSnapshot, OnCaptureSnapshot)
974 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages) 974 IPC_MESSAGE_HANDLER(ViewMsg_PrintPages, OnPrintPages)
975 IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone) 975 IPC_MESSAGE_HANDLER(ViewMsg_PrintingDone, OnPrintingDone)
976 IPC_MESSAGE_HANDLER(ViewMsg_PrintPreview, OnPrintPreview) 976 IPC_MESSAGE_HANDLER(ViewMsg_PrintPreview, OnPrintPreview)
977 IPC_MESSAGE_HANDLER(ViewMsg_PrintNodeUnderContextMenu, 977 IPC_MESSAGE_HANDLER(ViewMsg_PrintNodeUnderContextMenu,
978 OnPrintNodeUnderContextMenu) 978 OnPrintNodeUnderContextMenu)
979 IPC_MESSAGE_HANDLER(ViewMsg_PrintForPrintPreview,
980 OnPrintForPrintPreview)
979 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) 981 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate)
980 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop) 982 IPC_MESSAGE_HANDLER(ViewMsg_Stop, OnStop)
981 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame) 983 IPC_MESSAGE_HANDLER(ViewMsg_ReloadFrame, OnReloadFrame)
982 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo) 984 IPC_MESSAGE_HANDLER(ViewMsg_Undo, OnUndo)
983 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo) 985 IPC_MESSAGE_HANDLER(ViewMsg_Redo, OnRedo)
984 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut) 986 IPC_MESSAGE_HANDLER(ViewMsg_Cut, OnCut)
985 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy) 987 IPC_MESSAGE_HANDLER(ViewMsg_Copy, OnCopy)
986 #if defined(OS_MACOSX) 988 #if defined(OS_MACOSX)
987 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard) 989 IPC_MESSAGE_HANDLER(ViewMsg_CopyToFindPboard, OnCopyToFindPboard)
988 #endif 990 #endif
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 NOTREACHED(); 1175 NOTREACHED();
1174 return; 1176 return;
1175 } 1177 }
1176 1178
1177 // Make a copy of the node, since we will do a sync call to the browser and 1179 // Make a copy of the node, since we will do a sync call to the browser and
1178 // during that time OnContextMenuClosed might reset context_menu_node_. 1180 // during that time OnContextMenuClosed might reset context_menu_node_.
1179 WebNode context_menu_node(context_menu_node_); 1181 WebNode context_menu_node(context_menu_node_);
1180 GetPrintWebViewHelper()->PrintNode(&context_menu_node, false, false); 1182 GetPrintWebViewHelper()->PrintNode(&context_menu_node, false, false);
1181 } 1183 }
1182 1184
1185 void RenderView::OnPrintForPrintPreview() {
1186 WebFrame* main_frame = webview() ? webview()->mainFrame() : NULL;
1187 if (!main_frame)
1188 return;
1189
1190 WebDocument document = main_frame->document();
1191 // <object> with id="pdf-viewer" is created in
1192 // chrome/browser/resources/print_preview.js
1193 WebElement element = document.getElementById("pdf-viewer");
1194 if (element.isNull()) {
1195 NOTREACHED();
1196 return;
1197 }
1198
1199 GetPrintWebViewHelper()->PrintNode(&element, false, false);
1200 }
1201
1183 void RenderView::CapturePageInfo(int load_id, bool preliminary_capture) { 1202 void RenderView::CapturePageInfo(int load_id, bool preliminary_capture) {
1184 if (load_id != page_id_) 1203 if (load_id != page_id_)
1185 return; // this capture call is no longer relevant due to navigation 1204 return; // this capture call is no longer relevant due to navigation
1186 if (load_id == last_indexed_page_id_) 1205 if (load_id == last_indexed_page_id_)
1187 return; // we already indexed this page 1206 return; // we already indexed this page
1188 1207
1189 if (!webview()) 1208 if (!webview())
1190 return; 1209 return;
1191 1210
1192 WebFrame* main_frame = webview()->mainFrame(); 1211 WebFrame* main_frame = webview()->mainFrame();
(...skipping 4580 matching lines...) Expand 10 before | Expand all | Expand 10 after
5773 } 5792 }
5774 } 5793 }
5775 5794
5776 void RenderView::OnContextMenuClosed( 5795 void RenderView::OnContextMenuClosed(
5777 const webkit_glue::CustomContextMenuContext& custom_context) { 5796 const webkit_glue::CustomContextMenuContext& custom_context) {
5778 if (custom_context.is_pepper_menu) 5797 if (custom_context.is_pepper_menu)
5779 pepper_delegate_.OnContextMenuClosed(custom_context); 5798 pepper_delegate_.OnContextMenuClosed(custom_context);
5780 else 5799 else
5781 context_menu_node_.reset(); 5800 context_menu_node_.reset();
5782 } 5801 }
OLDNEW
« chrome/common/render_messages_internal.h ('K') | « chrome/renderer/render_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698