Chromium Code Reviews| 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 the new (Chrome 37) security interstitials. It is | |
| 6 // used for both SSL interstitials and Safe Browsing interstitials. | |
| 7 | |
| 8 // var expandedDetails = false; | |
| 9 // var keyPressState = 0; | |
| 10 | |
| 11 // Should match security_interstitials::SecurityInterstitialCommands | |
| 12 var CMD_DONT_PROCEED = 0; | |
| 13 var CMD_PROCEED = 1; | |
| 14 // Ways for user to get more information | |
| 15 var CMD_SHOW_MORE_SECTION = 2; | |
| 16 var CMD_OPEN_HELP_CENTER = 3; | |
| 17 var CMD_OPEN_DIAGNOSTIC = 4; | |
| 18 // Primary button actions | |
| 19 var CMD_RELOAD = 5; | |
| 20 var CMD_OPEN_DATE_SETTINGS = 6; | |
| 21 var CMD_OPEN_LOGIN = 7; | |
| 22 // Safe Browsing Extended Reporting | |
| 23 var CMD_DO_REPORT = 8; | |
| 24 var CMD_DONT_REPORT = 9; | |
| 25 var CMD_OPEN_REPORTING_PRIVACY = 10; | |
| 26 var CMD_OPEN_WHITEPAPER = 11; | |
| 27 // Report a phishing error. | |
| 28 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.
| |
| 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 |