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

Unified Diff: chrome/browser/printing/print_view_manager_base.h

Issue 2508923003: Make printing work better with OOPIF. (try 2) (Closed)
Patch Set: Fix android_webview Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/printing/print_view_manager.cc ('k') | chrome/browser/printing/print_view_manager_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/print_view_manager_base.h
diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h
index 21cdb284998055d2d602a5b1bdac7c11aa5ee7af..6dac9ddfa3dcfed153e37e0618b625c73cd9f9c4 100644
--- a/chrome/browser/printing/print_view_manager_base.h
+++ b/chrome/browser/printing/print_view_manager_base.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_
#define CHROME_BROWSER_PRINTING_PRINT_VIEW_MANAGER_BASE_H_
+#include <memory>
+
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string16.h"
@@ -18,6 +20,10 @@
struct PrintHostMsg_DidPrintPage_Params;
+namespace content {
+class RenderFrameHost;
+}
+
namespace printing {
class JobEventDetails;
@@ -37,11 +43,11 @@ class PrintViewManagerBase : public content::NotificationObserver,
// Prints the current document immediately. Since the rendering is
// asynchronous, the actual printing will not be completed on the return of
// this function. Returns false if printing is impossible at the moment.
- virtual bool PrintNow();
+ virtual bool PrintNow(content::RenderFrameHost* rfh);
#endif // ENABLE_BASIC_PRINTING
- // Whether to block scripted printing for our tab or not.
- void UpdateScriptedPrintingBlocked();
+ // Whether printing is enabled or not.
+ void UpdatePrintingEnabled();
// PrintedPagesSource implementation.
base::string16 RenderSourceName() override;
@@ -50,13 +56,15 @@ class PrintViewManagerBase : public content::NotificationObserver,
explicit PrintViewManagerBase(content::WebContents* web_contents);
// Helper method for Print*Now().
- bool PrintNowInternal(IPC::Message* message);
+ bool PrintNowInternal(content::RenderFrameHost* rfh,
+ std::unique_ptr<IPC::Message> message);
- // Terminates or cancels the print job if one was pending.
- void RenderProcessGone(base::TerminationStatus status) override;
+ void SetPrintingRFH(content::RenderFrameHost* rfh);
// content::WebContentsObserver implementation.
- bool OnMessageReceived(const IPC::Message& message) override;
+ void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
+ bool OnMessageReceived(const IPC::Message& message,
+ content::RenderFrameHost* render_frame_host) override;
private:
// content::NotificationObserver implementation.
@@ -101,9 +109,6 @@ class PrintViewManagerBase : public content::NotificationObserver,
// disconnect from it.
void DisconnectFromCurrentPrintJob();
- // Notify that the printing is done.
- void PrintingDone(bool success);
-
// Terminates the print job. No-op if no print job has been created. If
// |cancel| is true, cancel it instead of waiting for the job to finish. Will
// call ReleasePrintJob().
@@ -127,8 +132,14 @@ class PrintViewManagerBase : public content::NotificationObserver,
// Release the PrinterQuery associated with our |cookie_|.
void ReleasePrinterQuery();
+ // Helper method for UpdatePrintingEnabled().
+ void SendPrintingEnabled(bool enabled, content::RenderFrameHost* rfh);
+
content::NotificationRegistrar registrar_;
+ // The current RFH that is printing with a system printing dialog.
+ content::RenderFrameHost* printing_rfh_;
+
// Manages the low-level talk to the printer.
scoped_refptr<PrintJob> print_job_;
« no previous file with comments | « chrome/browser/printing/print_view_manager.cc ('k') | chrome/browser/printing/print_view_manager_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698