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

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: Cleaner implementation 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..467fd6b0e5e4373d51d8a786e238083edb2bb586 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"
@@ -269,6 +271,13 @@ void PrintWebViewHelper::Print(WebKit::WebFrame* frame, WebKit::WebNode* node) {
if (print_web_view_)
return;
+ // Allow Prerendering to cancel this if necessary.
Lei Zhang 2011/05/14 04:11:56 I would put this at the top of PrintWebViewHelper:
dominich 2011/05/16 16:28:00 Done.
+ if (prerender::PrerenderHelper::IsPrerendering(render_view())) {
+ Send(new ViewHostMsg_CancelPrerenderForPrinting(
+ render_view()->routing_id()));
+ return;
+ }
+
// Initialize print settings.
if (!InitPrintSettings(frame, node))
return; // Failed to init print page settings.
« 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