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

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

Issue 8515017: Print Preview: Properly handle window.print(). (Closed)
Patch Set: fail instead of crash when 2 views both do window.print() 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 4925a4512e4c56937941ac4abb6b6ff04f6a1c84..195c3bab0cf96ed7885bb5347c8e72cfb81a0424 100644
--- a/chrome/browser/printing/print_view_manager.h
+++ b/chrome/browser/printing/print_view_manager.h
@@ -16,6 +16,10 @@
class TabContentsWrapper;
struct PrintHostMsg_DidPrintPage_Params;
+namespace content {
+class RenderProcessHost;
+}
+
namespace printing {
class JobEventDetails;
@@ -52,6 +56,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();
@@ -78,6 +86,12 @@ class PrintViewManager : public content::NotificationObserver,
virtual void StopNavigation() OVERRIDE;
private:
+ enum PrintPreviewState {
+ NOT_PREVIEWING,
+ USER_INITIATED_PREVIEW,
+ SCRIPTED_PREVIEW,
+ };
+
// IPC Message handlers.
void OnDidGetPrintedPagesCount(int cookie, int number_pages);
void OnDidGetDocumentCookie(int cookie);
@@ -85,6 +99,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);
@@ -167,6 +184,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.
+ content::RenderProcessHost* scripted_print_preview_rph_;
+
DISALLOW_COPY_AND_ASSIGN(PrintViewManager);
};
« no previous file with comments | « chrome/browser/printing/print_preview_tab_controller_unittest.cc ('k') | chrome/browser/printing/print_view_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698