Chromium Code Reviews| 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 89cbc741a665b41c3b090159113a7e333711890f..a55be4f696873ee9c8001a688046f93d4bf06ce4 100644 |
| --- a/chrome/browser/printing/print_view_manager.h |
| +++ b/chrome/browser/printing/print_view_manager.h |
| @@ -11,6 +11,7 @@ |
| #include "printing/features/features.h" |
| namespace content { |
| +class RenderFrameHost; |
| class RenderProcessHost; |
| } |
| @@ -31,14 +32,14 @@ class PrintViewManager : public PrintViewManagerBase, |
| // Same as PrintNow(), but for the case where a user press "ctrl+shift+p" to |
| // show the native system dialog. This can happen from both initiator and |
| // preview dialog. |
| - bool BasicPrint(); |
| + bool BasicPrint(content::RenderFrameHost* rfh); |
| #endif // ENABLE_BASIC_PRINTING |
| // Initiate print preview of the current document by first notifying the |
| // renderer. Since this happens asynchronous, the print preview dialog |
| // creation will not be completed on the return of this function. Returns |
| // false if print preview is impossible at the moment. |
| - bool PrintPreviewNow(bool selection_only); |
| + bool PrintPreviewNow(content::RenderFrameHost* rfh, bool has_selection); |
| // Notify PrintViewManager that print preview is starting in the renderer for |
| // a particular WebNode. |
| @@ -49,15 +50,16 @@ class PrintViewManager : public PrintViewManagerBase, |
| void PrintPreviewDone(); |
| // content::WebContentsObserver implementation. |
| - bool OnMessageReceived(const IPC::Message& message) override; |
| - |
| - // content::WebContentsObserver implementation. |
| + bool OnMessageReceived(const IPC::Message& message, |
| + content::RenderFrameHost* render_frame_host) override; |
| void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; |
| // content::WebContentsObserver implementation. |
| // Terminates or cancels the print job if one was pending. |
| void RenderProcessGone(base::TerminationStatus status) override; |
| + content::RenderFrameHost* print_preview_rfh() { return print_preview_rfh_; } |
| + |
| private: |
| explicit PrintViewManager(content::WebContents* web_contents); |
| friend class content::WebContentsUserData<PrintViewManager>; |
| @@ -69,9 +71,10 @@ class PrintViewManager : public PrintViewManagerBase, |
| }; |
| // IPC Message handlers. |
| - void OnDidShowPrintDialog(); |
| + void OnDidShowPrintDialog(content::RenderFrameHost* rfh); |
| void OnSetupScriptedPrintPreview(IPC::Message* reply_msg); |
| - void OnShowScriptedPrintPreview(bool source_is_modifiable); |
| + void OnShowScriptedPrintPreview(content::RenderFrameHost* rfh, |
| + bool source_is_modifiable); |
| void OnScriptedPrintPreviewReply(IPC::Message* reply_msg); |
| base::Closure on_print_dialog_shown_callback_; |
| @@ -79,6 +82,15 @@ class PrintViewManager : public PrintViewManagerBase, |
| // Current state of print preview for this view. |
| PrintPreviewState print_preview_state_; |
| + // The current RFH that is print previewing. It should be a nullptr when |
| + // |print_preview_state_| is NOT_PREVIEWING. |
| + content::RenderFrameHost* print_preview_rfh_; |
| + |
| + // Temporarily holds the RFH pointer that should be passed to |
| + // OnSetupScriptedPrintPreview(), but is not because |
| + // IPC_MESSAGE_HANDLER_DELAY_REPLY is wonky. |
| + content::RenderFrameHost* scripted_print_rfh_; |
|
nasko
2016/11/14 20:28:52
Awesome! Thanks for removing this!
|
| + |
| // Keeps track of the pending callback during scripted print preview. |
| content::RenderProcessHost* scripted_print_preview_rph_; |