| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/printing/print_view_manager.h" | 5 #include "chrome/browser/printing/print_view_manager.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 rfh->GetRoutingID(), has_selection); | 116 rfh->GetRoutingID(), has_selection); |
| 117 if (!PrintNowInternal(rfh, std::move(message))) | 117 if (!PrintNowInternal(rfh, std::move(message))) |
| 118 return false; | 118 return false; |
| 119 | 119 |
| 120 DCHECK(!print_preview_rfh_); | 120 DCHECK(!print_preview_rfh_); |
| 121 print_preview_rfh_ = rfh; | 121 print_preview_rfh_ = rfh; |
| 122 print_preview_state_ = USER_INITIATED_PREVIEW; | 122 print_preview_state_ = USER_INITIATED_PREVIEW; |
| 123 return true; | 123 return true; |
| 124 } | 124 } |
| 125 | 125 |
| 126 void PrintViewManager::PrintPreviewForWebNode() { | 126 void PrintViewManager::PrintPreviewForWebNode(content::RenderFrameHost* rfh) { |
| 127 if (print_preview_state_ != NOT_PREVIEWING) | 127 if (print_preview_state_ != NOT_PREVIEWING) |
| 128 return; | 128 return; |
| 129 |
| 130 DCHECK(rfh); |
| 131 DCHECK(!print_preview_rfh_); |
| 132 print_preview_rfh_ = rfh; |
| 129 print_preview_state_ = USER_INITIATED_PREVIEW; | 133 print_preview_state_ = USER_INITIATED_PREVIEW; |
| 130 } | 134 } |
| 131 | 135 |
| 132 void PrintViewManager::PrintPreviewDone() { | 136 void PrintViewManager::PrintPreviewDone() { |
| 133 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 137 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 134 DCHECK_NE(NOT_PREVIEWING, print_preview_state_); | 138 DCHECK_NE(NOT_PREVIEWING, print_preview_state_); |
| 135 | 139 |
| 136 if (print_preview_state_ == SCRIPTED_PREVIEW) { | 140 if (print_preview_state_ == SCRIPTED_PREVIEW) { |
| 137 auto& map = g_scripted_print_preview_closure_map.Get(); | 141 auto& map = g_scripted_print_preview_closure_map.Get(); |
| 138 auto it = map.find(scripted_print_preview_rph_); | 142 auto it = map.find(scripted_print_preview_rph_); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 IPC_MESSAGE_HANDLER(PrintHostMsg_ShowScriptedPrintPreview, | 248 IPC_MESSAGE_HANDLER(PrintHostMsg_ShowScriptedPrintPreview, |
| 245 OnShowScriptedPrintPreview) | 249 OnShowScriptedPrintPreview) |
| 246 IPC_MESSAGE_UNHANDLED(handled = false) | 250 IPC_MESSAGE_UNHANDLED(handled = false) |
| 247 IPC_END_MESSAGE_MAP() | 251 IPC_END_MESSAGE_MAP() |
| 248 | 252 |
| 249 return handled || | 253 return handled || |
| 250 PrintViewManagerBase::OnMessageReceived(message, render_frame_host); | 254 PrintViewManagerBase::OnMessageReceived(message, render_frame_host); |
| 251 } | 255 } |
| 252 | 256 |
| 253 } // namespace printing | 257 } // namespace printing |
| OLD | NEW |