diff options
author | dpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 16:46:20 +0000 |
---|---|---|
committer | dpapad@chromium.org <dpapad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-02 16:46:20 +0000 |
commit | 1f3b6804df95e260d5e9a3fff0c478818240cdb9 (patch) | |
tree | 208ac1115304f544e62e1483ec12a7e17d7ff078 /chrome/service | |
parent | 21f1168bab8f4ac626011148ae6e65d8fd24272a (diff) | |
download | chromium_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/service')
-rw-r--r-- | chrome/service/service_utility_process_host.cc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/chrome/service/service_utility_process_host.cc b/chrome/service/service_utility_process_host.cc index b63e27f..a340d8d 100644 --- a/chrome/service/service_utility_process_host.cc +++ b/chrome/service/service_utility_process_host.cc @@ -13,13 +13,15 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/utility_messages.h" #include "ipc/ipc_switches.h" -#include "printing/native_metafile.h" #include "printing/page_range.h" #include "ui/base/ui_base_switches.h" #include "ui/gfx/rect.h" #if defined(OS_WIN) +#include "base/scoped_ptr.h" #include "base/win/scoped_handle.h" +#include "printing/native_metafile_factory.h" +#include "printing/native_metafile.h" #endif ServiceUtilityProcessHost::ServiceUtilityProcessHost( @@ -202,13 +204,15 @@ void ServiceUtilityProcessHost::Client::MetafileAvailable( if (!scratch_metafile_dir.Set(metafile_path.DirName())) LOG(WARNING) << "Unable to set scratch metafile directory"; #if defined(OS_WIN) - printing::NativeMetafile metafile; - if (!metafile.CreateFromFile(metafile_path)) { + scoped_ptr<printing::NativeMetafile> metafile( + printing::NativeMetafileFactory::CreateMetafile()); + if (!metafile->CreateFromFile(metafile_path)) { OnRenderPDFPagesToMetafileFailed(); } else { - OnRenderPDFPagesToMetafileSucceeded(metafile, highest_rendered_page_number); + OnRenderPDFPagesToMetafileSucceeded(*metafile, + highest_rendered_page_number); // Close it so that ScopedTempDir can delete the folder. - metafile.CloseEmf(); + metafile->CloseEmf(); } #endif // defined(OS_WIN) } |