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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 params.routing_id = render_view()->routing_id(); | 663 params.routing_id = render_view()->routing_id(); |
664 // host_window_ may be NULL at this point if the current window is a | 664 // host_window_ may be NULL at this point if the current window is a |
665 // popup and the print() command has been issued from the parent. The | 665 // popup and the print() command has been issued from the parent. The |
666 // receiver of this message has to deal with this. | 666 // receiver of this message has to deal with this. |
667 params.host_window_id = render_view()->host_window(); | 667 params.host_window_id = render_view()->host_window(); |
668 params.cookie = print_pages_params_->params.document_cookie; | 668 params.cookie = print_pages_params_->params.document_cookie; |
669 params.has_selection = frame->hasSelection(); | 669 params.has_selection = frame->hasSelection(); |
670 params.expected_pages_count = expected_pages_count; | 670 params.expected_pages_count = expected_pages_count; |
671 params.use_overlays = use_browser_overlays; | 671 params.use_overlays = use_browser_overlays; |
672 | 672 |
| 673 Send(new PrintHostMsg_DidShowPrintDialog(routing_id())); |
| 674 |
673 print_pages_params_.reset(); | 675 print_pages_params_.reset(); |
674 IPC::SyncMessage* msg = | 676 IPC::SyncMessage* msg = |
675 new PrintHostMsg_ScriptedPrint(routing_id(), params, &print_settings); | 677 new PrintHostMsg_ScriptedPrint(routing_id(), params, &print_settings); |
676 msg->EnableMessagePumping(); | 678 msg->EnableMessagePumping(); |
677 Send(msg); | 679 Send(msg); |
678 print_pages_params_.reset(new PrintMsg_PrintPages_Params(print_settings)); | 680 print_pages_params_.reset(new PrintMsg_PrintPages_Params(print_settings)); |
679 return (print_settings.params.dpi && print_settings.params.document_cookie); | 681 return (print_settings.params.dpi && print_settings.params.document_cookie); |
680 } | 682 } |
681 | 683 |
682 bool PrintWebViewHelper::RenderPagesForPrint(WebKit::WebFrame* frame, | 684 bool PrintWebViewHelper::RenderPagesForPrint(WebKit::WebFrame* frame, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 | 799 |
798 render_view()->runModalAlertDialog( | 800 render_view()->runModalAlertDialog( |
799 web_view->mainFrame(), | 801 web_view->mainFrame(), |
800 l10n_util::GetStringUTF16(IDS_PRINT_SPOOL_FAILED_ERROR_TEXT)); | 802 l10n_util::GetStringUTF16(IDS_PRINT_SPOOL_FAILED_ERROR_TEXT)); |
801 } | 803 } |
802 | 804 |
803 void PrintWebViewHelper::RequestPrintPreview() { | 805 void PrintWebViewHelper::RequestPrintPreview() { |
804 old_print_pages_params_.reset(); | 806 old_print_pages_params_.reset(); |
805 Send(new PrintHostMsg_RequestPrintPreview(routing_id())); | 807 Send(new PrintHostMsg_RequestPrintPreview(routing_id())); |
806 } | 808 } |
OLD | NEW |