| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/renderer/pepper/ppb_flash_print_impl.h" |
| 6 |
| 7 #include "chrome/renderer/print_web_view_helper.h" |
| 8 #include "content/public/renderer/render_view.h" |
| 9 #include "ppapi/c/private/ppb_flash_print.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 16 #include "webkit/plugins/ppapi/host_globals.h" |
| 17 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 18 |
| 19 using webkit::ppapi::HostGlobals; |
| 20 using webkit::ppapi::PluginInstance; |
| 21 |
| 22 namespace { |
| 23 |
| 24 const PPB_Flash_Print flash_print_interface = { |
| 25 &PPB_Flash_Print_Impl::InvokePrintingForInstance |
| 26 }; |
| 27 |
| 28 } // namespace |
| 29 |
| 30 // static |
| 31 const PPB_Flash_Print_1_0* PPB_Flash_Print_Impl::GetInterface() { |
| 32 return &flash_print_interface; |
| 33 } |
| 34 |
| 35 // static |
| 36 void PPB_Flash_Print_Impl::InvokePrintingForInstance(PP_Instance instance_id) { |
| 37 PluginInstance* instance = HostGlobals::Get()->GetInstance(instance_id); |
| 38 if (!instance) |
| 39 return; |
| 40 |
| 41 WebKit::WebElement element = instance->container()->element(); |
| 42 WebKit::WebView* view = element.document().frame()->view(); |
| 43 content::RenderView* render_view = content::RenderView::FromWebView(view); |
| 44 |
| 45 PrintWebViewHelper* print_view_helper = PrintWebViewHelper::Get(render_view); |
| 46 if (print_view_helper) |
| 47 print_view_helper->PrintNode(element); |
| 48 } |
| OLD | NEW |