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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Class representing the host-list portion of the home screen UI. | 7 * Class representing the host-list portion of the home screen UI. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 11 matching lines...) Expand all Loading... |
22 * @param {Element} noHosts The HTML <div> containing the "no hosts" message. | 22 * @param {Element} noHosts The HTML <div> containing the "no hosts" message. |
23 * @param {Element} errorMsg The HTML <div> to display error messages. | 23 * @param {Element} errorMsg The HTML <div> to display error messages. |
24 * @param {Element} errorButton The HTML <button> to display the error | 24 * @param {Element} errorButton The HTML <button> to display the error |
25 * resolution action. | 25 * resolution action. |
26 * @param {HTMLElement} loadingIndicator The HTML <span> to update while the | 26 * @param {HTMLElement} loadingIndicator The HTML <span> to update while the |
27 * host list is being loaded. The first element of this span should be | 27 * host list is being loaded. The first element of this span should be |
28 * the reload button. | 28 * the reload button. |
29 */ | 29 */ |
30 remoting.HostList = function(table, noHosts, errorMsg, errorButton, | 30 remoting.HostList = function(table, noHosts, errorMsg, errorButton, |
31 loadingIndicator) { | 31 loadingIndicator) { |
32 /** | 32 /** @private {Element} */ |
33 * @type {Element} | |
34 * @private | |
35 */ | |
36 this.table_ = table; | 33 this.table_ = table; |
37 /** | 34 /** |
38 * @type {Element} | |
39 * @private | |
40 * TODO(jamiewalch): This should be doable using CSS's sibling selector, | 35 * TODO(jamiewalch): This should be doable using CSS's sibling selector, |
41 * but it doesn't work right now (crbug.com/135050). | 36 * but it doesn't work right now (crbug.com/135050). |
| 37 * @private {Element} |
42 */ | 38 */ |
43 this.noHosts_ = noHosts; | 39 this.noHosts_ = noHosts; |
44 /** | 40 /** @private {Element} */ |
45 * @type {Element} | |
46 * @private | |
47 */ | |
48 this.errorMsg_ = errorMsg; | 41 this.errorMsg_ = errorMsg; |
49 /** | 42 /** @private {Element} */ |
50 * @type {Element} | |
51 * @private | |
52 */ | |
53 this.errorButton_ = errorButton; | 43 this.errorButton_ = errorButton; |
54 /** | 44 /** @private {HTMLElement} */ |
55 * @type {HTMLElement} | |
56 * @private | |
57 */ | |
58 this.loadingIndicator_ = loadingIndicator; | 45 this.loadingIndicator_ = loadingIndicator; |
59 /** | 46 /** @private {Array<remoting.HostTableEntry>} */ |
60 * @type {Array<remoting.HostTableEntry>} | |
61 * @private | |
62 */ | |
63 this.hostTableEntries_ = []; | 47 this.hostTableEntries_ = []; |
64 /** | 48 /** @private {Array<remoting.Host>} */ |
65 * @type {Array<remoting.Host>} | |
66 * @private | |
67 */ | |
68 this.hosts_ = []; | 49 this.hosts_ = []; |
69 /** | 50 /** @private {string} */ |
70 * @type {string} | |
71 * @private | |
72 */ | |
73 this.lastError_ = ''; | 51 this.lastError_ = ''; |
74 /** | 52 /** @private {remoting.LocalHostSection} */ |
75 * @type {remoting.LocalHostSection} | |
76 * @private | |
77 */ | |
78 this.localHostSection_ = new remoting.LocalHostSection( | 53 this.localHostSection_ = new remoting.LocalHostSection( |
79 /** @type {HTMLElement} */ (document.querySelector('.daemon-control')), | 54 /** @type {HTMLElement} */ (document.querySelector('.daemon-control')), |
80 new remoting.LocalHostSection.Controller( | 55 new remoting.LocalHostSection.Controller( |
81 this, new remoting.HostSetupDialog(remoting.hostController))); | 56 this, new remoting.HostSetupDialog(remoting.hostController))); |
82 | 57 |
83 /** | 58 /** @private {number} */ |
84 * @type {number} | |
85 * @private | |
86 */ | |
87 this.webappMajorVersion_ = parseInt(chrome.runtime.getManifest().version, 10); | 59 this.webappMajorVersion_ = parseInt(chrome.runtime.getManifest().version, 10); |
88 | 60 |
89 this.errorButton_.addEventListener('click', | 61 this.errorButton_.addEventListener('click', |
90 this.onErrorClick_.bind(this), | 62 this.onErrorClick_.bind(this), |
91 false); | 63 false); |
92 var reloadButton = this.loadingIndicator_.firstElementChild; | 64 var reloadButton = this.loadingIndicator_.firstElementChild; |
93 /** @type {remoting.HostList} */ | 65 /** @type {remoting.HostList} */ |
94 var that = this; | 66 var that = this; |
95 /** @param {Event} event */ | 67 /** @param {Event} event */ |
96 function refresh(event) { | 68 function refresh(event) { |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 } | 396 } |
425 }; | 397 }; |
426 | 398 |
427 /** | 399 /** |
428 * Key name under which Me2Me hosts are cached. | 400 * Key name under which Me2Me hosts are cached. |
429 */ | 401 */ |
430 remoting.HostList.HOSTS_KEY = 'me2me-cached-hosts'; | 402 remoting.HostList.HOSTS_KEY = 'me2me-cached-hosts'; |
431 | 403 |
432 /** @type {remoting.HostList} */ | 404 /** @type {remoting.HostList} */ |
433 remoting.hostList = null; | 405 remoting.hostList = null; |
OLD | NEW |