diff options
24 files changed, 43 insertions, 44 deletions
diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc index 6c9bed0..c60aa4e 100644 --- a/chrome/browser/printing/print_view_manager.cc +++ b/chrome/browser/printing/print_view_manager.cc @@ -134,7 +134,7 @@ void PrintViewManager::OnDidPrintPage( } } - scoped_ptr<NativeMetafile> metafile(NativeMetafileFactory::CreateMetafile()); + scoped_ptr<NativeMetafile> metafile(NativeMetafileFactory::Create()); if (metafile_must_be_valid) { if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) { NOTREACHED() << "Invalid metafile header"; diff --git a/chrome/common/common_param_traits_unittest.cc b/chrome/common/common_param_traits_unittest.cc index 7928032..d19695c 100644 --- a/chrome/common/common_param_traits_unittest.cc +++ b/chrome/common/common_param_traits_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// 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. @@ -238,17 +238,17 @@ TEST(IPCMessageTest, PageRange) { #if defined(OS_WIN) TEST(IPCMessageTest, Metafile) { scoped_ptr<printing::NativeMetafile> metafile( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); RECT test_rect = {0, 0, 100, 100}; // Create a metafile using the screen DC as a reference. metafile->CreateDc(NULL, NULL); - metafile->Close(); + metafile->FinishDocument(); IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); IPC::ParamTraits<printing::NativeMetafile>::Write(&msg, *metafile); scoped_ptr<printing::NativeMetafile> output( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); void* iter = NULL; EXPECT_TRUE(IPC::ParamTraits<printing::NativeMetafile>::Read( &msg, &iter, output.get())); @@ -267,7 +267,7 @@ TEST(IPCMessageTest, Metafile) { bad_msg.WriteData(bogus_data.get(), bogus_data_size); // Make sure we don't read out the metafile! scoped_ptr<printing::NativeMetafile> bad_output( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); iter = NULL; EXPECT_FALSE(IPC::ParamTraits<printing::NativeMetafile>::Read( &bad_msg, &iter, bad_output.get())); diff --git a/chrome/renderer/mock_printer.cc b/chrome/renderer/mock_printer.cc index 808524e..982ab80 100644 --- a/chrome/renderer/mock_printer.cc +++ b/chrome/renderer/mock_printer.cc @@ -139,7 +139,7 @@ void MockPrinter::PrintPage(const ViewHostMsg_DidPrintPage_Params& params) { #endif metafile_data.Map(params.data_size); scoped_ptr<printing::NativeMetafile> metafile( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); metafile->InitFromData(metafile_data.memory(), params.data_size); printing::Image image(*metafile); MockPrinterPage* page_data = new MockPrinterPage(metafile_data.memory(), diff --git a/chrome/renderer/print_web_view_helper_linux.cc b/chrome/renderer/print_web_view_helper_linux.cc index d9015d6..970b47c 100644 --- a/chrome/renderer/print_web_view_helper_linux.cc +++ b/chrome/renderer/print_web_view_helper_linux.cc @@ -28,7 +28,7 @@ void PrintWebViewHelper::CreatePreviewDocument( // We only can use PDF in the renderer because Cairo needs to create a // temporary file for a PostScript surface. scoped_ptr<printing::NativeMetafile> metafile( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); int page_count = 0; if (!RenderPages(params, frame, node, false, &page_count, metafile.get())) @@ -57,7 +57,7 @@ void PrintWebViewHelper::PrintPages(const ViewMsg_PrintPages_Params& params, // We only can use PDF in the renderer because Cairo needs to create a // temporary file for a PostScript surface. scoped_ptr<printing::NativeMetafile> metafile( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); int page_count = 0; bool send_expected_page_count = #if defined(OS_CHROMEOS) @@ -189,7 +189,7 @@ bool PrintWebViewHelper::RenderPages(const ViewMsg_PrintPages_Params& params, } } - metafile->Close(); + metafile->FinishDocument(); return true; } diff --git a/chrome/renderer/print_web_view_helper_mac.mm b/chrome/renderer/print_web_view_helper_mac.mm index 64c802d..c75790d 100644 --- a/chrome/renderer/print_web_view_helper_mac.mm +++ b/chrome/renderer/print_web_view_helper_mac.mm @@ -20,7 +20,7 @@ void PrintWebViewHelper::PrintPage(const ViewMsg_PrintPage_Params& params, const gfx::Size& canvas_size, WebFrame* frame) { scoped_ptr<printing::NativeMetafile> metafile( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); if (!metafile->Init()) return; @@ -31,7 +31,7 @@ void PrintWebViewHelper::PrintPage(const ViewMsg_PrintPage_Params& params, gfx::Point origin(0.0f, 0.0f); RenderPage(params.params.printable_size, origin, scale_factor, page_number, frame, metafile.get()); - metafile->Close(); + metafile->FinishDocument(); ViewHostMsg_DidPrintPage_Params page_params; page_params.data_size = metafile->GetDataSize(); @@ -67,7 +67,7 @@ void PrintWebViewHelper::CreatePreviewDocument( return; scoped_ptr<printing::NativeMetafile> metafile( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); if (!metafile->Init()) return; @@ -86,7 +86,7 @@ void PrintWebViewHelper::CreatePreviewDocument( static_cast<int>(params.pages[i]), frame, metafile.get()); } } - metafile->Close(); + metafile->FinishDocument(); ViewHostMsg_DidPreviewDocument_Params preview_params; preview_params.data_size = metafile->GetDataSize(); diff --git a/chrome/renderer/print_web_view_helper_win.cc b/chrome/renderer/print_web_view_helper_win.cc index 33ff59b..d4b37db 100644 --- a/chrome/renderer/print_web_view_helper_win.cc +++ b/chrome/renderer/print_web_view_helper_win.cc @@ -73,7 +73,7 @@ void PrintWebViewHelper::PrintPage(const ViewMsg_PrintPage_Params& params, // Generate a memory-based metafile. It will use the current screen's DPI. // Each metafile contains a single page. scoped_ptr<printing::NativeMetafile> metafile( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); metafile->CreateDc(NULL, NULL); DCHECK(metafile->context()); skia::PlatformDevice::InitializeDC(metafile->context()); @@ -88,7 +88,7 @@ void PrintWebViewHelper::PrintPage(const ViewMsg_PrintPage_Params& params, RenderPage(params.params, &scale_factor, page_number, frame, &metafile); // Close the device context to retrieve the compiled metafile. - if (!metafile->Close()) + if (!metafile->FinishDocument()) NOTREACHED(); // Get the size of the compiled metafile. @@ -141,7 +141,7 @@ void PrintWebViewHelper::CreatePreviewDocument( // EMF with PDF metafile. // http://code.google.com/p/chromium/issues/detail?id=62889 scoped_ptr<printing::NativeMetafile> metafile( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); metafile->CreateDc(NULL, NULL); DCHECK(metafile->context()); skia::PlatformDevice::InitializeDC(metafile->context()); @@ -166,7 +166,7 @@ void PrintWebViewHelper::CreatePreviewDocument( } // Close the device context to retrieve the compiled metafile. - if (!metafile->Close()) + if (!metafile->FinishDocument()) NOTREACHED(); // Get the size of the compiled metafile. @@ -276,11 +276,11 @@ void PrintWebViewHelper::RenderPage( static_cast<skia::VectorPlatformDevice*>(canvas.getDevice()); if (platform_device->alpha_blend_used() && !params.supports_alpha_blend) { // Close the device context to retrieve the compiled metafile. - if (!(*metafile)->Close()) + if (!(*metafile)->FinishDocument()) NOTREACHED(); scoped_ptr<printing::NativeMetafile> metafile2( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); // Page used alpha blend, but printer doesn't support it. Rewrite the // metafile and flatten out the transparency. HDC bitmap_dc = CreateCompatibleDC(GetDC(NULL)); diff --git a/chrome/service/service_utility_process_host.cc b/chrome/service/service_utility_process_host.cc index a340d8d..b0a0add 100644 --- a/chrome/service/service_utility_process_host.cc +++ b/chrome/service/service_utility_process_host.cc @@ -205,7 +205,7 @@ void ServiceUtilityProcessHost::Client::MetafileAvailable( LOG(WARNING) << "Unable to set scratch metafile directory"; #if defined(OS_WIN) scoped_ptr<printing::NativeMetafile> metafile( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); if (!metafile->CreateFromFile(metafile_path)) { OnRenderPDFPagesToMetafileFailed(); } else { diff --git a/chrome/utility/utility_thread.cc b/chrome/utility/utility_thread.cc index 5628860..cca4b34 100644 --- a/chrome/utility/utility_thread.cc +++ b/chrome/utility/utility_thread.cc @@ -260,7 +260,7 @@ bool UtilityThread::RenderPDFToWinMetafile( return false; scoped_ptr<printing::NativeMetafile> metafile( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); metafile->CreateFileBackedDc(NULL, NULL, metafile_path); // Since we created the metafile using the screen DPI (but we actually want // the PDF DLL to print using the passed in render_dpi, we apply the following @@ -291,7 +291,7 @@ bool UtilityThread::RenderPDFToWinMetafile( metafile->FinishPage(); } } - metafile->Close(); + metafile->FinishDocument(); return ret; } #endif // defined(OS_WIN) diff --git a/content/plugin/webplugin_delegate_stub.cc b/content/plugin/webplugin_delegate_stub.cc index cf26fc0..2de6e42 100644 --- a/content/plugin/webplugin_delegate_stub.cc +++ b/content/plugin/webplugin_delegate_stub.cc @@ -272,7 +272,7 @@ void WebPluginDelegateStub::OnPrint(base::SharedMemoryHandle* shared_memory, uint32* size) { #if defined(OS_WIN) scoped_ptr<printing::NativeMetafile> metafile( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); if (!metafile->CreateDc(NULL, NULL)) { NOTREACHED(); return; @@ -280,7 +280,7 @@ void WebPluginDelegateStub::OnPrint(base::SharedMemoryHandle* shared_memory, HDC hdc = metafile->context(); skia::PlatformDevice::InitializeDC(hdc); delegate_->Print(hdc); - if (!metafile->Close()) { + if (!metafile->FinishDocument()) { NOTREACHED(); return; } @@ -448,4 +448,3 @@ void WebPluginDelegateStub::OnSetFakeAcceleratedSurfaceWindowHandle( delegate_->set_windowed_handle(window); } #endif - diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc index e2795f4..1571295 100644 --- a/content/renderer/webplugin_delegate_proxy.cc +++ b/content/renderer/webplugin_delegate_proxy.cc @@ -922,7 +922,7 @@ void WebPluginDelegateProxy::Print(gfx::NativeDrawingContext context) { #if defined(OS_WIN) scoped_ptr<printing::NativeMetafile> metafile( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); if (!metafile->InitFromData(memory.memory(), size)) { NOTREACHED(); return; diff --git a/printing/emf_win.cc b/printing/emf_win.cc index 1b57add..de652f1 100644 --- a/printing/emf_win.cc +++ b/printing/emf_win.cc @@ -87,7 +87,7 @@ bool Emf::CreateFromFile(const FilePath& metafile_path) { } -bool Emf::Close() { +bool Emf::FinishDocument() { DCHECK(!emf_ && hdc_); emf_ = CloseEnhMetaFile(hdc_); DCHECK(emf_); diff --git a/printing/emf_win.h b/printing/emf_win.h index d1a5038..e3a0a8e 100644 --- a/printing/emf_win.h +++ b/printing/emf_win.h @@ -43,7 +43,7 @@ class Emf : public NativeMetafile { const gfx::Point& content_origin, const float& scale_factor); virtual bool FinishPage(); - virtual bool Close(); + virtual bool FinishDocument(); virtual uint32 GetDataSize() const; virtual bool GetData(void* buffer, uint32 size) const; diff --git a/printing/emf_win_unittest.cc b/printing/emf_win_unittest.cc index a5bd583..9f2899b 100644 --- a/printing/emf_win_unittest.cc +++ b/printing/emf_win_unittest.cc @@ -52,7 +52,7 @@ TEST(EmfTest, DC) { EXPECT_TRUE(emf.CreateDc(hdc, &rect)); EXPECT_TRUE(emf.context() != NULL); // In theory, you'd use the HDC with GDI functions here. - EXPECT_TRUE(emf.Close()); + EXPECT_TRUE(emf.FinishDocument()); uint32 size = emf.GetDataSize(); EXPECT_EQ(size, EMF_HEADER_SIZE); std::vector<BYTE> data; @@ -138,7 +138,7 @@ TEST_F(EmfPrintingTest, PageBreak) { EXPECT_TRUE(emf.FinishPage()); --pages; } - EXPECT_TRUE(emf.Close()); + EXPECT_TRUE(emf.FinishDocument()); uint32 size = emf.GetDataSize(); std::vector<BYTE> data; EXPECT_TRUE(emf.GetData(&data)); @@ -176,7 +176,7 @@ TEST(EmfTest, FileBackedDC) { EXPECT_TRUE(emf.CreateFileBackedDc(hdc, &rect, metafile_path)); EXPECT_TRUE(emf.context() != NULL); // In theory, you'd use the HDC with GDI functions here. - EXPECT_TRUE(emf.Close()); + EXPECT_TRUE(emf.FinishDocument()); uint32 size = emf.GetDataSize(); EXPECT_EQ(size, EMF_HEADER_SIZE); diff --git a/printing/image.cc b/printing/image.cc index 7c2d8d2..2f5d7e3 100644 --- a/printing/image.cc +++ b/printing/image.cc @@ -147,7 +147,7 @@ bool Image::LoadPng(const std::string& compressed) { bool Image::LoadMetafile(const std::string& data) { DCHECK(!data.empty()); scoped_ptr<NativeMetafile> metafile( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); metafile->InitFromData(data.data(), data.size()); return LoadMetafile(*metafile); } diff --git a/printing/native_metafile.h b/printing/native_metafile.h index 5981bf5..ef1e546 100644 --- a/printing/native_metafile.h +++ b/printing/native_metafile.h @@ -64,7 +64,7 @@ class NativeMetafile { // Closes the metafile. No further rendering is allowed (the current page // is implicitly closed). - virtual bool Close() = 0; + virtual bool FinishDocument() = 0; // Returns the size of the underlying data stream. Only valid after Close() // has been called. diff --git a/printing/native_metafile_factory.cc b/printing/native_metafile_factory.cc index a41428f..f971452 100644 --- a/printing/native_metafile_factory.cc +++ b/printing/native_metafile_factory.cc @@ -15,7 +15,7 @@ namespace printing { // static -printing::NativeMetafile* NativeMetafileFactory::CreateMetafile() { +printing::NativeMetafile* NativeMetafileFactory::Create() { #if defined(OS_WIN) return new printing::Emf; #elif defined(OS_MACOSX) diff --git a/printing/native_metafile_factory.h b/printing/native_metafile_factory.h index d1543c7..b13f17a 100644 --- a/printing/native_metafile_factory.h +++ b/printing/native_metafile_factory.h @@ -18,7 +18,7 @@ class NativeMetafileFactory { public: // This method returns a pointer to the appropriate NativeMetafile object // according to the platform. - static printing::NativeMetafile* CreateMetafile(); + static printing::NativeMetafile* Create(); private: NativeMetafileFactory(); diff --git a/printing/pdf_metafile_mac.cc b/printing/pdf_metafile_mac.cc index 031ca21..f5a36f8 100644 --- a/printing/pdf_metafile_mac.cc +++ b/printing/pdf_metafile_mac.cc @@ -96,7 +96,7 @@ bool PdfMetafile::FinishPage() { return true; } -bool PdfMetafile::Close() { +bool PdfMetafile::FinishDocument() { DCHECK(context_.get()); DCHECK(!page_is_open_); diff --git a/printing/pdf_metafile_mac.h b/printing/pdf_metafile_mac.h index 6641062..c5a2a4a 100644 --- a/printing/pdf_metafile_mac.h +++ b/printing/pdf_metafile_mac.h @@ -37,7 +37,7 @@ class PdfMetafile : public NativeMetafile { const gfx::Point& content_origin, const float& scale_factor); virtual bool FinishPage(); - virtual bool Close(); + virtual bool FinishDocument(); virtual uint32 GetDataSize() const; virtual bool GetData(void* dst_buffer, uint32 dst_buffer_size) const; diff --git a/printing/pdf_metafile_mac_unittest.cc b/printing/pdf_metafile_mac_unittest.cc index b4b6996..b237978 100644 --- a/printing/pdf_metafile_mac_unittest.cc +++ b/printing/pdf_metafile_mac_unittest.cc @@ -32,7 +32,7 @@ TEST(PdfMetafileTest, Pdf) { pdf.StartPage(size_2, origin_2, 2.0); pdf.FinishPage(); - pdf.Close(); + pdf.FinishDocument(); // Check data size. uint32 size = pdf.GetDataSize(); diff --git a/printing/pdf_ps_metafile_cairo.cc b/printing/pdf_ps_metafile_cairo.cc index 32d882f..6c42bd4 100644 --- a/printing/pdf_ps_metafile_cairo.cc +++ b/printing/pdf_ps_metafile_cairo.cc @@ -176,7 +176,7 @@ bool PdfPsMetafile::FinishPage() { return true; } -bool PdfPsMetafile::Close() { +bool PdfPsMetafile::FinishDocument() { DCHECK(IsSurfaceValid(surface_)); DCHECK(IsContextValid(context_)); diff --git a/printing/pdf_ps_metafile_cairo.h b/printing/pdf_ps_metafile_cairo.h index d3d3824..5ff59db 100644 --- a/printing/pdf_ps_metafile_cairo.h +++ b/printing/pdf_ps_metafile_cairo.h @@ -35,7 +35,7 @@ class PdfPsMetafile : public NativeMetafile { const gfx::Point& content_origin, const float& scale_factor); virtual bool FinishPage(); - virtual bool Close(); + virtual bool FinishDocument(); virtual uint32 GetDataSize() const; virtual bool GetData(void* dst_buffer, uint32 dst_buffer_size) const; diff --git a/printing/pdf_ps_metafile_cairo_unittest.cc b/printing/pdf_ps_metafile_cairo_unittest.cc index d4f2090..fa1a239 100644 --- a/printing/pdf_ps_metafile_cairo_unittest.cc +++ b/printing/pdf_ps_metafile_cairo_unittest.cc @@ -43,7 +43,7 @@ TEST_F(PdfPsTest, Pdf) { EXPECT_TRUE(pdf.FinishPage()); // Closes the file. - pdf.Close(); + pdf.FinishDocument(); // Checks data size. uint32 size = pdf.GetDataSize(); @@ -75,7 +75,7 @@ TEST_F(PdfPsTest, Pdf) { std::string test_raw_data = "Dummy PDF"; EXPECT_TRUE(pdf3.SetRawData(test_raw_data.c_str(), test_raw_data.size())); EXPECT_TRUE(pdf3.FinishPage()); - pdf3.Close(); + pdf3.FinishDocument(); size = pdf3.GetDataSize(); EXPECT_EQ(test_raw_data.size(), size); std::string output; diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index b0fa47e..1b4d0be 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -1094,7 +1094,7 @@ bool PluginInstance::PrintPDFOutput(PP_Resource print_output, canvas->endPlatformPaint(); #elif defined(OS_MACOSX) scoped_ptr<printing::NativeMetafile> metafile( - printing::NativeMetafileFactory::CreateMetafile()); + printing::NativeMetafileFactory::Create()); // Create a PDF metafile and render from there into the passed in context. if (metafile->InitFromData(buffer->mapped_buffer(), buffer->size())) { // Flip the transform. |