Chromium Code Reviews| 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() { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 }; | 31 }; |
| 32 /** @param {Event} event The event. */ | 32 /** @param {Event} event The event. */ |
| 33 var sendAccessCode = function(event) { | 33 var sendAccessCode = function(event) { |
| 34 remoting.connectIT2Me(); | 34 remoting.connectIT2Me(); |
| 35 event.preventDefault(); | 35 event.preventDefault(); |
| 36 }; | 36 }; |
| 37 var reconnect = function() { | 37 var reconnect = function() { |
| 38 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); | 38 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); |
| 39 remoting.app.getSessionConnector().reconnect(); | 39 remoting.app.getSessionConnector().reconnect(); |
| 40 }; | 40 }; |
| 41 var doAuthRedirect = function() { | 41 var handleAuthFailure = function() { |
| 42 if (!base.isAppsV2()) { | 42 remoting.identity.handleAuthFailureAndRelaunch(); |
| 43 remoting.oauth2.doAuthRedirect(function() { | |
| 44 window.location.reload(); | |
| 45 }); | |
| 46 } | |
| 47 }; | |
| 48 var fixAuthError = function() { | |
| 49 if (base.isAppsV2()) { | |
| 50 var onRefresh = function() { | |
| 51 remoting.hostList.display(); | |
| 52 }; | |
| 53 var refreshHostList = function() { | |
| 54 goHome(); | |
| 55 remoting.hostList.refresh(onRefresh); | |
| 56 }; | |
| 57 remoting.identity.removeCachedAuthToken(refreshHostList); | |
| 58 } else { | |
| 59 doAuthRedirect(); | |
| 60 } | |
| 61 }; | 43 }; |
| 62 /** @param {Event} event The event. */ | 44 /** @param {Event} event The event. */ |
| 63 var stopDaemon = function(event) { | 45 var stopDaemon = function(event) { |
| 64 remoting.hostSetupDialog.showForStop(); | 46 remoting.hostSetupDialog.showForStop(); |
| 65 event.stopPropagation(); | 47 event.stopPropagation(); |
| 66 }; | 48 }; |
| 67 var cancelAccessCode = function() { | 49 var cancelAccessCode = function() { |
| 68 remoting.setMode(remoting.AppMode.HOME); | 50 remoting.setMode(remoting.AppMode.HOME); |
| 69 document.getElementById('access-code-entry').value = ''; | 51 document.getElementById('access-code-entry').value = ''; |
| 70 }; | 52 }; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 98 { event: 'click', id: 'close-paired-client-manager-dialog', fn: goHome }, | 80 { event: 'click', id: 'close-paired-client-manager-dialog', fn: goHome }, |
| 99 { event: 'click', id: 'host-config-done-dismiss', fn: goHome }, | 81 { event: 'click', id: 'host-config-done-dismiss', fn: goHome }, |
| 100 { event: 'click', id: 'host-config-error-dismiss', fn: goHome }, | 82 { event: 'click', id: 'host-config-error-dismiss', fn: goHome }, |
| 101 { event: 'click', id: 'open-paired-client-manager-dialog', | 83 { event: 'click', id: 'open-paired-client-manager-dialog', |
| 102 fn: remoting.setMode.bind(null, | 84 fn: remoting.setMode.bind(null, |
| 103 remoting.AppMode.HOME_MANAGE_PAIRINGS) }, | 85 remoting.AppMode.HOME_MANAGE_PAIRINGS) }, |
| 104 { event: 'click', id: 'stop-sharing-button', fn: remoting.cancelShare } | 86 { event: 'click', id: 'stop-sharing-button', fn: remoting.cancelShare } |
| 105 ]; | 87 ]; |
| 106 /** @type {Array.<{event: string, id: string, fn: function(Event):void}>} */ | 88 /** @type {Array.<{event: string, id: string, fn: function(Event):void}>} */ |
| 107 var auth_actions = [ | 89 var auth_actions = [ |
| 108 { event: 'click', id: 'auth-button', fn: doAuthRedirect }, | 90 { event: 'click', id: 'auth-button', fn: handleAuthFailure }, |
|
Jamie
2015/01/23 23:33:26
I'm not sure this will work. I think "auth-button"
kelvinp
2015/01/28 00:26:45
Done.
| |
| 109 { event: 'click', id: 'cancel-connect-button', fn: goHome }, | 91 { event: 'click', id: 'cancel-connect-button', fn: goHome }, |
| 110 { event: 'click', id: 'sign-out', fn:remoting.signOut }, | 92 { event: 'click', id: 'sign-out', fn:remoting.signOut }, |
| 111 { event: 'click', id: 'token-refresh-error-ok', fn: goHome }, | 93 { event: 'click', id: 'token-refresh-error-ok', fn: goHome }, |
| 112 { event: 'click', id: 'token-refresh-error-sign-in', fn: fixAuthError } | 94 { event: 'click', id: 'token-refresh-error-sign-in', |
| 95 fn: handleAuthFailure } | |
| 113 ]; | 96 ]; |
| 114 registerEventListeners(it2me_actions); | 97 registerEventListeners(it2me_actions); |
| 115 registerEventListeners(me2me_actions); | 98 registerEventListeners(me2me_actions); |
| 116 registerEventListeners(host_actions); | 99 registerEventListeners(host_actions); |
| 117 registerEventListeners(auth_actions); | 100 registerEventListeners(auth_actions); |
| 118 } | 101 } |
| OLD | NEW |