OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 'use strict'; | 5 'use strict'; |
6 | 6 |
7 /** @suppress {duplicate} */ | 7 /** @suppress {duplicate} */ |
8 var remoting = remoting || {}; | 8 var remoting = remoting || {}; |
9 | 9 |
10 /** @type {remoting.HostSession} */ remoting.hostSession = null; | 10 /** @type {remoting.HostSession} */ remoting.hostSession = null; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 document.getElementById('share-button').disabled = !isIT2MeSupported_(); | 157 document.getElementById('share-button').disabled = !isIT2MeSupported_(); |
158 remoting.setMode(remoting.AppMode.HOME); | 158 remoting.setMode(remoting.AppMode.HOME); |
159 if (!remoting.oauth2.isAuthenticated()) { | 159 if (!remoting.oauth2.isAuthenticated()) { |
160 document.getElementById('auth-dialog').hidden = false; | 160 document.getElementById('auth-dialog').hidden = false; |
161 } | 161 } |
162 remoting.hostSetupDialog = | 162 remoting.hostSetupDialog = |
163 new remoting.HostSetupDialog(remoting.hostController); | 163 new remoting.HostSetupDialog(remoting.hostController); |
164 // Display the cached host list, then asynchronously update and re-display it. | 164 // Display the cached host list, then asynchronously update and re-display it. |
165 remoting.updateLocalHostState(); | 165 remoting.updateLocalHostState(); |
166 remoting.hostList.refresh(remoting.updateLocalHostState); | 166 remoting.hostList.refresh(remoting.updateLocalHostState); |
167 remoting.initSurvey(); | 167 remoting.butterBar = new remoting.ButterBar(); |
168 }; | 168 }; |
169 | 169 |
170 /** | 170 /** |
171 * Fetches local host state and updates host list accordingly. | 171 * Fetches local host state and updates host list accordingly. |
172 */ | 172 */ |
173 remoting.updateLocalHostState = function() { | 173 remoting.updateLocalHostState = function() { |
174 /** | 174 /** |
175 * @param {string?} hostId Host id. | 175 * @param {string?} hostId Host id. |
176 */ | 176 */ |
177 var onHostId = function(hostId) { | 177 var onHostId = function(hostId) { |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 /** | 409 /** |
410 * Generate a nonce, to be used as an xsrf protection token. | 410 * Generate a nonce, to be used as an xsrf protection token. |
411 * | 411 * |
412 * @return {string} A URL-Safe Base64-encoded 128-bit random value. */ | 412 * @return {string} A URL-Safe Base64-encoded 128-bit random value. */ |
413 remoting.generateXsrfToken = function() { | 413 remoting.generateXsrfToken = function() { |
414 var random = new Uint8Array(16); | 414 var random = new Uint8Array(16); |
415 window.crypto.getRandomValues(random); | 415 window.crypto.getRandomValues(random); |
416 var base64Token = window.btoa(String.fromCharCode.apply(null, random)); | 416 var base64Token = window.btoa(String.fromCharCode.apply(null, random)); |
417 return base64Token.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); | 417 return base64Token.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, ''); |
418 }; | 418 }; |
OLD | NEW |