Chromium Code Reviews| Index: chrome/browser/resources/ssl/captive_portal.js |
| diff --git a/chrome/browser/resources/ssl/captive_portal.js b/chrome/browser/resources/ssl/captive_portal.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c9165af9d9d0db1b3a8db720e417ed4a90dc404a |
| --- /dev/null |
| +++ b/chrome/browser/resources/ssl/captive_portal.js |
| @@ -0,0 +1,33 @@ |
| +// Copyright 2014 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. |
| + |
| +var expandedDetails = false; |
| +var CMD_OPEN_LOGIN_PAGE = 1; |
| +var CMD_MORE = 2; |
| + |
| +function sendCommand(cmd) { |
| + window.domAutomationController.setAutomationId(1); |
| + window.domAutomationController.send(cmd); |
| +} |
| + |
| +function setupEvents() { |
| + $('primary-button').addEventListener('click', function() { |
| + sendCommand(CMD_OPEN_LOGIN_PAGE); |
|
mmenke
2014/06/20 16:07:08
nit: Believe this should use a 2-space indent.
meacer
2014/06/20 23:28:14
Done.
|
| + }); |
| + |
| + $('details-button').addEventListener('click', function(event) { |
| + var hiddenDetails = $('details').classList.toggle('hidden'); |
| + $('details-button').innerText = hiddenDetails ? |
| + loadTimeData.getString('openDetails') : |
| + loadTimeData.getString('closeDetails'); |
| + if (!expandedDetails) { |
| + // Record a histogram entry only the first time that details is opened. |
| + sendCommand(CMD_MORE); |
|
mmenke
2014/06/20 16:07:08
nit: Should be consistent - use more everywhere,
meacer
2014/06/20 23:28:14
Renamed to SHOW_DETAILS.
|
| + expandedDetails = true; |
| + } |
| + event.preventDefault(); |
| + }); |
| +} |
| + |
| +document.addEventListener('DOMContentLoaded', setupEvents); |