summaryrefslogtreecommitdiffstats
path: root/chrome/browser/printing
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 21:54:06 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-11 21:54:06 +0000
commit7d748990b39550c77aa914ba6846885dd7352e10 (patch)
tree3777582ee9816b3488f218b594db1918e5ebe752 /chrome/browser/printing
parent03e204f307255e8f39aeb002f94b8eb04137e7f9 (diff)
downloadchromium_src-7d748990b39550c77aa914ba6846885dd7352e10.zip
chromium_src-7d748990b39550c77aa914ba6846885dd7352e10.tar.gz
chromium_src-7d748990b39550c77aa914ba6846885dd7352e10.tar.bz2
Connect the right metafiles for print preview on Linux and Windows.
+ Remove the NativeMetafileFactory since we can't just use preview flag. + Update each Metafile constructor site to use PreviewMetafile or NativeMetafileImpl. + Fix misc. problems blocking pdf generation on Windows. + Rename the metafile interface. BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/6826027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81161 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/printing')
-rw-r--r--chrome/browser/printing/print_dialog_gtk.cc5
-rw-r--r--chrome/browser/printing/print_dialog_gtk.h10
-rw-r--r--chrome/browser/printing/print_view_manager.cc10
3 files changed, 13 insertions, 12 deletions
diff --git a/chrome/browser/printing/print_dialog_gtk.cc b/chrome/browser/printing/print_dialog_gtk.cc
index 24d87fb..4f549db 100644
--- a/chrome/browser/printing/print_dialog_gtk.cc
+++ b/chrome/browser/printing/print_dialog_gtk.cc
@@ -17,6 +17,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
+#include "printing/metafile.h"
#include "printing/print_settings_initializer_gtk.h"
// static
@@ -85,7 +86,7 @@ void PrintDialogGtk::ShowDialog(
gtk_widget_show(dialog_);
}
-void PrintDialogGtk::PrintDocument(const NativeMetafile* metafile,
+void PrintDialogGtk::PrintDocument(const printing::Metafile* metafile,
const string16& document_name) {
// This runs on the print worker thread, does not block the UI thread.
DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -164,7 +165,7 @@ void PrintDialogGtk::OnResponse(GtkWidget* dialog, int response_id) {
}
}
-void PrintDialogGtk::SaveDocumentToDisk(const NativeMetafile* metafile,
+void PrintDialogGtk::SaveDocumentToDisk(const printing::Metafile* metafile,
const string16& document_name) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
diff --git a/chrome/browser/printing/print_dialog_gtk.h b/chrome/browser/printing/print_dialog_gtk.h
index 79266b3..c6d999f 100644
--- a/chrome/browser/printing/print_dialog_gtk.h
+++ b/chrome/browser/printing/print_dialog_gtk.h
@@ -13,7 +13,6 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "content/browser/browser_thread.h"
-#include "printing/native_metafile.h"
#include "printing/print_dialog_gtk_interface.h"
#include "printing/printing_context_cairo.h"
#include "ui/base/gtk/gtk_signal.h"
@@ -22,7 +21,10 @@ namespace base {
class WaitableEvent;
}
-using printing::NativeMetafile;
+namespace printing {
+class Metafile;
+}
+
using printing::PrintingContextCairo;
// Needs to be freed on the UI thread to clean up its GTK members variables.
@@ -38,7 +40,7 @@ class PrintDialogGtk
// printing::PrintDialogGtkInterface implementation.
virtual void ShowDialog(
PrintingContextCairo::PrintSettingsCallback* callback);
- virtual void PrintDocument(const NativeMetafile* metafile,
+ virtual void PrintDocument(const printing::Metafile* metafile,
const string16& document_name);
virtual void AddRefToDialog();
virtual void ReleaseDialog();
@@ -54,7 +56,7 @@ class PrintDialogGtk
CHROMEGTK_CALLBACK_1(PrintDialogGtk, void, OnResponse, int);
// Saves data in |metafile| to disk for document named |document_name|.
- void SaveDocumentToDisk(const NativeMetafile* metafile,
+ void SaveDocumentToDisk(const printing::Metafile* metafile,
const string16& document_name);
// Prints document named |document_name|.
diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc
index 4d8cdda..fdae7ed 100644
--- a/chrome/browser/printing/print_view_manager.cc
+++ b/chrome/browser/printing/print_view_manager.cc
@@ -19,8 +19,8 @@
#include "content/common/notification_details.h"
#include "content/common/notification_source.h"
#include "grit/generated_resources.h"
-#include "printing/native_metafile.h"
-#include "printing/native_metafile_factory.h"
+#include "printing/metafile.h"
+#include "printing/metafile_impl.h"
#include "printing/printed_document.h"
#include "ui/base/l10n/l10n_util.h"
@@ -146,11 +146,9 @@ void PrintViewManager::OnDidPrintPage(
}
}
- scoped_ptr<NativeMetafile> metafile;
+ scoped_ptr<Metafile> metafile(new NativeMetafile);
if (metafile_must_be_valid) {
- metafile.reset(NativeMetafileFactory::CreateFromData(shared_buf.memory(),
- params.data_size));
- if (!metafile.get()) {
+ if (!metafile->InitFromData(shared_buf.memory(), params.data_size)) {
NOTREACHED() << "Invalid metafile header";
tab_contents()->Stop();
return;