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

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

Issue 2854263003: Add quiet safe browsing interstitial for WebView (Closed)
Patch Set: Updates to the HTML / CSS 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..bca96eb4eb2790ca51a11e7b77f5b0dd9d7f24af
--- /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 the new (Chrome 37) security interstitials. It is
+// used for both SSL interstitials and Safe Browsing interstitials.
+
+// var expandedDetails = false;
+// var keyPressState = 0;
+
+// Should match security_interstitials::SecurityInterstitialCommands
+var CMD_DONT_PROCEED = 0;
+var CMD_PROCEED = 1;
+// Ways for user to get more information
+var CMD_SHOW_MORE_SECTION = 2;
+var CMD_OPEN_HELP_CENTER = 3;
+var CMD_OPEN_DIAGNOSTIC = 4;
+// Primary button actions
+var CMD_RELOAD = 5;
+var CMD_OPEN_DATE_SETTINGS = 6;
+var CMD_OPEN_LOGIN = 7;
+// Safe Browsing Extended Reporting
+var CMD_DO_REPORT = 8;
+var CMD_DONT_REPORT = 9;
+var CMD_OPEN_REPORTING_PRIVACY = 10;
+var CMD_OPEN_WHITEPAPER = 11;
+// Report a phishing error.
+var CMD_REPORT_PHISHING_ERROR = 12;
Dan Beam 2017/05/08 17:58:04 nit: maybe make this an @enum {number}?
edwardjung 2017/05/08 23:21:11 Done.
+
+/**
+ * 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