| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 remoting.initElementEventHandlers = function() { | 10 remoting.initElementEventHandlers = function() { |
| 11 var goHome = function() { | 11 var goHome = function() { |
| 12 remoting.setMode(remoting.AppMode.HOME); | 12 remoting.setMode(remoting.AppMode.HOME); |
| 13 }; | 13 }; |
| 14 var goFinishedIT2Me = function() { | 14 var goFinishedIT2Me = function() { |
| 15 if (remoting.currentMode == remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME) { | 15 if (remoting.currentMode == remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME) { |
| 16 remoting.setMode(remoting.AppMode.CLIENT_UNCONNECTED); | 16 remoting.setMode(remoting.AppMode.CLIENT_UNCONNECTED); |
| 17 } else { | 17 } else { |
| 18 goHome(); | 18 goHome(); |
| 19 } | 19 } |
| 20 }; | 20 }; |
| 21 var reconnect = function() { | |
| 22 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); | |
| 23 remoting.app.getSessionConnector().reconnect(); | |
| 24 }; | |
| 25 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ | 21 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ |
| 26 var it2me_actions = [ | 22 var it2me_actions = [ |
| 27 { event: 'click', id: 'cancel-share-button', fn: remoting.cancelShare }, | 23 { event: 'click', id: 'cancel-share-button', fn: remoting.cancelShare }, |
| 28 { event: 'click', id: 'client-finished-it2me-button', fn: goHome }, | |
| 29 { event: 'click', id: 'get-started-it2me', | 24 { event: 'click', id: 'get-started-it2me', |
| 30 fn: remoting.showIT2MeUiAndSave }, | 25 fn: remoting.showIT2MeUiAndSave }, |
| 31 { event: 'click', id: 'host-finished-button', fn: goHome }, | 26 { event: 'click', id: 'host-finished-button', fn: goHome }, |
| 32 { event: 'click', id: 'share-button', fn: remoting.tryShare } | 27 { event: 'click', id: 'share-button', fn: remoting.tryShare } |
| 33 ]; | 28 ]; |
| 34 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ | 29 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ |
| 35 var me2me_actions = [ | 30 var me2me_actions = [ |
| 36 { event: 'click', id: 'client-finished-me2me-button', fn: goHome }, | |
| 37 { event: 'click', id: 'client-reconnect-button', fn: reconnect }, | |
| 38 { event: 'click', id: 'daemon-pin-cancel', fn: goHome }, | 31 { event: 'click', id: 'daemon-pin-cancel', fn: goHome }, |
| 39 { event: 'click', id: 'get-started-me2me', | 32 { event: 'click', id: 'get-started-me2me', |
| 40 fn: remoting.showMe2MeUiAndSave } | 33 fn: remoting.showMe2MeUiAndSave } |
| 41 ]; | 34 ]; |
| 42 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ | 35 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ |
| 43 var host_actions = [ | 36 var host_actions = [ |
| 44 { event: 'click', id: 'close-paired-client-manager-dialog', fn: goHome }, | 37 { event: 'click', id: 'close-paired-client-manager-dialog', fn: goHome }, |
| 45 { event: 'click', id: 'host-config-done-dismiss', fn: goHome }, | 38 { event: 'click', id: 'host-config-done-dismiss', fn: goHome }, |
| 46 { event: 'click', id: 'host-config-error-dismiss', fn: goHome }, | 39 { event: 'click', id: 'host-config-error-dismiss', fn: goHome }, |
| 47 { event: 'click', id: 'open-paired-client-manager-dialog', | 40 { event: 'click', id: 'open-paired-client-manager-dialog', |
| (...skipping 22 matching lines...) Expand all Loading... |
| 70 * Also clear all local storage, to avoid leaking information. | 63 * Also clear all local storage, to avoid leaking information. |
| 71 */ | 64 */ |
| 72 remoting.signOut = function() { | 65 remoting.signOut = function() { |
| 73 remoting.oauth2.removeCachedAuthToken().then(function(){ | 66 remoting.oauth2.removeCachedAuthToken().then(function(){ |
| 74 chrome.storage.local.clear(); | 67 chrome.storage.local.clear(); |
| 75 remoting.setMode(remoting.AppMode.HOME); | 68 remoting.setMode(remoting.AppMode.HOME); |
| 76 window.location.reload(); | 69 window.location.reload(); |
| 77 }); | 70 }); |
| 78 }; | 71 }; |
| 79 | 72 |
| OLD | NEW |