diff options
19 files changed, 40 insertions, 68 deletions
diff --git a/android_webview/common/print_messages.h b/android_webview/common/print_messages.h index 6da90de..76fc904 100644 --- a/android_webview/common/print_messages.h +++ b/android_webview/common/print_messages.h @@ -371,7 +371,7 @@ IPC_SYNC_MESSAGE_ROUTED1_1(PrintHostMsg_ScriptedPrint, #if defined(OS_ANDROID) // Asks the browser to create a temporary file for the renderer to fill -// in resulting NativeMetafile in printing. +// in resulting PdfMetafileSkia in printing. IPC_SYNC_MESSAGE_ROUTED0_2(PrintHostMsg_AllocateTempFileForPrinting, base::FileDescriptor /* temp file fd */, int /* fd in browser*/) diff --git a/android_webview/renderer/print_web_view_helper.cc b/android_webview/renderer/print_web_view_helper.cc index 1129679..853efc8 100644 --- a/android_webview/renderer/print_web_view_helper.cc +++ b/android_webview/renderer/print_web_view_helper.cc @@ -24,7 +24,7 @@ #include "content/public/renderer/render_view.h" #include "net/base/escape.h" #include "printing/metafile.h" -#include "printing/metafile_impl.h" +#include "printing/pdf_metafile_skia.h" #include "printing/units.h" #include "skia/ext/vector_platform_device_skia.h" #include "third_party/WebKit/public/platform/WebSize.h" @@ -1137,7 +1137,7 @@ bool PrintWebViewHelper::FinalizePrintReadyDocument() { print_preview_context_.FinalizePrintReadyDocument(); // Get the size of the resulting metafile. - PreviewMetafile* metafile = print_preview_context_.metafile(); + PdfMetafileSkia* metafile = print_preview_context_.metafile(); uint32 buf_size = metafile->GetDataSize(); DCHECK_GT(buf_size, 0u); @@ -1833,10 +1833,10 @@ bool PrintWebViewHelper::PrintPreviewContext::CreatePreviewDocument( return false; } - metafile_.reset(new PreviewMetafile); + metafile_.reset(new PdfMetafileSkia); if (!metafile_->Init()) { set_error(PREVIEW_ERROR_METAFILE_INIT_FAILED); - LOG(ERROR) << "PreviewMetafile Init failed"; + LOG(ERROR) << "PdfMetafileSkia Init failed"; return false; } @@ -2001,7 +2001,7 @@ bool PrintWebViewHelper::PrintPreviewContext::generate_draft_pages() const { return generate_draft_pages_; } -PreviewMetafile* PrintWebViewHelper::PrintPreviewContext::metafile() { +PdfMetafileSkia* PrintWebViewHelper::PrintPreviewContext::metafile() { DCHECK(IsRendering()); return metafile_.get(); } diff --git a/android_webview/renderer/print_web_view_helper.h b/android_webview/renderer/print_web_view_helper.h index 23dbec2..b468f44 100644 --- a/android_webview/renderer/print_web_view_helper.h +++ b/android_webview/renderer/print_web_view_helper.h @@ -16,7 +16,7 @@ #include "base/time/time.h" #include "content/public/renderer/render_view_observer.h" #include "content/public/renderer/render_view_observer_tracker.h" -#include "printing/metafile_impl.h" +#include "printing/pdf_metafile_skia.h" #include "third_party/WebKit/public/platform/WebCanvas.h" #include "third_party/WebKit/public/web/WebNode.h" #include "third_party/WebKit/public/web/WebPrintParams.h" @@ -420,7 +420,7 @@ class PrintWebViewHelper int total_page_count() const; bool generate_draft_pages() const; - PreviewMetafile* metafile(); + PdfMetafileSkia* metafile(); gfx::Size GetPrintCanvasSize() const; int last_error() const; @@ -440,7 +440,7 @@ class PrintWebViewHelper blink::WebNode source_node_; scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view_; - scoped_ptr<PreviewMetafile> metafile_; + scoped_ptr<PdfMetafileSkia> metafile_; // Total page count in the renderer. int total_page_count_; diff --git a/android_webview/renderer/print_web_view_helper_linux.cc b/android_webview/renderer/print_web_view_helper_linux.cc index b84b68d..40b4378 100644 --- a/android_webview/renderer/print_web_view_helper_linux.cc +++ b/android_webview/renderer/print_web_view_helper_linux.cc @@ -11,9 +11,9 @@ #include "base/memory/scoped_ptr.h" #include "content/public/renderer/render_thread.h" #include "printing/metafile.h" -#include "printing/metafile_impl.h" #include "printing/metafile_skia_wrapper.h" #include "printing/page_size_margins.h" +#include "printing/pdf_metafile_skia.h" #include "skia/ext/platform_device.h" #include "skia/ext/vector_canvas.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" @@ -37,7 +37,7 @@ bool PrintWebViewHelper::RenderPreviewPage( scoped_ptr<Metafile> draft_metafile; Metafile* initial_render_metafile = print_preview_context_.metafile(); if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) { - draft_metafile.reset(new PreviewMetafile); + draft_metafile.reset(new PdfMetafileSkia); initial_render_metafile = draft_metafile.get(); } @@ -62,7 +62,7 @@ bool PrintWebViewHelper::RenderPreviewPage( bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, int page_count, const gfx::Size& canvas_size) { - NativeMetafile metafile; + PdfMetafileSkia metafile; if (!metafile.Init()) return false; diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc index 5886209..3880a27 100644 --- a/chrome/browser/printing/print_view_manager_base.cc +++ b/chrome/browser/printing/print_view_manager_base.cc @@ -25,7 +25,7 @@ #include "content/public/browser/notification_source.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" -#include "printing/metafile_impl.h" +#include "printing/pdf_metafile_skia.h" #include "printing/printed_document.h" #include "ui/base/l10n/l10n_util.h" @@ -183,7 +183,7 @@ void PrintViewManagerBase::OnDidPrintPage( } } - scoped_ptr<NativeMetafile> metafile(new NativeMetafile); + scoped_ptr<PdfMetafileSkia> metafile(new PdfMetafileSkia); if (metafile_must_be_valid) { if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) { NOTREACHED() << "Invalid metafile header"; diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc index d348961..09e6f0e 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc @@ -72,7 +72,7 @@ #include "printing/backend/print_backend.h" #include "printing/backend/print_backend_consts.h" #include "printing/metafile.h" -#include "printing/metafile_impl.h" +#include "printing/pdf_metafile_skia.h" #include "printing/pdf_render_settings.h" #include "printing/print_settings.h" #include "printing/printing_context.h" @@ -1309,7 +1309,7 @@ void PrintPreviewHandler::PostPrintToPdfTask() { NOTREACHED() << "Preview data was checked before file dialog."; return; } - scoped_ptr<printing::PreviewMetafile> metafile(new printing::PreviewMetafile); + scoped_ptr<printing::PdfMetafileSkia> metafile(new printing::PdfMetafileSkia); metafile->InitFromData(static_cast<const void*>(data->front()), data->size()); BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, diff --git a/chrome/common/print_messages.h b/chrome/common/print_messages.h index fa86dbd..a51c1cc 100644 --- a/chrome/common/print_messages.h +++ b/chrome/common/print_messages.h @@ -395,7 +395,7 @@ IPC_SYNC_MESSAGE_ROUTED1_1(PrintHostMsg_ScriptedPrint, #if defined(OS_CHROMEOS) || defined(OS_ANDROID) // Asks the browser to create a temporary file for the renderer to fill -// in resulting NativeMetafile in printing. +// in resulting PdfMetafileSkia in printing. IPC_SYNC_MESSAGE_CONTROL1_2(PrintHostMsg_AllocateTempFileForPrinting, int /* render_view_id */, base::FileDescriptor /* temp file fd */, diff --git a/chrome/renderer/printing/mock_printer.cc b/chrome/renderer/printing/mock_printer.cc index bb44c89..dba8a34 100644 --- a/chrome/renderer/printing/mock_printer.cc +++ b/chrome/renderer/printing/mock_printer.cc @@ -11,7 +11,7 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/common/print_messages.h" #include "ipc/ipc_message_utils.h" -#include "printing/metafile_impl.h" +#include "printing/pdf_metafile_skia.h" #include "printing/units.h" #include "testing/gtest/include/gtest/gtest.h" @@ -216,7 +216,7 @@ void MockPrinter::PrintPage(const PrintHostMsg_DidPrintPage_Params& params) { #if defined(OS_MACOSX) printing::PdfMetafileCg metafile; #else - printing::NativeMetafile metafile; + printing::PdfMetafileSkia metafile; #endif metafile.InitFromData(metafile_data.memory(), params.data_size); printing::Image image(metafile); diff --git a/chrome/renderer/printing/print_web_view_helper.cc b/chrome/renderer/printing/print_web_view_helper.cc index 27ea08f..db73c37 100644 --- a/chrome/renderer/printing/print_web_view_helper.cc +++ b/chrome/renderer/printing/print_web_view_helper.cc @@ -27,7 +27,7 @@ #include "content/public/renderer/render_view.h" #include "net/base/escape.h" #include "printing/metafile.h" -#include "printing/metafile_impl.h" +#include "printing/pdf_metafile_skia.h" #include "printing/units.h" #include "skia/ext/vector_platform_device_skia.h" #include "third_party/WebKit/public/platform/WebSize.h" @@ -1146,7 +1146,7 @@ bool PrintWebViewHelper::FinalizePrintReadyDocument() { print_preview_context_.FinalizePrintReadyDocument(); // Get the size of the resulting metafile. - PreviewMetafile* metafile = print_preview_context_.metafile(); + PdfMetafileSkia* metafile = print_preview_context_.metafile(); uint32 buf_size = metafile->GetDataSize(); DCHECK_GT(buf_size, 0u); @@ -1769,10 +1769,10 @@ bool PrintWebViewHelper::PrintPreviewContext::CreatePreviewDocument( return false; } - metafile_.reset(new PreviewMetafile); + metafile_.reset(new PdfMetafileSkia); if (!metafile_->Init()) { set_error(PREVIEW_ERROR_METAFILE_INIT_FAILED); - LOG(ERROR) << "PreviewMetafile Init failed"; + LOG(ERROR) << "PdfMetafileSkia Init failed"; return false; } @@ -1937,7 +1937,7 @@ bool PrintWebViewHelper::PrintPreviewContext::generate_draft_pages() const { return generate_draft_pages_; } -PreviewMetafile* PrintWebViewHelper::PrintPreviewContext::metafile() { +PdfMetafileSkia* PrintWebViewHelper::PrintPreviewContext::metafile() { DCHECK(IsRendering()); return metafile_.get(); } diff --git a/chrome/renderer/printing/print_web_view_helper.h b/chrome/renderer/printing/print_web_view_helper.h index 53fde04..b4d7d06 100644 --- a/chrome/renderer/printing/print_web_view_helper.h +++ b/chrome/renderer/printing/print_web_view_helper.h @@ -15,7 +15,7 @@ #include "base/time/time.h" #include "content/public/renderer/render_view_observer.h" #include "content/public/renderer/render_view_observer_tracker.h" -#include "printing/metafile_impl.h" +#include "printing/pdf_metafile_skia.h" #include "third_party/WebKit/public/platform/WebCanvas.h" #include "third_party/WebKit/public/web/WebNode.h" #include "third_party/WebKit/public/web/WebPrintParams.h" @@ -381,7 +381,7 @@ class PrintWebViewHelper int total_page_count() const; bool generate_draft_pages() const; - PreviewMetafile* metafile(); + PdfMetafileSkia* metafile(); gfx::Size GetPrintCanvasSize() const; int last_error() const; @@ -401,7 +401,7 @@ class PrintWebViewHelper blink::WebNode source_node_; scoped_ptr<PrepareFrameAndViewForPrint> prep_frame_view_; - scoped_ptr<PreviewMetafile> metafile_; + scoped_ptr<PdfMetafileSkia> metafile_; // Total page count in the renderer. int total_page_count_; diff --git a/chrome/renderer/printing/print_web_view_helper_linux.cc b/chrome/renderer/printing/print_web_view_helper_linux.cc index 666bf13..948c48d 100644 --- a/chrome/renderer/printing/print_web_view_helper_linux.cc +++ b/chrome/renderer/printing/print_web_view_helper_linux.cc @@ -9,9 +9,9 @@ #include "chrome/common/print_messages.h" #include "content/public/renderer/render_thread.h" #include "printing/metafile.h" -#include "printing/metafile_impl.h" #include "printing/metafile_skia_wrapper.h" #include "printing/page_size_margins.h" +#include "printing/pdf_metafile_skia.h" #include "skia/ext/platform_device.h" #include "skia/ext/vector_canvas.h" #include "third_party/WebKit/public/web/WebLocalFrame.h" @@ -35,7 +35,7 @@ bool PrintWebViewHelper::RenderPreviewPage( scoped_ptr<Metafile> draft_metafile; Metafile* initial_render_metafile = print_preview_context_.metafile(); if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) { - draft_metafile.reset(new PreviewMetafile); + draft_metafile.reset(new PdfMetafileSkia); initial_render_metafile = draft_metafile.get(); } @@ -60,7 +60,7 @@ bool PrintWebViewHelper::RenderPreviewPage( bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, int page_count, const gfx::Size& canvas_size) { - NativeMetafile metafile; + PdfMetafileSkia metafile; if (!metafile.Init()) return false; diff --git a/chrome/renderer/printing/print_web_view_helper_mac.mm b/chrome/renderer/printing/print_web_view_helper_mac.mm index 207eea7..219a4fa 100644 --- a/chrome/renderer/printing/print_web_view_helper_mac.mm +++ b/chrome/renderer/printing/print_web_view_helper_mac.mm @@ -11,7 +11,6 @@ #include "base/metrics/histogram.h" #include "chrome/common/print_messages.h" #include "printing/metafile.h" -#include "printing/metafile_impl.h" #include "printing/metafile_skia_wrapper.h" #include "printing/page_size_margins.h" #include "skia/ext/platform_device.h" @@ -27,7 +26,7 @@ void PrintWebViewHelper::PrintPageInternal( const PrintMsg_PrintPage_Params& params, const gfx::Size& canvas_size, WebFrame* frame) { - NativeMetafile metafile; + PdfMetafileSkia metafile; if (!metafile.Init()) return; @@ -65,11 +64,11 @@ bool PrintWebViewHelper::RenderPreviewPage( is_print_ready_metafile_sent_; if (render_to_draft) { - draft_metafile.reset(new PreviewMetafile()); + draft_metafile.reset(new PdfMetafileSkia()); if (!draft_metafile->Init()) { print_preview_context_.set_error( PREVIEW_ERROR_MAC_DRAFT_METAFILE_INIT_FAILED); - LOG(ERROR) << "Draft PreviewMetafile Init failed"; + LOG(ERROR) << "Draft PdfMetafileSkia Init failed"; return false; } initial_render_metafile = draft_metafile.get(); diff --git a/chrome/renderer/printing/print_web_view_helper_pdf_win.cc b/chrome/renderer/printing/print_web_view_helper_pdf_win.cc index 7461f7e..e2d963e 100644 --- a/chrome/renderer/printing/print_web_view_helper_pdf_win.cc +++ b/chrome/renderer/printing/print_web_view_helper_pdf_win.cc @@ -10,9 +10,9 @@ #include "chrome/common/print_messages.h" #include "content/public/renderer/render_thread.h" #include "printing/metafile.h" -#include "printing/metafile_impl.h" #include "printing/metafile_skia_wrapper.h" #include "printing/page_size_margins.h" +#include "printing/pdf_metafile_skia.h" #include "printing/units.h" #include "skia/ext/platform_device.h" #include "skia/ext/vector_canvas.h" @@ -32,7 +32,7 @@ bool PrintWebViewHelper::RenderPreviewPage( scoped_ptr<Metafile> draft_metafile; Metafile* initial_render_metafile = print_preview_context_.metafile(); if (print_preview_context_.IsModifiable() && is_print_ready_metafile_sent_) { - draft_metafile.reset(new PreviewMetafile); + draft_metafile.reset(new PdfMetafileSkia); initial_render_metafile = draft_metafile.get(); } @@ -59,7 +59,7 @@ bool PrintWebViewHelper::RenderPreviewPage( bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame, int page_count, const gfx::Size& canvas_size) { - NativeMetafile metafile; + PdfMetafileSkia metafile; if (!metafile.Init()) return false; diff --git a/content/renderer/pepper/pepper_plugin_instance_impl.cc b/content/renderer/pepper/pepper_plugin_instance_impl.cc index 9444e20..52987c1 100644 --- a/content/renderer/pepper/pepper_plugin_instance_impl.cc +++ b/content/renderer/pepper/pepper_plugin_instance_impl.cc @@ -133,10 +133,6 @@ #include "ui/events/keycodes/keyboard_codes_posix.h" #endif -#if defined(OS_MACOSX) -#include "printing/metafile_impl.h" -#endif // defined(OS_MACOSX) - #if defined(OS_WIN) #include "base/metrics/histogram.h" #include "base/win/windows_version.h" @@ -1963,9 +1959,6 @@ bool PepperPluginInstanceImpl::PrintPDFOutput(PP_Resource print_output, bool ret = false; #if defined(OS_POSIX) && !defined(OS_ANDROID) - // On Linux we just set the final bits in the native metafile - // (NativeMetafile and PreviewMetafile must have compatible formats, - // i.e. both PDF for this to work). printing::Metafile* metafile = printing::MetafileSkiaWrapper::GetMetafileFromCanvas(*canvas); DCHECK(metafile != NULL); diff --git a/printing/BUILD.gn b/printing/BUILD.gn index 720382d..6e6678d 100644 --- a/printing/BUILD.gn +++ b/printing/BUILD.gn @@ -29,7 +29,6 @@ component("printing") { "image_mac.cc", "image_win.cc", "metafile.h", - "metafile_impl.h", "metafile_skia_wrapper.cc", "metafile_skia_wrapper.h", "page_number.cc", diff --git a/printing/image.cc b/printing/image.cc index bae89f8a..423bc84 100644 --- a/printing/image.cc +++ b/printing/image.cc @@ -11,7 +11,7 @@ #include "base/numerics/safe_conversions.h" #include "base/strings/string_number_conversions.h" #include "printing/metafile.h" -#include "printing/metafile_impl.h" +#include "printing/pdf_metafile_skia.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/gfx/codec/png_codec.h" @@ -150,7 +150,7 @@ bool Image::LoadPng(const std::string& compressed) { bool Image::LoadMetafile(const std::string& data) { DCHECK(!data.empty()); - NativeMetafile metafile; + PdfMetafileSkia metafile; if (!metafile.InitFromData(data.data(), base::checked_cast<uint32>(data.size()))) return false; diff --git a/printing/metafile_impl.h b/printing/metafile_impl.h deleted file mode 100644 index 92bec72..0000000 --- a/printing/metafile_impl.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) 2011 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. - -#ifndef PRINTING_METAFILE_IMPL_H_ -#define PRINTING_METAFILE_IMPL_H_ - -#include "printing/pdf_metafile_skia.h" - -namespace printing { - -// TODO(vitalybuka) Remove following typedefs and replace with PdfMetafileSkia. -typedef PdfMetafileSkia NativeMetafile; -typedef PdfMetafileSkia PreviewMetafile; - -} // namespace printing - -#endif // PRINTING_METAFILE_IMPL_H_ diff --git a/printing/printing.gyp b/printing/printing.gyp index c9106f4..81ffe34 100644 --- a/printing/printing.gyp +++ b/printing/printing.gyp @@ -44,7 +44,6 @@ 'image_mac.cc', 'image_win.cc', 'metafile.h', - 'metafile_impl.h', 'metafile_skia_wrapper.cc', 'metafile_skia_wrapper.h', 'page_number.cc', diff --git a/printing/printing_context_win.cc b/printing/printing_context_win.cc index 4d7ea92..3e4e6e9 100644 --- a/printing/printing_context_win.cc +++ b/printing/printing_context_win.cc @@ -284,7 +284,7 @@ PrintingContext::Result PrintingContextWin::NewPage() { DCHECK(context_); DCHECK(in_print_job_); - // Intentional No-op. NativeMetafile::SafePlayback takes care of calling + // Intentional No-op. PdfMetafileSkia::SafePlayback takes care of calling // ::StartPage(). return OK; @@ -295,7 +295,7 @@ PrintingContext::Result PrintingContextWin::PageDone() { return CANCEL; DCHECK(in_print_job_); - // Intentional No-op. NativeMetafile::SafePlayback takes care of calling + // Intentional No-op. PdfMetafileSkia::SafePlayback takes care of calling // ::EndPage(). return OK; |