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

Unified Diff: content/browser/renderer_host/printing_message_filter.h

Issue 6546051: Created a new BrowserMessageFilter to handle print related IPC messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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: content/browser/renderer_host/printing_message_filter.h
diff --git a/content/browser/renderer_host/printing_message_filter.h b/content/browser/renderer_host/printing_message_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..a01a2c0369a8d70bc573e723e203a6583b357d10
--- /dev/null
+++ b/content/browser/renderer_host/printing_message_filter.h
@@ -0,0 +1,80 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
jam 2011/02/22 20:29:41 all these files should be in chrome\browser\printi
kmadhusu 2011/02/23 02:27:49 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_PRINTING_MESSAGE_FILTER_H_
+#define CONTENT_BROWSER_RENDERER_HOST_PRINTING_MESSAGE_FILTER_H_
+#pragma once
+
+#include "base/shared_memory.h"
+#include "chrome/browser/browser_message_filter.h"
+
+namespace printing {
+class PrinterQuery;
+class PrintJobManager;
+}
+
+struct ViewHostMsg_ScriptedPrint_Params;
Lei Zhang 2011/02/22 19:37:42 nit: this forward decl. should be above the forwar
kmadhusu 2011/02/23 02:27:49 Done.
+
+// This class filters out incoming printing related IPC messages for the
+// renderer process on the IPC thread.
+class PrintingMessageFilter : public BrowserMessageFilter {
+ public:
+ PrintingMessageFilter();
+
+ // BrowserMessageFilter methods.
+ virtual bool OnMessageReceived(const IPC::Message& message,
+ bool* message_was_ok);
+
+ private:
+ virtual ~PrintingMessageFilter();
+
+#if defined(OS_POSIX)
+ // Used to ask the browser to allocate a block of shared memory for the
+ // renderer to send back data in, since shared memory can't be created
+ // in the renderer on POSIX due to the sandbox.
+ void OnAllocateSharedMemoryBuffer(uint32 buffer_size,
+ base::SharedMemoryHandle* handle);
+#endif
+
+#if defined(OS_WIN)
+ // Used to pass resulting EMF from renderer to browser in printing.
+ void OnDuplicateSection(base::SharedMemoryHandle renderer_handle,
+ base::SharedMemoryHandle* browser_handle);
+#endif
+
+#if defined(OS_CHROMEOS)
+ // Used to ask the browser allocate a temporary file for the renderer
+ // to fill in resulting PDF in renderer.
+ void OnAllocateTempFileForPrinting(IPC::Message* reply_msg);
+ void OnTempFileForPrintingWritten(int sequence_number);
+ void DoOnAllocateTempFileForPrinting(IPC::Message* reply_msg);
kmadhusu 2011/02/21 21:30:04 Previously, the following functions are declared u
Lei Zhang 2011/02/22 19:37:42 SGTM
+ void DoOnTempFileForPrintingWritten(int sequence_number);
+#endif
+
+ // A javascript code requested to print the current page. This is done in two
+ // steps and this is the first step. Get the print setting right here
+ // synchronously. It will hang the I/O completely.
+ void OnGetDefaultPrintSettings(IPC::Message* reply_msg);
+ void OnGetDefaultPrintSettingsReply(
+ scoped_refptr<printing::PrinterQuery> printer_query,
+ IPC::Message* reply_msg);
+
+ // A javascript code requested to print the current page. The renderer host
+ // have to show to the user the print dialog and returns the selected print
+ // settings.
+ void OnScriptedPrint(const ViewHostMsg_ScriptedPrint_Params& params,
+ IPC::Message* reply_msg);
+ void OnScriptedPrintReply(
+ scoped_refptr<printing::PrinterQuery> printer_query,
+ int routing_id,
+ IPC::Message* reply_msg);
+
+ printing::PrintJobManager* print_job_manager_;
+
+ bool cloud_print_enabled_;
+
+ DISALLOW_COPY_AND_ASSIGN(PrintingMessageFilter);
+};
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_PRINTING_MESSAGE_FILTER_H_

Powered by Google App Engine
This is Rietveld 408576698