Index: chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
index bc5bd03fe62ce0aaa8f28ec1d7cc3027ea6ac25e..40d510c6c19eb31acb71e54d3089810de0e2cb7c 100644 |
--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
+++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc |
@@ -72,8 +72,8 @@ |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/navigation_controller.h" |
#include "content/public/browser/navigation_entry.h" |
+#include "content/public/browser/render_frame_host.h" |
#include "content/public/browser/render_process_host.h" |
-#include "content/public/browser/render_view_host.h" |
#include "content/public/browser/web_contents.h" |
#include "content/public/browser/web_ui.h" |
#include "google_apis/gaia/oauth2_token_service.h" |
@@ -101,7 +101,7 @@ |
#endif |
using content::BrowserThread; |
-using content::RenderViewHost; |
+using content::RenderFrameHost; |
using content::WebContents; |
using printing::PrintViewManager; |
@@ -701,7 +701,11 @@ void PrintPreviewHandler::HandleGetPreview(const base::ListValue* args) { |
++regenerate_preview_request_count_; |
WebContents* initiator = GetInitiator(); |
- if (!initiator) { |
+ content::RenderFrameHost* rfh = |
+ initiator |
+ ? PrintViewManager::FromWebContents(initiator)->print_preview_rfh() |
+ : nullptr; |
+ if (!rfh) { |
ReportUserActionHistogram(INITIATOR_CLOSED); |
print_preview_ui()->OnClosePrintPreviewDialog(); |
return; |
@@ -759,8 +763,7 @@ void PrintPreviewHandler::HandleGetPreview(const base::ListValue* args) { |
NOTREACHED(); |
} |
- RenderViewHost* rvh = initiator->GetRenderViewHost(); |
- rvh->Send(new PrintMsg_PrintPreview(rvh->GetRoutingID(), *settings)); |
+ rfh->Send(new PrintMsg_PrintPreview(rfh->GetRoutingID(), *settings)); |
} |
void PrintPreviewHandler::HandlePrint(const base::ListValue* args) { |
@@ -926,9 +929,9 @@ void PrintPreviewHandler::HandlePrint(const base::ListValue* args) { |
// Set ID to know whether printing is for preview. |
settings->SetInteger(printing::kPreviewUIID, |
print_preview_ui()->GetIDForPrintPreviewUI()); |
- RenderViewHost* rvh = preview_web_contents()->GetRenderViewHost(); |
- rvh->Send(new PrintMsg_PrintForPrintPreview(rvh->GetRoutingID(), |
- *settings)); |
+ RenderFrameHost* rfh = preview_web_contents()->GetMainFrame(); |
+ rfh->Send( |
+ new PrintMsg_PrintForPrintPreview(rfh->GetRoutingID(), *settings)); |
// For all other cases above, the preview dialog will stay open until the |
// printing has finished. Then the dialog closes and PrintPreviewDone() gets |