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

Unified Diff: chrome/renderer/print_web_view_helper.cc

Issue 9139024: Adding functionality to print PDF embedded in the html page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 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
Index: chrome/renderer/print_web_view_helper.cc
===================================================================
--- chrome/renderer/print_web_view_helper.cc (revision 117241)
+++ chrome/renderer/print_web_view_helper.cc (working copy)
@@ -943,7 +943,20 @@
void PrintWebViewHelper::OnPrintNodeUnderContextMenu() {
const WebNode& context_menu_node = render_view()->GetContextMenuNode();
- if (context_menu_node.isNull()) {
+ PrintNode(context_menu_node);
+}
+
+void PrintWebViewHelper::OnInitiatePrintPreview() {
+ DCHECK(is_preview_enabled_);
+ WebFrame* frame;
+ if (GetPrintFrame(&frame)) {
+ print_preview_context_.InitWithFrame(frame);
+ RequestPrintPreview();
+ }
+}
+
+void PrintWebViewHelper::PrintNode(const WebNode& node) {
+ if (node.isNull()) {
NOTREACHED();
return;
}
@@ -951,23 +964,14 @@
// Make a copy of the node, in case RenderView::OnContextMenuClosed resets
// its |context_menu_node_|.
if (is_preview_enabled_) {
- print_preview_context_.InitWithNode(context_menu_node);
+ print_preview_context_.InitWithNode(node);
RequestPrintPreview();
} else {
- WebNode duplicate_node(context_menu_node);
+ WebNode duplicate_node(node);
Print(duplicate_node.document().frame(), duplicate_node);
}
}
-void PrintWebViewHelper::OnInitiatePrintPreview() {
- DCHECK(is_preview_enabled_);
- WebFrame* frame;
- if (GetPrintFrame(&frame)) {
- print_preview_context_.InitWithFrame(frame);
- RequestPrintPreview();
- }
-}
-
void PrintWebViewHelper::Print(WebKit::WebFrame* frame,
const WebKit::WebNode& node) {
// If still not finished with earlier print request simply ignore.

Powered by Google App Engine
This is Rietveld 408576698