OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 var NetworkUI = (function() { | 5 var NetworkUI = (function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 // Properties to display in the network state table. Each entry can be either | 8 // Properties to display in the network state table. Each entry can be either |
9 // a single state field or an array of state fields. If more than one is | 9 // a single state field or an array of state fields. If more than one is |
10 // specified then the first non empty value is used. | 10 // specified then the first non empty value is used. |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 /** | 316 /** |
317 * Sets refresh rate if the interval is found in the url. | 317 * Sets refresh rate if the interval is found in the url. |
318 */ | 318 */ |
319 var setRefresh = function() { | 319 var setRefresh = function() { |
320 var interval = parseQueryParams(window.location)['refresh']; | 320 var interval = parseQueryParams(window.location)['refresh']; |
321 if (interval && interval != '') | 321 if (interval && interval != '') |
322 setInterval(requestNetworks, parseInt(interval, 10) * 1000); | 322 setInterval(requestNetworks, parseInt(interval, 10) * 1000); |
323 }; | 323 }; |
324 | 324 |
325 /** | 325 /** |
326 * Gets network information from WebUI. | 326 * Gets network information from WebUI and sets custom items. |
327 */ | 327 */ |
328 document.addEventListener('DOMContentLoaded', function() { | 328 document.addEventListener('DOMContentLoaded', function() { |
| 329 let select = document.querySelector('cr-network-select'); |
| 330 select.customItems = [ |
| 331 {customItemName: 'Add WiFi', polymerIcon: 'cr:add', customData: 'WiFi'}, |
| 332 {customItemName: 'Add VPN', polymerIcon: 'cr:add', customData: 'VPN'} |
| 333 ]; |
329 $('refresh').onclick = requestNetworks; | 334 $('refresh').onclick = requestNetworks; |
330 setRefresh(); | 335 setRefresh(); |
331 requestNetworks(); | 336 requestNetworks(); |
332 }); | 337 }); |
333 | 338 |
| 339 document.addEventListener('custom-item-selected', function(event) { |
| 340 chrome.send('addNetwork', [event.detail.customData]); |
| 341 }); |
| 342 |
334 return { | 343 return { |
335 getShillPropertiesResult: getShillPropertiesResult | 344 getShillPropertiesResult: getShillPropertiesResult |
336 }; | 345 }; |
337 })(); | 346 })(); |
OLD | NEW |