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

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

Issue 2426503002: Make printing work better with OOPIF. (Closed)
Patch Set: Fix build, nits Created 4 years, 2 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_base.h
diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h
index f47debfa08634eb7b2da32505681c1bca726858f..fef05d17be9d0b4730a15c640b67f2705e176747 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"
@@ -17,6 +19,10 @@
struct PrintHostMsg_DidPrintPage_Params;
+namespace content {
+class RenderFrameHost;
+}
+
namespace printing {
class JobEventDetails;
@@ -36,26 +42,28 @@ 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;
+ // Not needed? Combined with print_preview_rfh_?
+ content::RenderFrameHost* printing_rfh() { return printing_rfh_; }
+
protected:
explicit PrintViewManagerBase(content::WebContents* web_contents);
// Helper method for Print*Now().
- bool PrintNowInternal(IPC::Message* message);
-
- // Terminates or cancels the print job if one was pending.
- void RenderProcessGone(base::TerminationStatus status) override;
+ bool PrintNowInternal(std::unique_ptr<IPC::Message> message);
// content::WebContentsObserver implementation.
- bool OnMessageReceived(const IPC::Message& message) override;
+ void RenderFrameDeleted(content::RenderFrameHost* rfh) override;
+ bool OnMessageReceived(const IPC::Message& message,
+ content::RenderFrameHost* rfh) override;
private:
// content::NotificationObserver implementation.
@@ -100,9 +108,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().
@@ -126,8 +131,13 @@ class PrintViewManagerBase : public content::NotificationObserver,
// Release the PrinterQuery associated with our |cookie_|.
void ReleasePrinterQuery();
+ // Helper method for UpdatePrintingEnabled().
+ void BroadcastPrintingEnabled(bool enabled, content::RenderFrameHost* rfh);
+
content::NotificationRegistrar registrar_;
+ content::RenderFrameHost* printing_rfh_;
+
// Manages the low-level talk to the printer.
scoped_refptr<PrintJob> print_job_;

Powered by Google App Engine
This is Rietveld 408576698