summaryrefslogtreecommitdiffstats
path: root/chrome/utility
diff options
context:
space:
mode:
authordpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 16:46:20 +0000
committerdpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 16:46:20 +0000
commit1f3b6804df95e260d5e9a3fff0c478818240cdb9 (patch)
tree208ac1115304f544e62e1483ec12a7e17d7ff078 /chrome/utility
parent21f1168bab8f4ac626011148ae6e65d8fd24272a (diff)
downloadchromium_src-1f3b6804df95e260d5e9a3fff0c478818240cdb9.zip
chromium_src-1f3b6804df95e260d5e9a3fff0c478818240cdb9.tar.gz
chromium_src-1f3b6804df95e260d5e9a3fff0c478818240cdb9.tar.bz2
Applying factory pattern (through NativeMetafileFactory class). It is used to retrieve different printing contexts (based on the platform and user preferences).
BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/6544028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76553 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/utility')
-rw-r--r--chrome/utility/utility_thread.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/chrome/utility/utility_thread.cc b/chrome/utility/utility_thread.cc
index 6d078e3..0556cbb 100644
--- a/chrome/utility/utility_thread.cc
+++ b/chrome/utility/utility_thread.cc
@@ -18,7 +18,6 @@
#include "chrome/common/serialized_script_value.h"
#include "chrome/common/utility_messages.h"
#include "chrome/common/web_resource/web_resource_unpacker.h"
-#include "printing/native_metafile.h"
#include "printing/page_range.h"
#include "printing/units.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -29,7 +28,10 @@
#if defined(OS_WIN)
#include "app/win/iat_patch_function.h"
+#include "base/scoped_ptr.h"
#include "base/win/scoped_handle.h"
+#include "printing/native_metafile_factory.h"
+#include "printing/native_metafile.h"
#endif
namespace {
@@ -135,10 +137,15 @@ void UtilityThread::OnRenderPDFPagesToMetafile(
const std::vector<printing::PageRange>& page_ranges) {
bool succeeded = false;
#if defined(OS_WIN)
- printing::NativeMetafile metafile;
+ scoped_ptr<printing::NativeMetafile> metafile(
+ printing::NativeMetafileFactory::CreateMetafile());
int highest_rendered_page_number = 0;
- succeeded = RenderPDFToWinMetafile(pdf_file, metafile_path, render_area,
- render_dpi, page_ranges, &metafile,
+ succeeded = RenderPDFToWinMetafile(pdf_file,
+ metafile_path,
+ render_area,
+ render_dpi,
+ page_ranges,
+ metafile.get(),
&highest_rendered_page_number);
if (succeeded) {
Send(new UtilityHostMsg_RenderPDFPagesToMetafile_Succeeded(