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

Unified Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.cc

Issue 2508923003: Make printing work better with OOPIF. (try 2) (Closed)
Patch Set: Fix android_webview Created 4 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/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 a390b988cbfc56fe549c3aa7c1f22da423d38cc2..e0df69ebb5aad37eb672c14d5f9b1457814cd97c 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"
@@ -100,7 +100,7 @@
#endif
using content::BrowserThread;
-using content::RenderViewHost;
+using content::RenderFrameHost;
using content::WebContents;
using printing::PrintViewManager;
@@ -700,7 +700,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;
@@ -758,8 +762,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) {
@@ -925,9 +928,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

Powered by Google App Engine
This is Rietveld 408576698