Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Unified Diff: chrome/browser/printing/print_view_manager.cc

Issue 6516022: Linux: Refactor printing to be more like Windows/Mac.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac build Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/printing/print_view_manager.cc
===================================================================
--- chrome/browser/printing/print_view_manager.cc (revision 75320)
+++ chrome/browser/printing/print_view_manager.cc (working copy)
@@ -114,21 +114,29 @@
}
#endif
+ const bool metafile_must_be_valid =
+#if defined(OS_WIN) || defined(OS_MACOSX)
+ true;
+#elif defined(OS_POSIX)
+ (params.page_number == 0);
+#endif
+
base::SharedMemory shared_buf(params.metafile_data_handle, true);
- if (!shared_buf.Map(params.data_size)) {
- NOTREACHED() << "couldn't map";
- tab_contents()->Stop();
- return;
+ if (metafile_must_be_valid) {
+ if (!shared_buf.Map(params.data_size)) {
+ NOTREACHED() << "couldn't map";
+ tab_contents()->Stop();
+ return;
+ }
}
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
- NOTIMPLEMENTED() << " this printing code doesn't quite work yet.";
-#else
scoped_ptr<NativeMetafile> metafile(new NativeMetafile());
- if (!metafile->Init(shared_buf.memory(), params.data_size)) {
- NOTREACHED() << "Invalid metafile header";
- tab_contents()->Stop();
- return;
+ if (metafile_must_be_valid) {
+ if (!metafile->Init(shared_buf.memory(), params.data_size)) {
+ NOTREACHED() << "Invalid metafile header";
+ tab_contents()->Stop();
+ return;
+ }
}
// Update the rendered document. It will send notifications to the listener.
@@ -138,7 +146,7 @@
params.page_size,
params.content_area,
params.has_visible_overlays);
-#endif
+
ShouldQuitFromInnerMessageLoop();
}

Powered by Google App Engine
This is Rietveld 408576698