OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 /** @suppress {duplicate} */ | 5 /** @suppress {duplicate} */ |
6 var remoting = remoting || {}; | 6 var remoting = remoting || {}; |
7 | 7 |
8 (function() { | 8 (function() { |
9 'use strict'; | 9 'use strict'; |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 OAUTH_FETCH_FAILED: /*i18n-content*/'ERROR_AUTHENTICATION_FAILED', | 47 OAUTH_FETCH_FAILED: /*i18n-content*/'ERROR_AUTHENTICATION_FAILED', |
48 OTHER_ERROR: /*i18n-content*/'ERROR_GENERIC' | 48 OTHER_ERROR: /*i18n-content*/'ERROR_GENERIC' |
49 }; | 49 }; |
50 | 50 |
51 /** | 51 /** |
52 * Whether or not the plugin should scale itself. | 52 * Whether or not the plugin should scale itself. |
53 * @type {boolean} | 53 * @type {boolean} |
54 */ | 54 */ |
55 remoting.scaleToFit = false; | 55 remoting.scaleToFit = false; |
56 | 56 |
57 /** | |
58 * Whether or not the P2P Transport API should be used. This flag is an interim | |
59 * measure to allow testing by early adopters, and will be removed when P2P API | |
60 * is enabled by default. See http://crbug.com/51198 for details. | |
61 * @type {boolean} | |
62 */ | |
63 remoting.useP2pApi = false; | |
64 | |
65 // Constants representing keys used for storing persistent application state. | 57 // Constants representing keys used for storing persistent application state. |
66 var KEY_APP_MODE_ = 'remoting-app-mode'; | 58 var KEY_APP_MODE_ = 'remoting-app-mode'; |
67 var KEY_EMAIL_ = 'remoting-email'; | 59 var KEY_EMAIL_ = 'remoting-email'; |
68 var KEY_USE_P2P_API_ = 'remoting-use-p2p-api'; | 60 var KEY_USE_P2P_API_ = 'remoting-use-p2p-api'; |
69 | 61 |
70 // Some constants for pretty-printing the access code. | 62 // Some constants for pretty-printing the access code. |
71 var kSupportIdLen = 7; | 63 var kSupportIdLen = 7; |
72 var kHostSecretLen = 5; | 64 var kHostSecretLen = 5; |
73 var kAccessCodeLen = kSupportIdLen + kHostSecretLen; | 65 var kAccessCodeLen = kSupportIdLen + kHostSecretLen; |
74 var kDigitsPerGroup = 4; | 66 var kDigitsPerGroup = 4; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 remoting.setMode(getAppStartupMode()); | 165 remoting.setMode(getAppStartupMode()); |
174 if (isHostModeSupported()) { | 166 if (isHostModeSupported()) { |
175 var unsupported = document.getElementById('client-footer-text-cros'); | 167 var unsupported = document.getElementById('client-footer-text-cros'); |
176 unsupported.parentNode.removeChild(unsupported); | 168 unsupported.parentNode.removeChild(unsupported); |
177 } else { | 169 } else { |
178 var footer = document.getElementById('client-footer-text'); | 170 var footer = document.getElementById('client-footer-text'); |
179 footer.parentNode.removeChild(footer); | 171 footer.parentNode.removeChild(footer); |
180 document.getElementById('client-footer-text-cros').id = | 172 document.getElementById('client-footer-text-cros').id = |
181 'client-footer-text'; | 173 'client-footer-text'; |
182 } | 174 } |
183 | |
184 remoting.useP2pApi = !(window.localStorage.getItem(KEY_USE_P2P_API_) == null); | |
185 } | 175 } |
186 | 176 |
187 /** | 177 /** |
188 * Change the app's modal state to |mode|, which is considered to be a dotted | 178 * Change the app's modal state to |mode|, which is considered to be a dotted |
189 * hierachy of modes. For example, setMode('host.shared') will show any modal | 179 * hierachy of modes. For example, setMode('host.shared') will show any modal |
190 * elements with an data-ui-mode attribute of 'host' or 'host.shared' and hide | 180 * elements with an data-ui-mode attribute of 'host' or 'host.shared' and hide |
191 * all others. | 181 * all others. |
192 * | 182 * |
193 * @param {remoting.AppMode} mode The new modal state, expressed as a dotted | 183 * @param {remoting.AppMode} mode The new modal state, expressed as a dotted |
194 * hiearchy. | 184 * hiearchy. |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 return null; | 712 return null; |
723 } | 713 } |
724 } | 714 } |
725 | 715 |
726 remoting.checkHotkeys = function(event) { | 716 remoting.checkHotkeys = function(event) { |
727 if (String.fromCharCode(event.which) == 'D') { | 717 if (String.fromCharCode(event.which) == 'D') { |
728 remoting.toggleDebugLog(); | 718 remoting.toggleDebugLog(); |
729 } | 719 } |
730 } | 720 } |
731 | 721 |
732 remoting.setUseP2pApi = function(use) { | |
733 remoting.useP2pApi = use; | |
734 if (use) { | |
735 window.localStorage.setItem(KEY_USE_P2P_API_, 'true'); | |
736 } else { | |
737 window.localStorage.removeItem(KEY_USE_P2P_API_); | |
738 } | |
739 } | |
740 | |
741 function recenterToolbar_() { | 722 function recenterToolbar_() { |
742 var toolbar = document.getElementById('session-toolbar'); | 723 var toolbar = document.getElementById('session-toolbar'); |
743 var toolbarX = (window.innerWidth - toolbar.clientWidth) / 2; | 724 var toolbarX = (window.innerWidth - toolbar.clientWidth) / 2; |
744 toolbar.style['left'] = toolbarX + 'px'; | 725 toolbar.style['left'] = toolbarX + 'px'; |
745 remoting.debug.log('toolbar moved to ' + toolbarX); | 726 remoting.debug.log('toolbar moved to ' + toolbarX); |
746 } | 727 } |
747 | 728 |
748 }()); | 729 }()); |
OLD | NEW |