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

Unified Diff: components/security_interstitials/core/browser/resources/interstitial_common.js

Issue 2854263003: Add quiet safe browsing interstitial for WebView (Closed)
Patch Set: Fix unit test Created 3 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
Index: components/security_interstitials/core/browser/resources/interstitial_common.js
diff --git a/components/security_interstitials/core/browser/resources/interstitial_common.js b/components/security_interstitials/core/browser/resources/interstitial_common.js
new file mode 100644
index 0000000000000000000000000000000000000000..e826a1490757fcab3ba033fed3c017dfdcd409ee
--- /dev/null
+++ b/components/security_interstitials/core/browser/resources/interstitial_common.js
@@ -0,0 +1,46 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This is the shared code for security interstitials. It is used for both SSL
+// interstitials and Safe Browsing interstitials.
+
+// Should match security_interstitials::SecurityInterstitialCommands
+/** @enum| {string} */
+var SecurityInterstitialCommandId = {
+ CMD_DONT_PROCEED: 0,
+ CMD_PROCEED: 1,
+ // Ways for user to get more information
+ CMD_SHOW_MORE_SECTION: 2,
+ CMD_OPEN_HELP_CENTER: 3,
+ CMD_OPEN_DIAGNOSTIC: 4,
+ // Primary button actions
+ CMD_RELOAD: 5,
+ CMD_OPEN_DATE_SETTINGS: 6,
+ CMD_OPEN_LOGIN: 7,
+ // Safe Browsing Extended Reporting
+ CMD_DO_REPORT: 8,
+ CMD_DONT_REPORT: 9,
+ CMD_OPEN_REPORTING_PRIVACY: 10,
+ CMD_OPEN_WHITEPAPER: 11,
+ // Report a phishing error.
+ CMD_REPORT_PHISHING_ERROR: 12
+};
+
+/**
+ * A convenience method for sending commands to the parent page.
+ * @param {string} cmd The command to send.
+ */
+function sendCommand(cmd) {
+// <if expr="not is_ios">
+ window.domAutomationController.setAutomationId(1);
+ window.domAutomationController.send(cmd);
+// </if>
+// <if expr="is_ios">
+ // TODO(crbug.com/565877): Revisit message passing for WKWebView.
+ var iframe = document.createElement('IFRAME');
+ iframe.setAttribute('src', 'js-command:' + cmd);
+ document.documentElement.appendChild(iframe);
+ iframe.parentNode.removeChild(iframe);
+// </if>
+}

Powered by Google App Engine
This is Rietveld 408576698