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

Unified Diff: chrome/renderer/print_web_view_helper.cc

Issue 9705084: Block printing from blocked popup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix init order Created 8 years, 9 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/renderer/print_web_view_helper.h ('k') | chrome/renderer/print_web_view_helper_browsertest.cc » ('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 5352be313bf617cb8c791af05d0d9de614a5b17c..505a4d0b1445d858d6c6c3d4104294c7df0f3a42 100644
--- a/chrome/renderer/print_web_view_helper.cc
+++ b/chrome/renderer/print_web_view_helper.cc
@@ -661,6 +661,18 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view)
PrintWebViewHelper::~PrintWebViewHelper() {}
+bool PrintWebViewHelper::IsScriptInitiatedPrintAllowed(
+ WebKit::WebFrame* frame) {
+ if (IsScriptInitiatedPrintTooFrequent(frame))
+ return false;
+ bool allowed = false;
+ IPC::SyncMessage* msg =
+ new PrintHostMsg_CheckScriptedPrintAllowed(routing_id(), &allowed);
+ msg->EnableMessagePumping();
+ Send(msg);
+ return allowed;
+}
+
// Prints |frame| which called window.print().
void PrintWebViewHelper::PrintPage(WebKit::WebFrame* frame) {
DCHECK(frame);
@@ -671,7 +683,7 @@ void PrintWebViewHelper::PrintPage(WebKit::WebFrame* frame) {
return;
}
- if (IsScriptInitiatedPrintTooFrequent(frame))
+ if (!IsScriptInitiatedPrintAllowed(frame))
return;
IncrementScriptedPrintCount();
« no previous file with comments | « chrome/renderer/print_web_view_helper.h ('k') | chrome/renderer/print_web_view_helper_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698