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