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

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

Issue 8515017: Print Preview: Properly handle window.print(). (Closed)
Patch Set: Created 9 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
Index: chrome/browser/printing/print_view_manager.h
diff --git a/chrome/browser/printing/print_view_manager.h b/chrome/browser/printing/print_view_manager.h
index 58fcefbc900a70aff0b5347d7a67eb7b6456a77e..7dd12205bd4af56b6c2ac95d32a3958d45e6bb0c 100644
--- a/chrome/browser/printing/print_view_manager.h
+++ b/chrome/browser/printing/print_view_manager.h
@@ -13,7 +13,7 @@
#include "content/public/browser/notification_registrar.h"
#include "printing/printed_pages_source.h"
-class RenderViewHost;
+class RenderProcessHost;
class TabContentsWrapper;
struct PrintHostMsg_DidPrintPage_Params;
@@ -53,6 +53,10 @@ class PrintViewManager : public content::NotificationObserver,
// print preview is impossible at the moment.
bool PrintPreviewNow();
+ // Notify PrintViewManager that print preview has finished. Unfreeze the
+ // renderer in the case of scripted print preview.
+ void PrintPreviewDone();
+
// Handles cancelled preview printing request.
void PreviewPrintingRequestCancelled();
@@ -79,6 +83,12 @@ class PrintViewManager : public content::NotificationObserver,
virtual void StopNavigation();
private:
+ enum PrintPreviewState {
+ NOT_PREVIEWING,
+ USER_INITIATED_PREVIEW,
+ SCRIPTED_PREVIEW,
+ };
+
// IPC Message handlers.
void OnDidGetPrintedPagesCount(int cookie, int number_pages);
void OnDidGetDocumentCookie(int cookie);
@@ -86,6 +96,9 @@ class PrintViewManager : public content::NotificationObserver,
void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params);
void OnPrintingFailed(int cookie);
+ void OnScriptedPrintPreview(IPC::Message* reply_msg);
+ void OnScriptedPrintPreviewReply(IPC::Message* reply_msg);
+
// Processes a NOTIFY_PRINT_JOB_EVENT notification.
void OnNotifyPrintJobEvent(const JobEventDetails& event_details);
@@ -168,6 +181,12 @@ class PrintViewManager : public content::NotificationObserver,
// The document cookie of the current PrinterQuery.
int cookie_;
+ // Current state of print preview for this view.
+ PrintPreviewState print_preview_state_;
+
+ // Keeps track of the pending callback during scripted print preview.
+ RenderProcessHost* scripted_print_preview_rph_;
+
DISALLOW_COPY_AND_ASSIGN(PrintViewManager);
};

Powered by Google App Engine
This is Rietveld 408576698