| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/gfx/size.h" | 9 #include "base/gfx/size.h" |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 { | 150 { |
| 151 PrepareFrameAndViewForPrint prep_frame_view(default_settings, | 151 PrepareFrameAndViewForPrint prep_frame_view(default_settings, |
| 152 frame, | 152 frame, |
| 153 frame->GetView()); | 153 frame->GetView()); |
| 154 expected_pages_count = prep_frame_view.GetExpectedPageCount(); | 154 expected_pages_count = prep_frame_view.GetExpectedPageCount(); |
| 155 DCHECK(expected_pages_count); | 155 DCHECK(expected_pages_count); |
| 156 } | 156 } |
| 157 | 157 |
| 158 // Ask the browser to show UI to retrieve the final print settings. | 158 // Ask the browser to show UI to retrieve the final print settings. |
| 159 ViewMsg_PrintPages_Params print_settings; | 159 ViewMsg_PrintPages_Params print_settings; |
| 160 |
| 161 ViewHostMsg_ScriptedPrint_Params params; |
| 162 |
| 163 // The routing id is sent across as it is needed to look up the |
| 164 // corresponding RenderViewHost instance to signal and reset the |
| 165 // pump messages event. |
| 166 params.routing_id = routing_id(); |
| 160 // host_window_ may be NULL at this point if the current window is a popup | 167 // host_window_ may be NULL at this point if the current window is a popup |
| 161 // and the print() command has been issued from the parent. The receiver | 168 // and the print() command has been issued from the parent. The receiver |
| 162 // of this message has to deal with this. | 169 // of this message has to deal with this. |
| 163 msg = new ViewHostMsg_ScriptedPrint(routing_id(), | 170 params.host_window_id = render_view_->host_window(); |
| 164 render_view_->host_window(), | 171 params.cookie = default_settings.document_cookie; |
| 165 default_settings.document_cookie, | 172 params.has_selection = frame->HasSelection(); |
| 166 expected_pages_count, | 173 params.expected_pages_count = expected_pages_count; |
| 167 frame->HasSelection(), | 174 |
| 175 msg = new ViewHostMsg_ScriptedPrint(params, |
| 168 &print_settings); | 176 &print_settings); |
| 177 msg->set_pump_messages_event(render_view_->modal_dialog_event()); |
| 178 |
| 169 if (Send(msg)) { | 179 if (Send(msg)) { |
| 170 msg = NULL; | 180 msg = NULL; |
| 171 | 181 |
| 172 // If the settings are invalid, early quit. | 182 // If the settings are invalid, early quit. |
| 173 if (print_settings.params.dpi && | 183 if (print_settings.params.dpi && |
| 174 print_settings.params.document_cookie) { | 184 print_settings.params.document_cookie) { |
| 175 if (print_settings.params.selection_only) { | 185 if (print_settings.params.selection_only) { |
| 176 CopyAndPrint(print_settings, frame); | 186 CopyAndPrint(print_settings, frame); |
| 177 } else { | 187 } else { |
| 178 // TODO: Always copy before printing. | 188 // TODO: Always copy before printing. |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 WebKit::WebScreenInfo PrintWebViewHelper::GetScreenInfo(WebWidget* webwidget) { | 425 WebKit::WebScreenInfo PrintWebViewHelper::GetScreenInfo(WebWidget* webwidget) { |
| 416 WebKit::WebScreenInfo info; | 426 WebKit::WebScreenInfo info; |
| 417 NOTREACHED(); | 427 NOTREACHED(); |
| 418 return info; | 428 return info; |
| 419 } | 429 } |
| 420 | 430 |
| 421 bool PrintWebViewHelper::IsHidden(WebWidget* webwidget) { | 431 bool PrintWebViewHelper::IsHidden(WebWidget* webwidget) { |
| 422 NOTREACHED(); | 432 NOTREACHED(); |
| 423 return true; | 433 return true; |
| 424 } | 434 } |
| OLD | NEW |