summaryrefslogtreecommitdiffstats
path: root/printing
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-17 23:22:06 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-17 23:22:06 +0000
commit89eff96a76bce1e4db7208f911756c3720c0ce5b (patch)
tree230e807550a8110e06c005a897cf3a5977288a8c /printing
parent3e737d0ea26703f67dc591086a9ace4678e74e9b (diff)
downloadchromium_src-89eff96a76bce1e4db7208f911756c3720c0ce5b.zip
chromium_src-89eff96a76bce1e4db7208f911756c3720c0ce5b.tar.gz
chromium_src-89eff96a76bce1e4db7208f911756c3720c0ce5b.tar.bz2
Stop overloading Init() in NativeMetafile.
BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/6709009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78625 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r--printing/emf_win.cc4
-rw-r--r--printing/emf_win.h2
-rw-r--r--printing/emf_win_unittest.cc6
-rw-r--r--printing/image.cc2
-rw-r--r--printing/native_metafile.h2
-rw-r--r--printing/pdf_metafile_mac.cc4
-rw-r--r--printing/pdf_metafile_mac.h2
-rw-r--r--printing/pdf_metafile_mac_unittest.cc2
-rw-r--r--printing/pdf_ps_metafile_cairo.cc5
-rw-r--r--printing/pdf_ps_metafile_cairo.h2
-rw-r--r--printing/pdf_ps_metafile_cairo_unittest.cc2
11 files changed, 17 insertions, 16 deletions
diff --git a/printing/emf_win.cc b/printing/emf_win.cc
index 1d1dd53..6fea291 100644
--- a/printing/emf_win.cc
+++ b/printing/emf_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 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.
@@ -54,7 +54,7 @@ Emf::~Emf() {
DCHECK(!emf_ && !hdc_);
}
-bool Emf::Init(const void* src_buffer, uint32 src_buffer_size) {
+bool Emf::InitFromData(const void* src_buffer, uint32 src_buffer_size) {
DCHECK(!emf_ && !hdc_);
emf_ = SetEnhMetaFileBits(src_buffer_size,
reinterpret_cast<const BYTE*>(src_buffer));
diff --git a/printing/emf_win.h b/printing/emf_win.h
index e054db3..5150356 100644
--- a/printing/emf_win.h
+++ b/printing/emf_win.h
@@ -31,7 +31,7 @@ class Emf : public NativeMetafile {
// NativeMetafile methods.
virtual bool Init() { return true; }
- virtual bool Init(const void* src_buffer, uint32 src_buffer_size);
+ virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size);
virtual bool StartPage();
virtual bool FinishPage();
diff --git a/printing/emf_win_unittest.cc b/printing/emf_win_unittest.cc
index 9ae9323..2f4e2ae 100644
--- a/printing/emf_win_unittest.cc
+++ b/printing/emf_win_unittest.cc
@@ -62,7 +62,7 @@ TEST(EmfTest, DC) {
// Playback the data.
hdc = CreateCompatibleDC(NULL);
EXPECT_TRUE(hdc);
- EXPECT_TRUE(emf.Init(&data.front(), size));
+ EXPECT_TRUE(emf.InitFromData(&data.front(), size));
RECT output_rect = {0, 0, 10, 10};
EXPECT_TRUE(emf.Playback(hdc, &output_rect));
EXPECT_TRUE(DeleteDC(hdc));
@@ -94,7 +94,7 @@ TEST_F(EmfPrintingTest, Enumerate) {
std::string emf_data;
file_util::ReadFileToString(emf_file, &emf_data);
ASSERT_TRUE(emf_data.size());
- EXPECT_TRUE(emf.Init(&emf_data[0], emf_data.size()));
+ EXPECT_TRUE(emf.InitFromData(&emf_data[0], emf_data.size()));
// This will print to file. The reason is that when running inside a
// unit_test, printing::PrintingContext automatically dumps its files to the
@@ -148,7 +148,7 @@ TEST_F(EmfPrintingTest, PageBreak) {
di.cbSize = sizeof(DOCINFO);
di.lpszDocName = L"Test Job";
int job_id = ::StartDoc(dc.Get(), &di);
- EXPECT_TRUE(emf.Init(&data.front(), size));
+ EXPECT_TRUE(emf.InitFromData(&data.front(), size));
EXPECT_TRUE(emf.SafePlayback(dc.Get()));
::EndDoc(dc.Get());
// Since presumably the printer is not real, let us just delete the job from
diff --git a/printing/image.cc b/printing/image.cc
index a99e307..7c2d8d2 100644
--- a/printing/image.cc
+++ b/printing/image.cc
@@ -148,7 +148,7 @@ bool Image::LoadMetafile(const std::string& data) {
DCHECK(!data.empty());
scoped_ptr<NativeMetafile> metafile(
printing::NativeMetafileFactory::CreateMetafile());
- metafile->Init(data.data(), data.size());
+ metafile->InitFromData(data.data(), data.size());
return LoadMetafile(*metafile);
}
diff --git a/printing/native_metafile.h b/printing/native_metafile.h
index 65f9f4c..a076b32 100644
--- a/printing/native_metafile.h
+++ b/printing/native_metafile.h
@@ -48,7 +48,7 @@ class NativeMetafile {
// Initializes the metafile with the data in |src_buffer|. Returns true
// on success.
// Note: It should only be called from within the browser process.
- virtual bool Init(const void* src_buffer, uint32 src_buffer_size) = 0;
+ virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size) = 0;
#if defined(OS_WIN)
// Inserts a custom GDICOMMENT records indicating StartPage/EndPage calls
diff --git a/printing/pdf_metafile_mac.cc b/printing/pdf_metafile_mac.cc
index 36f4947..6c53de9 100644
--- a/printing/pdf_metafile_mac.cc
+++ b/printing/pdf_metafile_mac.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 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.
@@ -47,7 +47,7 @@ bool PdfMetafile::Init() {
return true;
}
-bool PdfMetafile::Init(const void* src_buffer, uint32 src_buffer_size) {
+bool PdfMetafile::InitFromData(const void* src_buffer, uint32 src_buffer_size) {
DCHECK(!context_.get());
DCHECK(!pdf_data_.get());
diff --git a/printing/pdf_metafile_mac.h b/printing/pdf_metafile_mac.h
index b1d3944..d1dbbef 100644
--- a/printing/pdf_metafile_mac.h
+++ b/printing/pdf_metafile_mac.h
@@ -31,7 +31,7 @@ class PdfMetafile : public NativeMetafile {
// NativeMetafile methods.
virtual bool Init();
- virtual bool Init(const void* src_buffer, uint32 src_buffer_size);
+ virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size);
virtual CGContextRef StartPage(const gfx::Size& page_size,
const gfx::Point& content_origin,
diff --git a/printing/pdf_metafile_mac_unittest.cc b/printing/pdf_metafile_mac_unittest.cc
index b45370d..b4b6996 100644
--- a/printing/pdf_metafile_mac_unittest.cc
+++ b/printing/pdf_metafile_mac_unittest.cc
@@ -44,7 +44,7 @@ TEST(PdfMetafileTest, Pdf) {
// Test browser-side constructor.
printing::PdfMetafile pdf2;
- EXPECT_TRUE(pdf2.Init(&buffer.front(), size));
+ EXPECT_TRUE(pdf2.InitFromData(&buffer.front(), size));
// Get the first 4 characters from pdf2.
std::vector<char> buffer2(4, 0);
diff --git a/printing/pdf_ps_metafile_cairo.cc b/printing/pdf_ps_metafile_cairo.cc
index faab29f4..cfa89e4 100644
--- a/printing/pdf_ps_metafile_cairo.cc
+++ b/printing/pdf_ps_metafile_cairo.cc
@@ -113,7 +113,8 @@ bool PdfPsMetafile::Init() {
return true;
}
-bool PdfPsMetafile::Init(const void* src_buffer, uint32 src_buffer_size) {
+bool PdfPsMetafile::InitFromData(const void* src_buffer,
+ uint32 src_buffer_size) {
// We need to check at least these two members to ensure Init() has not been
// called before
DCHECK(!context_);
@@ -131,7 +132,7 @@ bool PdfPsMetafile::SetRawData(const void* src_buffer,
uint32 src_buffer_size) {
if (!context_) {
// If Init has not already been called, just call Init()
- return Init(src_buffer, src_buffer_size);
+ return InitFromData(src_buffer, src_buffer_size);
}
// If a context has already been created, remember this data in
// raw_override_data_
diff --git a/printing/pdf_ps_metafile_cairo.h b/printing/pdf_ps_metafile_cairo.h
index 6cfe5ff..1294862 100644
--- a/printing/pdf_ps_metafile_cairo.h
+++ b/printing/pdf_ps_metafile_cairo.h
@@ -23,7 +23,7 @@ class PdfPsMetafile : public NativeMetafile {
// NativeMetafile methods.
virtual bool Init();
- virtual bool Init(const void* src_buffer, uint32 src_buffer_size);
+ virtual bool InitFromData(const void* src_buffer, uint32 src_buffer_size);
virtual cairo_t* StartPage(const gfx::Size& page_size,
double margin_top_in_points,
diff --git a/printing/pdf_ps_metafile_cairo_unittest.cc b/printing/pdf_ps_metafile_cairo_unittest.cc
index 048c98c..e180538 100644
--- a/printing/pdf_ps_metafile_cairo_unittest.cc
+++ b/printing/pdf_ps_metafile_cairo_unittest.cc
@@ -56,7 +56,7 @@ TEST_F(PdfPsTest, Pdf) {
// Tests another constructor.
printing::PdfPsMetafile pdf2;
- EXPECT_TRUE(pdf2.Init(&buffer.front(), size));
+ EXPECT_TRUE(pdf2.InitFromData(&buffer.front(), size));
// Tries to get the first 4 characters from pdf2.
std::vector<char> buffer2(4, 0x00);