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