summaryrefslogtreecommitdiffstats
path: root/chrome/service
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-18 04:58:36 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-18 04:58:36 +0000
commitacc134844001b556ef162ad267dac826b3000ff0 (patch)
treea50d9986b827e6c4784d63e0930e28b8ca0f7374 /chrome/service
parent55f2c51627eb66c3a742d19d5ed735966d118827 (diff)
downloadchromium_src-acc134844001b556ef162ad267dac826b3000ff0.zip
chromium_src-acc134844001b556ef162ad267dac826b3000ff0.tar.gz
chromium_src-acc134844001b556ef162ad267dac826b3000ff0.tar.bz2
Cleanup NativeMetafile (win) interface and EMF class.
- Rename CreateDc to Init() and remove unused argument (all non-test calls were CreateDc(NULL, NULL). [This matches cross platform interface.] - Remove CreateFileBackedDc from the NativeMetafile interface and make InitToFile() in the EMF class. - Remove CreateFromFile from the NativeMetafile interface and make it InitFromFile() in the EMF class. - Move the CloseEmf method into the destructor, making the Emf class a use once class (matches actual use). BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/6695013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78666 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service')
-rw-r--r--chrome/service/cloud_print/print_system_win.cc6
-rw-r--r--chrome/service/service_utility_process_host.cc15
-rw-r--r--chrome/service/service_utility_process_host.h6
3 files changed, 13 insertions, 14 deletions
diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc
index 01caaa8..e963403 100644
--- a/chrome/service/cloud_print/print_system_win.cc
+++ b/chrome/service/cloud_print/print_system_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.
@@ -26,7 +26,7 @@
#include "printing/backend/print_backend.h"
#include "printing/backend/print_backend_consts.h"
#include "printing/backend/win_helper.h"
-#include "printing/native_metafile.h"
+#include "printing/emf_win.h"
#include "printing/page_range.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/rect.h"
@@ -448,7 +448,7 @@ class PrintSystemWin : public PrintSystem {
// ServiceUtilityProcessHost::Client implementation.
virtual void OnRenderPDFPagesToMetafileSucceeded(
- const printing::NativeMetafile& metafile,
+ const printing::Emf& metafile,
int highest_rendered_page_number) {
metafile.SafePlayback(printer_dc_.Get());
bool done_printing = (highest_rendered_page_number !=
diff --git a/chrome/service/service_utility_process_host.cc b/chrome/service/service_utility_process_host.cc
index a340d8d..fb5080c 100644
--- a/chrome/service/service_utility_process_host.cc
+++ b/chrome/service/service_utility_process_host.cc
@@ -20,8 +20,7 @@
#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"
+#include "printing/emf_win.h"
#endif
ServiceUtilityProcessHost::ServiceUtilityProcessHost(
@@ -204,15 +203,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)
- scoped_ptr<printing::NativeMetafile> metafile(
- printing::NativeMetafileFactory::CreateMetafile());
- if (!metafile->CreateFromFile(metafile_path)) {
+ // It's important that metafile is declared after scratch_metafile_dir so
+ // that the metafile destructor closes the file before the ScopedTempDir
+ // destructor tries to remove the directory.
+ printing::Emf metafile;
+ if (!metafile.InitFromFile(metafile_path)) {
OnRenderPDFPagesToMetafileFailed();
} else {
- OnRenderPDFPagesToMetafileSucceeded(*metafile,
+ OnRenderPDFPagesToMetafileSucceeded(metafile,
highest_rendered_page_number);
- // Close it so that ScopedTempDir can delete the folder.
- metafile->CloseEmf();
}
#endif // defined(OS_WIN)
}
diff --git a/chrome/service/service_utility_process_host.h b/chrome/service/service_utility_process_host.h
index b770e1a..ad7eb3e 100644
--- a/chrome/service/service_utility_process_host.h
+++ b/chrome/service/service_utility_process_host.h
@@ -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.
@@ -21,7 +21,6 @@
#include "base/task.h"
#include "ipc/ipc_channel.h"
#include "chrome/service/service_child_process_host.h"
-#include "printing/native_metafile.h"
class CommandLine;
class ScopedTempDir;
@@ -35,6 +34,7 @@ class Rect;
} // namespace gfx
namespace printing {
+class Emf;
struct PageRange;
struct PrinterCapsAndDefaults;
} // namespace printing
@@ -57,7 +57,7 @@ class ServiceUtilityProcessHost : public ServiceChildProcessHost {
// Called when at least one page in the specified PDF has been rendered
// successfully into |metafile|.
virtual void OnRenderPDFPagesToMetafileSucceeded(
- const printing::NativeMetafile& metafile,
+ const printing::Emf& metafile,
int highest_rendered_page_number) {}
// Called when no page in the passed in PDF could be rendered.
virtual void OnRenderPDFPagesToMetafileFailed() {}