| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // This is the shared code for security interstitials. It is used for both SSL |
| 6 // interstitials and Safe Browsing interstitials. |
| 7 |
| 8 // Should match security_interstitials::SecurityInterstitialCommands |
| 9 /** @enum| {string} */ |
| 10 var SecurityInterstitialCommandId = { |
| 11 CMD_DONT_PROCEED: 0, |
| 12 CMD_PROCEED: 1, |
| 13 // Ways for user to get more information |
| 14 CMD_SHOW_MORE_SECTION: 2, |
| 15 CMD_OPEN_HELP_CENTER: 3, |
| 16 CMD_OPEN_DIAGNOSTIC: 4, |
| 17 // Primary button actions |
| 18 CMD_RELOAD: 5, |
| 19 CMD_OPEN_DATE_SETTINGS: 6, |
| 20 CMD_OPEN_LOGIN: 7, |
| 21 // Safe Browsing Extended Reporting |
| 22 CMD_DO_REPORT: 8, |
| 23 CMD_DONT_REPORT: 9, |
| 24 CMD_OPEN_REPORTING_PRIVACY: 10, |
| 25 CMD_OPEN_WHITEPAPER: 11, |
| 26 // Report a phishing error. |
| 27 CMD_REPORT_PHISHING_ERROR: 12 |
| 28 }; |
| 29 |
| 30 /** |
| 31 * A convenience method for sending commands to the parent page. |
| 32 * @param {string} cmd The command to send. |
| 33 */ |
| 34 function sendCommand(cmd) { |
| 35 // <if expr="not is_ios"> |
| 36 window.domAutomationController.setAutomationId(1); |
| 37 window.domAutomationController.send(cmd); |
| 38 // </if> |
| 39 // <if expr="is_ios"> |
| 40 // TODO(crbug.com/565877): Revisit message passing for WKWebView. |
| 41 var iframe = document.createElement('IFRAME'); |
| 42 iframe.setAttribute('src', 'js-command:' + cmd); |
| 43 document.documentElement.appendChild(iframe); |
| 44 iframe.parentNode.removeChild(iframe); |
| 45 // </if> |
| 46 } |
| OLD | NEW |