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