OLD | NEW |
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/print_web_view_helper.h" | 5 #include "chrome/renderer/print_web_view_helper.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 params.routing_id = render_view()->routing_id(); | 625 params.routing_id = render_view()->routing_id(); |
626 // host_window_ may be NULL at this point if the current window is a | 626 // host_window_ may be NULL at this point if the current window is a |
627 // popup and the print() command has been issued from the parent. The | 627 // popup and the print() command has been issued from the parent. The |
628 // receiver of this message has to deal with this. | 628 // receiver of this message has to deal with this. |
629 params.host_window_id = render_view()->host_window(); | 629 params.host_window_id = render_view()->host_window(); |
630 params.cookie = print_pages_params_->params.document_cookie; | 630 params.cookie = print_pages_params_->params.document_cookie; |
631 params.has_selection = frame->hasSelection(); | 631 params.has_selection = frame->hasSelection(); |
632 params.expected_pages_count = expected_pages_count; | 632 params.expected_pages_count = expected_pages_count; |
633 params.use_overlays = use_browser_overlays; | 633 params.use_overlays = use_browser_overlays; |
634 | 634 |
| 635 Send(new PrintHostMsg_DidShowPrintDialog(routing_id())); |
| 636 |
635 print_pages_params_.reset(); | 637 print_pages_params_.reset(); |
636 IPC::SyncMessage* msg = | 638 IPC::SyncMessage* msg = |
637 new PrintHostMsg_ScriptedPrint(routing_id(), params, &print_settings); | 639 new PrintHostMsg_ScriptedPrint(routing_id(), params, &print_settings); |
638 msg->EnableMessagePumping(); | 640 msg->EnableMessagePumping(); |
639 Send(msg); | 641 Send(msg); |
640 print_pages_params_.reset(new PrintMsg_PrintPages_Params(print_settings)); | 642 print_pages_params_.reset(new PrintMsg_PrintPages_Params(print_settings)); |
641 return (print_settings.params.dpi && print_settings.params.document_cookie); | 643 return (print_settings.params.dpi && print_settings.params.document_cookie); |
642 } | 644 } |
643 | 645 |
644 bool PrintWebViewHelper::RenderPagesForPrint(WebKit::WebFrame* frame, | 646 bool PrintWebViewHelper::RenderPagesForPrint(WebKit::WebFrame* frame, |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 | 757 |
756 void PrintWebViewHelper::DisplayPrintJobError() { | 758 void PrintWebViewHelper::DisplayPrintJobError() { |
757 WebView* web_view = print_web_view_; | 759 WebView* web_view = print_web_view_; |
758 if (!web_view) | 760 if (!web_view) |
759 web_view = render_view()->webview(); | 761 web_view = render_view()->webview(); |
760 | 762 |
761 render_view()->runModalAlertDialog( | 763 render_view()->runModalAlertDialog( |
762 web_view->mainFrame(), | 764 web_view->mainFrame(), |
763 l10n_util::GetStringUTF16(IDS_PRINT_SPOOL_FAILED_ERROR_TEXT)); | 765 l10n_util::GetStringUTF16(IDS_PRINT_SPOOL_FAILED_ERROR_TEXT)); |
764 } | 766 } |
OLD | NEW |