| 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 /** @param {Event} event The event. */ | |
| 42 var stopDaemon = function(event) { | |
| 43 remoting.hostSetupDialog.showForStop(); | |
| 44 event.stopPropagation(); | |
| 45 }; | |
| 46 var cancelAccessCode = function() { | 41 var cancelAccessCode = function() { |
| 47 remoting.setMode(remoting.AppMode.HOME); | 42 remoting.setMode(remoting.AppMode.HOME); |
| 48 document.getElementById('access-code-entry').value = ''; | 43 document.getElementById('access-code-entry').value = ''; |
| 49 }; | 44 }; |
| 50 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ | 45 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ |
| 51 var it2me_actions = [ | 46 var it2me_actions = [ |
| 52 { event: 'click', id: 'access-mode-button', fn: goEnterAccessCode }, | 47 { event: 'click', id: 'access-mode-button', fn: goEnterAccessCode }, |
| 53 { event: 'submit', id: 'access-code-form', fn: sendAccessCode }, | 48 { event: 'submit', id: 'access-code-form', fn: sendAccessCode }, |
| 54 { event: 'click', id: 'cancel-access-code-button', fn: cancelAccessCode}, | 49 { event: 'click', id: 'cancel-access-code-button', fn: cancelAccessCode}, |
| 55 { event: 'click', id: 'cancel-share-button', fn: remoting.cancelShare }, | 50 { event: 'click', id: 'cancel-share-button', fn: remoting.cancelShare }, |
| 56 { event: 'click', id: 'client-finished-it2me-button', fn: goHome }, | 51 { event: 'click', id: 'client-finished-it2me-button', fn: goHome }, |
| 57 { event: 'click', id: 'get-started-it2me', | 52 { event: 'click', id: 'get-started-it2me', |
| 58 fn: remoting.showIT2MeUiAndSave }, | 53 fn: remoting.showIT2MeUiAndSave }, |
| 59 { event: 'click', id: 'host-finished-button', fn: goHome }, | 54 { event: 'click', id: 'host-finished-button', fn: goHome }, |
| 60 { event: 'click', id: 'share-button', fn: remoting.tryShare } | 55 { event: 'click', id: 'share-button', fn: remoting.tryShare } |
| 61 ]; | 56 ]; |
| 62 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ | 57 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ |
| 63 var me2me_actions = [ | 58 var me2me_actions = [ |
| 64 { event: 'click', id: 'change-daemon-pin', | |
| 65 fn: function() { remoting.hostSetupDialog.showForPin(); } }, | |
| 66 { event: 'click', id: 'client-finished-me2me-button', fn: goHome }, | 59 { event: 'click', id: 'client-finished-me2me-button', fn: goHome }, |
| 67 { event: 'click', id: 'client-reconnect-button', fn: reconnect }, | 60 { event: 'click', id: 'client-reconnect-button', fn: reconnect }, |
| 68 { event: 'click', id: 'daemon-pin-cancel', fn: goHome }, | 61 { event: 'click', id: 'daemon-pin-cancel', fn: goHome }, |
| 69 { event: 'click', id: 'get-started-me2me', | 62 { event: 'click', id: 'get-started-me2me', |
| 70 fn: remoting.showMe2MeUiAndSave }, | 63 fn: remoting.showMe2MeUiAndSave } |
| 71 { event: 'click', id: 'start-daemon', | |
| 72 fn: function() { remoting.hostSetupDialog.showForStart(); } }, | |
| 73 { event: 'click', id: 'stop-daemon', fn: stopDaemon } | |
| 74 ]; | 64 ]; |
| 75 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ | 65 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ |
| 76 var host_actions = [ | 66 var host_actions = [ |
| 77 { event: 'click', id: 'close-paired-client-manager-dialog', fn: goHome }, | 67 { event: 'click', id: 'close-paired-client-manager-dialog', fn: goHome }, |
| 78 { event: 'click', id: 'host-config-done-dismiss', fn: goHome }, | 68 { event: 'click', id: 'host-config-done-dismiss', fn: goHome }, |
| 79 { event: 'click', id: 'host-config-error-dismiss', fn: goHome }, | 69 { event: 'click', id: 'host-config-error-dismiss', fn: goHome }, |
| 80 { event: 'click', id: 'open-paired-client-manager-dialog', | 70 { event: 'click', id: 'open-paired-client-manager-dialog', |
| 81 fn: remoting.setMode.bind(null, | 71 fn: remoting.setMode.bind(null, |
| 82 remoting.AppMode.HOME_MANAGE_PAIRINGS) }, | 72 remoting.AppMode.HOME_MANAGE_PAIRINGS) }, |
| 83 { event: 'click', id: 'stop-sharing-button', fn: remoting.cancelShare } | 73 { event: 'click', id: 'stop-sharing-button', fn: remoting.cancelShare } |
| 84 ]; | 74 ]; |
| 85 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ | 75 /** @type {Array<{event: string, id: string, fn: function(Event):void}>} */ |
| 86 var auth_actions = [ | 76 var auth_actions = [ |
| 87 { event: 'click', id: 'cancel-connect-button', fn: goHome }, | 77 { event: 'click', id: 'cancel-connect-button', fn: goHome }, |
| 88 { event: 'click', id: 'sign-out', fn:remoting.signOut }, | 78 { event: 'click', id: 'sign-out', fn:remoting.signOut }, |
| 89 { event: 'click', id: 'token-refresh-error-ok', fn: goHome }, | 79 { event: 'click', id: 'token-refresh-error-ok', fn: goHome }, |
| 90 { event: 'click', id: 'token-refresh-error-sign-in', | 80 { event: 'click', id: 'token-refresh-error-sign-in', |
| 91 fn: remoting.handleAuthFailureAndRelaunch } | 81 fn: remoting.handleAuthFailureAndRelaunch } |
| 92 ]; | 82 ]; |
| 93 registerEventListeners(it2me_actions); | 83 registerEventListeners(it2me_actions); |
| 94 registerEventListeners(me2me_actions); | 84 registerEventListeners(me2me_actions); |
| 95 registerEventListeners(host_actions); | 85 registerEventListeners(host_actions); |
| 96 registerEventListeners(auth_actions); | 86 registerEventListeners(auth_actions); |
| 97 } | 87 } |
| OLD | NEW |