diff options
author | dpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-24 23:37:45 +0000 |
---|---|---|
committer | dpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-24 23:37:45 +0000 |
commit | 96fddd8b9f17a3545e210301ae5430e34ae4aa9a (patch) | |
tree | 798c024a05a476a5fe56874d74a77ca254518c39 /printing | |
parent | 6a5a58b5be45b26be7760cd1ae8fad6f2d2d2689 (diff) | |
download | chromium_src-96fddd8b9f17a3545e210301ae5430e34ae4aa9a.zip chromium_src-96fddd8b9f17a3545e210301ae5430e34ae4aa9a.tar.gz chromium_src-96fddd8b9f17a3545e210301ae5430e34ae4aa9a.tar.bz2 |
Removing GetData helper from NativeMetafile interface and also renaming it to GetDataAsVector to avoid overloading.
Also making it private since it is only used internally.
BUG=NONE
TEST=NONE
Review URL: http://codereview.chromium.org/6713081
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79343 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r-- | printing/emf_win.cc | 4 | ||||
-rw-r--r-- | printing/emf_win.h | 9 | ||||
-rw-r--r-- | printing/emf_win_unittest.cc | 6 | ||||
-rw-r--r-- | printing/native_metafile.h | 3 |
4 files changed, 12 insertions, 10 deletions
diff --git a/printing/emf_win.cc b/printing/emf_win.cc index c411a40..4dda7af 100644 --- a/printing/emf_win.cc +++ b/printing/emf_win.cc @@ -156,7 +156,7 @@ bool Emf::GetData(void* buffer, uint32 size) const { return size2 == size && size2 != 0; } -bool Emf::GetData(std::vector<uint8>* buffer) const { +bool Emf::GetDataAsVector(std::vector<uint8>* buffer) const { uint32 size = GetDataSize(); if (!size) return false; @@ -176,7 +176,7 @@ bool Emf::SaveTo(const FilePath& file_path) const { bool success = false; std::vector<uint8> buffer; - if (GetData(&buffer)) { + if (GetDataAsVector(&buffer)) { DWORD written = 0; if (WriteFile(file, &*buffer.begin(), static_cast<DWORD>(buffer.size()), &written, NULL) && diff --git a/printing/emf_win.h b/printing/emf_win.h index f4ee30f..5f9bd5a 100644 --- a/printing/emf_win.h +++ b/printing/emf_win.h @@ -81,13 +81,18 @@ class Emf : public NativeMetafile { virtual bool Playback(HDC hdc, const RECT* rect) const; virtual bool SafePlayback(HDC hdc) const; - virtual bool GetData(std::vector<uint8>* buffer) const; - virtual HENHMETAFILE emf() const { return emf_; } private: + FRIEND_TEST_ALL_PREFIXES(EmfTest, DC); + FRIEND_TEST_ALL_PREFIXES(EmfPrintingTest, PageBreak); + FRIEND_TEST_ALL_PREFIXES(EmfTest, FileBackedEmf); + + // Retrieves the underlying data stream. It is a helper function. + bool GetDataAsVector(std::vector<uint8>* buffer) const; + // Playbacks safely one EMF record. static int CALLBACK SafePlaybackProc(HDC hdc, HANDLETABLE* handle_table, diff --git a/printing/emf_win_unittest.cc b/printing/emf_win_unittest.cc index 2492104..2e7c2d0 100644 --- a/printing/emf_win_unittest.cc +++ b/printing/emf_win_unittest.cc @@ -56,7 +56,7 @@ TEST(EmfTest, DC) { EXPECT_TRUE(emf.FinishDocument()); size = emf.GetDataSize(); EXPECT_GT(size, EMF_HEADER_SIZE); - EXPECT_TRUE(emf.GetData(&data)); + EXPECT_TRUE(emf.GetDataAsVector(&data)); EXPECT_EQ(data.size(), size); } @@ -143,7 +143,7 @@ TEST_F(EmfPrintingTest, PageBreak) { } EXPECT_TRUE(emf.FinishDocument()); size = emf.GetDataSize(); - EXPECT_TRUE(emf.GetData(&data)); + EXPECT_TRUE(emf.GetDataAsVector(&data)); EXPECT_EQ(data.size(), size); } @@ -183,7 +183,7 @@ TEST(EmfTest, FileBackedEmf) { EXPECT_TRUE(emf.FinishDocument()); size = emf.GetDataSize(); EXPECT_GT(size, EMF_HEADER_SIZE); - EXPECT_TRUE(emf.GetData(&data)); + EXPECT_TRUE(emf.GetDataAsVector(&data)); EXPECT_EQ(data.size(), size); } int64 file_size = 0; diff --git a/printing/native_metafile.h b/printing/native_metafile.h index abf3203..8bb9651 100644 --- a/printing/native_metafile.h +++ b/printing/native_metafile.h @@ -115,9 +115,6 @@ class NativeMetafile { // details. virtual bool SafePlayback(gfx::NativeDrawingContext hdc) const = 0; - // Retrieves the underlying data stream. It is a helper function. - virtual bool GetData(std::vector<uint8>* buffer) const = 0; - virtual HENHMETAFILE emf() const = 0; #elif defined(OS_MACOSX) // Renders the given page into |rect| in the given context. |