| Index: chrome/renderer/pepper/ppb_flash_print_impl.cc
|
| diff --git a/chrome/renderer/pepper/ppb_flash_print_impl.cc b/chrome/renderer/pepper/ppb_flash_print_impl.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c2d2d389ff8ff2c26783f2e5c092a01d96951506
|
| --- /dev/null
|
| +++ b/chrome/renderer/pepper/ppb_flash_print_impl.cc
|
| @@ -0,0 +1,48 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/renderer/pepper/ppb_flash_print_impl.h"
|
| +
|
| +#include "chrome/renderer/print_web_view_helper.h"
|
| +#include "content/public/renderer/render_view.h"
|
| +#include "ppapi/c/private/ppb_flash_print.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
|
| +#include "webkit/plugins/ppapi/host_globals.h"
|
| +#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
|
| +
|
| +using webkit::ppapi::HostGlobals;
|
| +using webkit::ppapi::PluginInstance;
|
| +
|
| +namespace {
|
| +
|
| +const PPB_Flash_Print flash_print_interface = {
|
| + &PPB_Flash_Print_Impl::InvokePrintingForInstance
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| +// static
|
| +const PPB_Flash_Print_1_0* PPB_Flash_Print_Impl::GetInterface() {
|
| + return &flash_print_interface;
|
| +}
|
| +
|
| +// static
|
| +void PPB_Flash_Print_Impl::InvokePrintingForInstance(PP_Instance instance_id) {
|
| + PluginInstance* instance = HostGlobals::Get()->GetInstance(instance_id);
|
| + if (!instance)
|
| + return;
|
| +
|
| + WebKit::WebElement element = instance->container()->element();
|
| + WebKit::WebView* view = element.document().frame()->view();
|
| + content::RenderView* render_view = content::RenderView::FromWebView(view);
|
| +
|
| + PrintWebViewHelper* print_view_helper = PrintWebViewHelper::Get(render_view);
|
| + if (print_view_helper)
|
| + print_view_helper->PrintNode(element);
|
| +}
|
|
|