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

Unified Diff: chrome/renderer/printing/print_web_view_helper.h

Issue 550033002: Fixed print_web_view_helper for CEF. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tue Sep 9 16:51:46 PDT 2014 Created 6 years, 3 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/chrome_tests.gypi ('k') | chrome/renderer/printing/print_web_view_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/printing/print_web_view_helper.h
diff --git a/chrome/renderer/printing/print_web_view_helper.h b/chrome/renderer/printing/print_web_view_helper.h
index 4ce36b87be3db316141dd015ac3fb4bedd2cc58a..e7cd7daba2740708c636f9497b5242c383cc94c5 100644
--- a/chrome/renderer/printing/print_web_view_helper.h
+++ b/chrome/renderer/printing/print_web_view_helper.h
@@ -69,6 +69,10 @@ class PrintWebViewHelper
explicit PrintWebViewHelper(content::RenderView* render_view);
virtual ~PrintWebViewHelper();
+ // Disable print preview and switch to system dialog printing even if full
+ // printing is build-in. This method is used by CEF.
+ static void DisablePreview();
+
bool IsPrintingEnabled();
void PrintNode(const blink::WebNode& node);
@@ -78,7 +82,11 @@ class PrintWebViewHelper
FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperPreviewTest,
BlockScriptInitiatedPrinting);
FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, OnPrintPages);
-
+ FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, OnPrintPages);
+ FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest,
+ BlockScriptInitiatedPrinting);
+ FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest,
+ BlockScriptInitiatedPrintingFromPopup);
#if defined(OS_WIN) || defined(OS_MACOSX)
FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintLayoutTest);
FRIEND_TEST_ALL_PREFIXES(PrintWebViewHelperTest, PrintWithIframe);
@@ -309,6 +317,7 @@ class PrintWebViewHelper
scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_;
bool is_print_ready_metafile_sent_;
bool ignore_css_margins_;
+
// Used for scripted initiated printing blocking.
bool is_scripted_printing_blocked_;
@@ -428,6 +437,25 @@ class PrintWebViewHelper
State state_;
};
+ class ScriptingThrottler {
+ public:
+ ScriptingThrottler();
+
+ // Returns false if script initiated printing occurs too often.
+ bool IsAllowed(blink::WebFrame* frame);
+
+ // Reset the counter for script initiated printing.
+ // Scripted printing will be allowed to continue.
+ void Reset();
+
+ private:
+ base::Time last_print_;
+ int count_ = 0;
+ DISALLOW_COPY_AND_ASSIGN(ScriptingThrottler);
+ };
+
+ ScriptingThrottler scripting_throttler_;
+
bool print_node_in_progress_;
PrintPreviewContext print_preview_context_;
bool is_loading_;
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/renderer/printing/print_web_view_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698