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

Unified Diff: chrome/renderer/print_web_view_helper.cc

Issue 7015026: Cancel prerenders for pages that call window.print() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 7 months 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 | « chrome/common/render_messages.h ('k') | chrome/test/data/prerender/prerender_print.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/print_web_view_helper.cc
diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc
index f07ef87d18e5f1e4be2ed4746333b5b9a449c9ba..cc3da5190a98f2c1488ebdd1dcbcb25624765244 100644
--- a/chrome/renderer/print_web_view_helper.cc
+++ b/chrome/renderer/print_web_view_helper.cc
@@ -12,6 +12,8 @@
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/print_messages.h"
+#include "chrome/common/render_messages.h"
+#include "chrome/renderer/prerender/prerender_helper.h"
#include "content/renderer/render_view.h"
#include "grit/generated_resources.h"
#include "printing/metafile.h"
@@ -132,6 +134,12 @@ PrintWebViewHelper::~PrintWebViewHelper() {}
void PrintWebViewHelper::PrintPage(WebKit::WebFrame* frame) {
DCHECK(frame);
+ // Allow Prerendering to cancel this print request if necessary.
+ if (prerender::PrerenderHelper::IsPrerendering(render_view())) {
+ Send(new ViewHostMsg_CancelPrerenderForPrinting(routing_id()));
+ return;
+ }
+
if (IsScriptInitiatedPrintTooFrequent(frame))
return;
IncrementScriptedPrintCount();
« no previous file with comments | « chrome/common/render_messages.h ('k') | chrome/test/data/prerender/prerender_print.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698