Chromium Code Reviews| Index: chrome/renderer/chrome_ppb_pdf_impl.cc |
| =================================================================== |
| --- chrome/renderer/chrome_ppb_pdf_impl.cc (revision 117241) |
| +++ chrome/renderer/chrome_ppb_pdf_impl.cc (working copy) |
| @@ -8,6 +8,7 @@ |
| #include "base/utf_string_conversions.h" |
| #include "build/build_config.h" |
| #include "chrome/common/render_messages.h" |
| +#include "chrome/renderer/print_web_view_helper.h" |
| #include "content/public/common/child_process_sandbox_support_linux.h" |
| #include "content/public/renderer/render_thread.h" |
| #include "content/public/renderer/render_view.h" |
| @@ -23,6 +24,7 @@ |
| #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/WebPluginContainer.h" |
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" |
|
Lei Zhang
2012/01/12 22:10:20
nit: WebNode before WebPluginContainer.
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| #include "third_party/skia/include/core/SkBitmap.h" |
| #include "ui/base/l10n/l10n_util.h" |
| @@ -334,6 +336,20 @@ |
| instance->delegate()->SaveURLAs(instance->plugin_url()); |
| } |
| +void Print(PP_Instance instance_id) { |
| + PluginInstance* instance = HostGlobals::Get()->GetInstance(instance_id); |
| + if (!instance) |
| + return; |
| + |
| + WebView* view = instance->container()->element().document().frame()->view(); |
|
Lei Zhang
2012/01/12 22:10:20
nit: you can make instance->container()->element()
|
| + content::RenderView* render_view = content::RenderView::FromWebView(view); |
| + |
| + PrintWebViewHelper* print_view_helper = PrintWebViewHelper::Get(render_view); |
| + if (print_view_helper) { |
| + print_view_helper->PrintNode(instance->container()->element()); |
| + } |
| +} |
| + |
| const PPB_PDF ppb_pdf = { |
| &GetLocalizedString, |
| &GetResourceImage, |
| @@ -346,7 +362,8 @@ |
| &HistogramPDFPageCount, |
| &UserMetricsRecordAction, |
| &HasUnsupportedFeature, |
| - &SaveAs |
| + &SaveAs, |
| }; |
| // static |