| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276 | 5 // TODO(sgurun) copied from chrome/renderer. Remove after crbug.com/322276 |
| 6 | 6 |
| 7 #include "android_webview/renderer/print_web_view_helper.h" | 7 #include "android_webview/renderer/print_web_view_helper.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 Print(frame, blink::WebNode()); | 803 Print(frame, blink::WebNode()); |
| 804 } | 804 } |
| 805 } | 805 } |
| 806 | 806 |
| 807 bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { | 807 bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) { |
| 808 bool handled = true; | 808 bool handled = true; |
| 809 IPC_BEGIN_MESSAGE_MAP(PrintWebViewHelper, message) | 809 IPC_BEGIN_MESSAGE_MAP(PrintWebViewHelper, message) |
| 810 IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages) | 810 IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages) |
| 811 IPC_MESSAGE_HANDLER(PrintMsg_PrintForSystemDialog, OnPrintForSystemDialog) | 811 IPC_MESSAGE_HANDLER(PrintMsg_PrintForSystemDialog, OnPrintForSystemDialog) |
| 812 IPC_MESSAGE_HANDLER(PrintMsg_InitiatePrintPreview, OnInitiatePrintPreview) | 812 IPC_MESSAGE_HANDLER(PrintMsg_InitiatePrintPreview, OnInitiatePrintPreview) |
| 813 IPC_MESSAGE_HANDLER(PrintMsg_PrintNodeUnderContextMenu, | |
| 814 OnPrintNodeUnderContextMenu) | |
| 815 IPC_MESSAGE_HANDLER(PrintMsg_PrintPreview, OnPrintPreview) | 813 IPC_MESSAGE_HANDLER(PrintMsg_PrintPreview, OnPrintPreview) |
| 816 IPC_MESSAGE_HANDLER(PrintMsg_PrintForPrintPreview, OnPrintForPrintPreview) | 814 IPC_MESSAGE_HANDLER(PrintMsg_PrintForPrintPreview, OnPrintForPrintPreview) |
| 817 IPC_MESSAGE_HANDLER(PrintMsg_PrintingDone, OnPrintingDone) | 815 IPC_MESSAGE_HANDLER(PrintMsg_PrintingDone, OnPrintingDone) |
| 818 IPC_MESSAGE_HANDLER(PrintMsg_ResetScriptedPrintCount, | 816 IPC_MESSAGE_HANDLER(PrintMsg_ResetScriptedPrintCount, |
| 819 ResetScriptedPrintCount) | 817 ResetScriptedPrintCount) |
| 820 IPC_MESSAGE_HANDLER(PrintMsg_SetScriptedPrintingBlocked, | 818 IPC_MESSAGE_HANDLER(PrintMsg_SetScriptedPrintingBlocked, |
| 821 SetScriptedPrintBlocked) | 819 SetScriptedPrintBlocked) |
| 822 IPC_MESSAGE_UNHANDLED(handled = false) | 820 IPC_MESSAGE_UNHANDLED(handled = false) |
| 823 IPC_END_MESSAGE_MAP() | 821 IPC_END_MESSAGE_MAP() |
| 824 return handled; | 822 return handled; |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 notify_browser_of_print_failure_ = false; | 1149 notify_browser_of_print_failure_ = false; |
| 1152 if (!success) | 1150 if (!success) |
| 1153 LOG(ERROR) << "Failure in OnPrintingDone"; | 1151 LOG(ERROR) << "Failure in OnPrintingDone"; |
| 1154 DidFinishPrinting(success ? OK : FAIL_PRINT); | 1152 DidFinishPrinting(success ? OK : FAIL_PRINT); |
| 1155 } | 1153 } |
| 1156 | 1154 |
| 1157 void PrintWebViewHelper::SetScriptedPrintBlocked(bool blocked) { | 1155 void PrintWebViewHelper::SetScriptedPrintBlocked(bool blocked) { |
| 1158 is_scripted_printing_blocked_ = blocked; | 1156 is_scripted_printing_blocked_ = blocked; |
| 1159 } | 1157 } |
| 1160 | 1158 |
| 1161 void PrintWebViewHelper::OnPrintNodeUnderContextMenu() { | |
| 1162 PrintNode(render_view()->GetContextMenuNode()); | |
| 1163 } | |
| 1164 | |
| 1165 void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) { | 1159 void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) { |
| 1166 DCHECK(is_preview_enabled_); | 1160 DCHECK(is_preview_enabled_); |
| 1167 blink::WebFrame* frame = NULL; | 1161 blink::WebFrame* frame = NULL; |
| 1168 GetPrintFrame(&frame); | 1162 GetPrintFrame(&frame); |
| 1169 DCHECK(frame); | 1163 DCHECK(frame); |
| 1170 print_preview_context_.InitWithFrame(frame); | 1164 print_preview_context_.InitWithFrame(frame); |
| 1171 RequestPrintPreview(selection_only ? | 1165 RequestPrintPreview(selection_only ? |
| 1172 PRINT_PREVIEW_USER_INITIATED_SELECTION : | 1166 PRINT_PREVIEW_USER_INITIATED_SELECTION : |
| 1173 PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME); | 1167 PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME); |
| 1174 } | 1168 } |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2003 } | 1997 } |
| 2004 | 1998 |
| 2005 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 1999 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
| 2006 prep_frame_view_.reset(); | 2000 prep_frame_view_.reset(); |
| 2007 metafile_.reset(); | 2001 metafile_.reset(); |
| 2008 pages_to_render_.clear(); | 2002 pages_to_render_.clear(); |
| 2009 error_ = PREVIEW_ERROR_NONE; | 2003 error_ = PREVIEW_ERROR_NONE; |
| 2010 } | 2004 } |
| 2011 | 2005 |
| 2012 } // namespace printing | 2006 } // namespace printing |
| OLD | NEW |