| 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.
|
|
|