summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-16 00:29:22 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-16 00:29:22 +0000
commitfbea02332ae95f590c8a84019b582fa35e788a7c (patch)
treeeeff857a083663f3d5556fcff304b5fd05e32eb2 /chrome/common
parent0018067c7afbdf516d1845b35a3a245d96910f66 (diff)
downloadchromium_src-fbea02332ae95f590c8a84019b582fa35e788a7c.zip
chromium_src-fbea02332ae95f590c8a84019b582fa35e788a7c.tar.gz
chromium_src-fbea02332ae95f590c8a84019b582fa35e788a7c.tar.bz2
Linux: print page to file rather than using shared memory to send it to the browser.
BUG=9847 adapted from patch by <minyu.huang [at] gmail> Review URL: http://codereview.chromium.org/203062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26308 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/render_messages_internal.h10
-rw-r--r--chrome/common/temp_scaffolding_stubs.cc48
-rw-r--r--chrome/common/temp_scaffolding_stubs.h4
3 files changed, 6 insertions, 56 deletions
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 806c0e5..2916c17 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -1396,11 +1396,13 @@ IPC_BEGIN_MESSAGES(ViewHost)
#endif
#if defined(OS_LINUX)
- // Asks the browser create a block of shared memory for the renderer to fill
+ // Asks the browser create a temporary file for the renderer to fill
// in resulting NativeMetafile in printing.
- IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_AllocateShareMemory,
- size_t /* buffer size */,
- base::SharedMemoryHandle /* browser handle */)
+ IPC_SYNC_MESSAGE_CONTROL0_2(ViewHostMsg_AllocateTempFileForPrinting,
+ base::FileDescriptor /* temp file fd */,
+ int /* fd in browser*/)
+ IPC_MESSAGE_CONTROL1(ViewHostMsg_TempFileForPrintingWritten,
+ int /* fd in browser */)
#endif
// Provide the browser process with information about the WebCore resource
diff --git a/chrome/common/temp_scaffolding_stubs.cc b/chrome/common/temp_scaffolding_stubs.cc
index 9b1ed6d..76d2d60 100644
--- a/chrome/common/temp_scaffolding_stubs.cc
+++ b/chrome/common/temp_scaffolding_stubs.cc
@@ -13,12 +13,8 @@
#include "chrome/browser/rlz/rlz.h"
#if defined(OS_LINUX)
-#include "base/path_service.h"
#include "chrome/browser/dock_info.h"
-#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/common/chrome_paths.h"
#include "chrome/common/render_messages.h"
-#include "printing/native_metafile.h"
#endif
#if defined(OS_MACOSX)
@@ -326,47 +322,3 @@ void BookmarkManager::Show(Profile* profile) {
#endif
-//------------------------------------------------------------------------------
-
-#if defined(OS_LINUX)
-// TODO(myhuang): This is a quick hack for testing purpose. We should implement
-// PrintViewManager and other related classes later on Linux.
-namespace printing {
-
-void PrintViewManager::DidPrintPage(
- const ViewHostMsg_DidPrintPage_Params& params) {
- base::SharedMemory shared_buf(params.metafile_data_handle, true);
- if (!shared_buf.Map(params.data_size)) {
- NOTREACHED() << "couldn't map";
- owner_.Stop();
- return;
- }
-
- // The only format we can use now is PDF since Cairo needs to create a
- // temporary file for a PostScript surface. We do not allow disk I/O in the
- // renderer.
- scoped_ptr<NativeMetafile> metafile(
- new NativeMetafile(printing::NativeMetafile::PDF));
-
- if (!metafile->Init(shared_buf.memory(), params.data_size)) {
- NOTREACHED() << "Invalid metafile header";
- shared_buf.Unmap();
- owner_.Stop();
- return;
- }
-
- // Save the PDF file to default download location.
- // NOTE: Existing file will be overwritten.
- FilePath default_save_path;
- if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &default_save_path)) {
- NOTREACHED();
- }
- FilePath save_filename =
- default_save_path.Append(FilePath("chromium_printing_test.pdf"));
- metafile->SaveTo(save_filename);
- shared_buf.Unmap();
-}
-
-} // namespace printing
-
-#endif
diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h
index 7b01f31..6f186ff 100644
--- a/chrome/common/temp_scaffolding_stubs.h
+++ b/chrome/common/temp_scaffolding_stubs.h
@@ -67,13 +67,9 @@ class PrintViewManager : public RenderViewHostDelegate::Printing {
NOTIMPLEMENTED();
}
-#if defined(OS_LINUX)
- virtual void DidPrintPage(const ViewHostMsg_DidPrintPage_Params& params);
-#else
virtual void DidPrintPage(const ViewHostMsg_DidPrintPage_Params& params) {
NOTIMPLEMENTED();
}
-#endif
private:
TabContents& owner_;