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

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

Issue 2517493002: Make printing PDF work from inside PDF extension. (Closed)
Patch Set: Rebased 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/print_view_manager.cc
diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc
index 6afd07b443725b2bb3b55f195554bbb458a5b643..dadead97afbf3135274ded98b3fe7e5d853f4202 100644
--- a/chrome/browser/printing/print_view_manager.cc
+++ b/chrome/browser/printing/print_view_manager.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/printing/print_preview_dialog_controller.h"
#include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
#include "chrome/common/chrome_content_client.h"
+#include "components/guest_view/browser/guest_view_base.h"
#include "components/printing/common/print_messages.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/plugin_service.h"
@@ -21,6 +22,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/webplugininfo.h"
+#include "extensions/common/constants.h"
#include "printing/features/features.h"
using content::BrowserThread;
@@ -127,6 +129,14 @@ void PrintViewManager::PrintPreviewForWebNode() {
if (print_preview_state_ != NOT_PREVIEWING)
return;
print_preview_state_ = USER_INITIATED_PREVIEW;
+ // If this is a PDF extension loaded inside a MimeHandlerViewGuest then we are
+ // here due to clicking on print button inside the PDF extension. We should
+ // use the main frame of the WebContents for print preview.
+ if (guest_view::GuestViewBase::FromWebContents(web_contents()) &&
+ web_contents()->GetLastCommittedURL().host() ==
+ extension_misc::kPdfExtensionId) {
+ print_preview_rfh_ = web_contents()->GetMainFrame();
+ }
}
void PrintViewManager::PrintPreviewDone() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698