| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 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 var expandedDetails = false; |
| 6 var CMD_OPEN_LOGIN_PAGE = 1; |
| 7 var CMD_MORE = 2; |
| 8 |
| 9 function sendCommand(cmd) { |
| 10 window.domAutomationController.setAutomationId(1); |
| 11 window.domAutomationController.send(cmd); |
| 12 } |
| 13 |
| 14 function setupEvents() { |
| 15 $('primary-button').addEventListener('click', function() { |
| 16 sendCommand(CMD_OPEN_LOGIN_PAGE); |
| 17 }); |
| 18 |
| 19 $('details-button').addEventListener('click', function(event) { |
| 20 var hiddenDetails = $('details').classList.toggle('hidden'); |
| 21 $('details-button').innerText = hiddenDetails ? |
| 22 loadTimeData.getString('openDetails') : |
| 23 loadTimeData.getString('closeDetails'); |
| 24 if (!expandedDetails) { |
| 25 // Record a histogram entry only the first time that details is opened. |
| 26 sendCommand(CMD_MORE); |
| 27 expandedDetails = true; |
| 28 } |
| 29 event.preventDefault(); |
| 30 }); |
| 31 } |
| 32 |
| 33 document.addEventListener('DOMContentLoaded', setupEvents); |
| OLD | NEW |