| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 function onLoad() { | 10 function onLoad() { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 { event: 'click', id: 'cancel-connect-button', | 64 { event: 'click', id: 'cancel-connect-button', |
| 65 fn: remoting.cancelConnect }, | 65 fn: remoting.cancelConnect }, |
| 66 { event: 'click', id: 'toolbar-stub', | 66 { event: 'click', id: 'toolbar-stub', |
| 67 fn: function() { remoting.toolbar.toggle(); } }, | 67 fn: function() { remoting.toolbar.toggle(); } }, |
| 68 { event: 'click', id: 'start-daemon', | 68 { event: 'click', id: 'start-daemon', |
| 69 fn: function() { remoting.askPinDialog.showForStart(); } }, | 69 fn: function() { remoting.askPinDialog.showForStart(); } }, |
| 70 { event: 'click', id: 'change-daemon-pin', | 70 { event: 'click', id: 'change-daemon-pin', |
| 71 fn: function() { remoting.askPinDialog.showForPin(); } }, | 71 fn: function() { remoting.askPinDialog.showForPin(); } }, |
| 72 { event: 'click', id: 'stop-daemon', fn: stopDaemon }, | 72 { event: 'click', id: 'stop-daemon', fn: stopDaemon }, |
| 73 { event: 'submit', id: 'access-code-form', fn: sendAccessCode }, | 73 { event: 'submit', id: 'access-code-form', fn: sendAccessCode }, |
| 74 { event: 'submit', id: 'pin-form', fn: connectHostWithPin } | 74 { event: 'submit', id: 'pin-form', fn: connectHostWithPin }, |
| 75 { event: 'click', id: 'get-started-it2me', |
| 76 fn: remoting.showIt2MeUiAndSave }, |
| 77 { event: 'click', id: 'get-started-me2me', |
| 78 fn: remoting.showMe2MeUiAndSave } |
| 75 ]; | 79 ]; |
| 76 | 80 |
| 77 for (var i = 0; i < actions.length; ++i) { | 81 for (var i = 0; i < actions.length; ++i) { |
| 78 var action = actions[i]; | 82 var action = actions[i]; |
| 79 var element = document.getElementById(action.id); | 83 var element = document.getElementById(action.id); |
| 80 if (element) { | 84 if (element) { |
| 81 element.addEventListener(action.event, action.fn, false); | 85 element.addEventListener(action.event, action.fn, false); |
| 82 } else { | 86 } else { |
| 83 console.error('Could not set ' + action.event + | 87 console.error('Could not set ' + action.event + |
| 84 ' event handler on element ' + action.id + | 88 ' event handler on element ' + action.id + |
| 85 ': element not found.'); | 89 ': element not found.'); |
| 86 } | 90 } |
| 87 } | 91 } |
| 88 remoting.init(); | 92 remoting.init(); |
| 89 } | 93 } |
| 90 | 94 |
| 91 function onBeforeUnload() { | 95 function onBeforeUnload() { |
| 92 return remoting.promptClose(); | 96 return remoting.promptClose(); |
| 93 } | 97 } |
| 94 | 98 |
| 95 window.addEventListener('load', onLoad, false); | 99 window.addEventListener('load', onLoad, false); |
| 96 window.addEventListener('beforeunload', onBeforeUnload, false); | 100 window.addEventListener('beforeunload', onBeforeUnload, false); |
| 97 window.addEventListener('resize', remoting.onResize, false); | 101 window.addEventListener('resize', remoting.onResize, false); |
| 98 window.addEventListener('unload', remoting.disconnect, false); | 102 window.addEventListener('unload', remoting.disconnect, false); |
| OLD | NEW |