Chromium Code Reviews| Index: chrome/renderer/print_web_view_helper.cc |
| diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc |
| index 1b4008a97bcaa5d503a430d14b999bc5e1d91754..e1e060f5c5f00e364b6e7c7b69720969a2073173 100644 |
| --- a/chrome/renderer/print_web_view_helper.cc |
| +++ b/chrome/renderer/print_web_view_helper.cc |
| @@ -45,6 +45,10 @@ |
| #include "skia/ext/vector_canvas.h" |
| #include "skia/ext/vector_platform_device_skia.h" |
| #include "third_party/skia/include/core/SkTypeface.h" |
| +#if defined (OS_WIN) |
| +#include "content/common/child_process_messages.h" |
| +#include "third_party/skia/include/ports/SkSandbox_win.h" |
| +#endif |
| #elif defined(OS_MACOSX) |
| #include <CoreGraphics/CGContext.h> |
| @@ -255,6 +259,23 @@ void PrintHeaderFooterText( |
| } // namespace |
| +#if defined (OS_WIN) && defined (USE_SKIA) |
| +class PrintWebViewHelperSkSandbox : public skia::SkSandbox { |
|
vandebo (ex-Chrome)
2011/11/15 17:03:30
This is the wrong place for this. It should go in
|
| + public: |
| + explicit PrintWebViewHelperSkSandbox(PrintWebViewHelper* container) { |
| + container_ = container; |
| + } |
| + virtual ~PrintWebViewHelperSkSandbox() {} |
| + |
| + virtual bool EnsureFontLoad(LOGFONT logfont) { |
| + return container_->EnsureFontLoad(logfont); |
| + } |
| + |
| + private: |
| + PrintWebViewHelper* container_; |
| +}; |
| +#endif // defined (OS_WIN) && defined (USE_SKIA) |
| + |
| // static - Not anonymous so that platform implementations can use it. |
| void PrintWebViewHelper::PrintHeaderAndFooter( |
| WebKit::WebCanvas* canvas, |
| @@ -442,9 +463,19 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view) |
| is_print_ready_metafile_sent_(false), |
| user_cancelled_scripted_print_count_(0), |
| notify_browser_of_print_failure_(true) { |
| +#if defined(OS_WIN) && defined(USE_SKIA) |
| + if (!skia::gSandbox) { |
| + skia::gSandbox = new PrintWebViewHelperSkSandbox(this); |
| + } |
| +#endif |
| } |
| -PrintWebViewHelper::~PrintWebViewHelper() {} |
| +PrintWebViewHelper::~PrintWebViewHelper() { |
| +#if defined(OS_WIN) && defined(USE_SKIA) |
| + delete skia::gSandbox; |
| + skia::gSandbox = NULL; |
| +#endif |
| +} |
| // Prints |frame| which called window.print(). |
| void PrintWebViewHelper::PrintPage(WebKit::WebFrame* frame) { |
| @@ -1569,3 +1600,9 @@ void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
| pages_to_render_.clear(); |
| error_ = PREVIEW_ERROR_NONE; |
| } |
| + |
| +#if defined(OS_WIN) && defined(USE_SKIA) |
| +bool PrintWebViewHelper::EnsureFontLoad(LOGFONT logfont) { |
| + return Send(new ChildProcessHostMsg_PreCacheFont(logfont)); |
| +} |
| +#endif |