Setup PrintingMessageFilter for printing.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 21 Aug 2014 13:19:43 +0000 (21:19 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 21 Aug 2014 13:19:43 +0000 (21:19 +0800)
atom/browser/atom_browser_client.cc
atom/browser/atom_browser_client.h
chromium_src/chrome/browser/printing/printing_message_filter.cc
chromium_src/chrome/browser/printing/printing_message_filter.h

index dca8019..8b06e6d 100644 (file)
@@ -10,6 +10,7 @@
 #include "atom/browser/atom_resource_dispatcher_host_delegate.h"
 #include "atom/browser/native_window.h"
 #include "atom/browser/window_list.h"
+#include "chrome/browser/printing/printing_message_filter.h"
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/render_view_host.h"
 #include "content/public/browser/resource_dispatcher_host.h"
@@ -48,6 +49,11 @@ AtomBrowserClient::AtomBrowserClient()
 AtomBrowserClient::~AtomBrowserClient() {
 }
 
+void AtomBrowserClient::RenderProcessWillLaunch(
+    content::RenderProcessHost* host) {
+  host->AddFilter(new PrintingMessageFilter(host->GetID()));
+}
+
 void AtomBrowserClient::ResourceDispatcherHostCreated() {
   resource_dispatcher_delegate_.reset(new AtomResourceDispatcherHostDelegate);
   content::ResourceDispatcherHost::Get()->SetDelegate(
index 9c2b2a9..9958e2f 100644 (file)
@@ -20,6 +20,8 @@ class AtomBrowserClient : public brightray::BrowserClient {
 
  protected:
   // content::ContentBrowserClient:
+  virtual void RenderProcessWillLaunch(
+      content::RenderProcessHost* host) OVERRIDE;
   virtual void ResourceDispatcherHostCreated() OVERRIDE;
   virtual content::AccessTokenStore* CreateAccessTokenStore() OVERRIDE;
   virtual void OverrideWebkitPrefs(content::RenderViewHost* render_view_host,
index 68845d1..6dab425 100644 (file)
@@ -87,11 +87,8 @@ void RenderParamsFromPrintSettings(const printing::PrintSettings& settings,
 
 }  // namespace
 
-PrintingMessageFilter::PrintingMessageFilter(int render_process_id,
-                                             Profile* profile)
+PrintingMessageFilter::PrintingMessageFilter(int render_process_id)
     : BrowserMessageFilter(PrintMsgStart),
-      // profile_io_data_(ProfileIOData::FromResourceContext(
-      //     profile->GetResourceContext())),
       render_process_id_(render_process_id),
       queue_(g_browser_process->print_job_manager()->queue()) {
   DCHECK(queue_);
index 9c380dc..80684b5 100644 (file)
@@ -15,8 +15,6 @@
 #endif
 
 struct PrintHostMsg_ScriptedPrint_Params;
-class Profile;
-class ProfileIOData;
 
 namespace base {
 class DictionaryValue;
@@ -37,7 +35,7 @@ class PrintQueriesQueue;
 // renderer process on the IPC thread.
 class PrintingMessageFilter : public content::BrowserMessageFilter {
  public:
-  PrintingMessageFilter(int render_process_id, Profile* profile);
+  explicit PrintingMessageFilter(int render_process_id);
 
   // content::BrowserMessageFilter methods.
   virtual void OverrideThreadForMessage(