| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 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 /** | |
| 6 * @fileoverview Demo login UI. | |
| 7 */ | |
| 8 | |
| 9 /** | |
| 10 * Handles a user clicking anywhere on the screen. This will log the demo user | |
| 11 * in. Yes, this actually _is the intention. | |
| 12 * @param {Event} e The click event that triggered this function. | |
| 13 */ | |
| 14 onClick = function(e) { | |
| 15 document.removeEventListener('click', onClick); | |
| 16 e.stopPropagation(); | |
| 17 showLoginSpinner(); | |
| 18 chrome.send('launchDemoUser'); | |
| 19 }; | |
| 20 | |
| 21 /** | |
| 22 * Initializes the click handler. | |
| 23 */ | |
| 24 initialize = function() { | |
| 25 $('page').style.opacity = 1; | |
| 26 document.addEventListener('click', onClick); | |
| 27 // Report back sign in UI being painted. | |
| 28 window.requestAnimationFrame(function() { | |
| 29 chrome.send('loginVisible', ['demo']); | |
| 30 }); | |
| 31 }; | |
| 32 | |
| 33 /** | |
| 34 * Show the login spinner. | |
| 35 */ | |
| 36 showLoginSpinner = function() { | |
| 37 // We're already logging in - don't login on click. | |
| 38 document.removeEventListener('click', onClick); | |
| 39 | |
| 40 // Hide the "Click to start" and show the spinner. | |
| 41 $('demo-login-text').hidden = true; | |
| 42 $('login-spinner').hidden = false; | |
| 43 }; | |
| 44 | |
| 45 disableTextSelectAndDrag(); | |
| 46 document.addEventListener('DOMContentLoaded', initialize); | |
| OLD | NEW |