OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/pepper/chrome_pdf_print_delegate.h" | 5 #include "chrome/renderer/pepper/chrome_pdf_print_delegate.h" |
6 | 6 |
7 #include "chrome/renderer/printing/print_web_view_helper.h" | 7 #include "chrome/renderer/printing/print_web_view_helper.h" |
8 #include "content/public/renderer/pepper_plugin_instance.h" | 8 #include "content/public/renderer/pepper_plugin_instance.h" |
9 #include "content/public/renderer/render_view.h" | 9 #include "content/public/renderer/render_view.h" |
10 #include "third_party/WebKit/public/web/WebDocument.h" | 10 #include "third_party/WebKit/public/web/WebDocument.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 ChromePDFPrintDelegate::ChromePDFPrintDelegate() {} | 36 ChromePDFPrintDelegate::ChromePDFPrintDelegate() {} |
37 ChromePDFPrintDelegate::~ChromePDFPrintDelegate() {} | 37 ChromePDFPrintDelegate::~ChromePDFPrintDelegate() {} |
38 | 38 |
39 bool ChromePDFPrintDelegate::IsPrintingEnabled(PP_Instance instance_id) { | 39 bool ChromePDFPrintDelegate::IsPrintingEnabled(PP_Instance instance_id) { |
40 blink::WebElement element = GetWebElement(instance_id); | 40 blink::WebElement element = GetWebElement(instance_id); |
41 printing::PrintWebViewHelper* helper = GetPrintWebViewHelper(element); | 41 printing::PrintWebViewHelper* helper = GetPrintWebViewHelper(element); |
42 return helper && helper->IsPrintingEnabled(); | 42 return helper && helper->IsPrintingEnabled(); |
43 } | 43 } |
44 | 44 |
45 void ChromePDFPrintDelegate::Print(PP_Instance instance_id) { | 45 bool ChromePDFPrintDelegate::Print(PP_Instance instance_id) { |
46 blink::WebElement element = GetWebElement(instance_id); | 46 blink::WebElement element = GetWebElement(instance_id); |
47 printing::PrintWebViewHelper* helper = GetPrintWebViewHelper(element); | 47 printing::PrintWebViewHelper* helper = GetPrintWebViewHelper(element); |
48 if (helper) | 48 if (helper) { |
49 helper->PrintNode(element); | 49 helper->PrintNode(element); |
| 50 return true; |
| 51 } |
| 52 return false; |
50 } | 53 } |
OLD | NEW |