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 // require: onc_data.js | 5 // require: onc_data.js |
6 | 6 |
7 // NOTE(stevenjb): This code is in the process of being converted to be | 7 // NOTE(stevenjb): This code is in the process of being converted to be |
8 // compatible with the networkingPrivate extension API: | 8 // compatible with the networkingPrivate extension API: |
9 // * The network property dictionaries are being converted to use ONC values. | 9 // * The network property dictionaries are being converted to use ONC values. |
10 // * chrome.send calls will be replaced with an API object that simulates the | 10 // * chrome.send calls will be replaced with an API object that simulates the |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 */ | 380 */ |
381 handleNameServerTypeChange_: function(event) { | 381 handleNameServerTypeChange_: function(event) { |
382 var type = event.target.value; | 382 var type = event.target.value; |
383 DetailsInternetPage.updateNameServerDisplay(type); | 383 DetailsInternetPage.updateNameServerDisplay(type); |
384 }, | 384 }, |
385 | 385 |
386 /** | 386 /** |
387 * Creates an indicator event for controlled properties using | 387 * Creates an indicator event for controlled properties using |
388 * the same dictionary format as CoreOptionsHandler::CreateValueForPref. | 388 * the same dictionary format as CoreOptionsHandler::CreateValueForPref. |
389 * @param {string} name The name for the Event. | 389 * @param {string} name The name for the Event. |
390 * @param {!{value: *, controlledBy: *, recommendedValue: *}} propData | 390 * @param {{value: *, controlledBy: *, recommendedValue: *}} propData |
391 * Property dictionary, | 391 * Property dictionary. |
392 * @private | 392 * @private |
393 */ | 393 */ |
394 createControlledEvent_: function(name, propData) { | 394 createControlledEvent_: function(name, propData) { |
395 assert('value' in propData && 'controlledBy' in propData && | |
396 'recommendedValue' in propData); | |
395 var event = new Event(name); | 397 var event = new Event(name); |
396 event.value = { | 398 event.value = { |
397 value: propData.value, | 399 value: propData.value, |
398 controlledBy: propData.controlledBy, | 400 controlledBy: propData.controlledBy, |
399 recommendedValue: propData.recommendedValue | 401 recommendedValue: propData.recommendedValue |
400 }; | 402 }; |
401 return event; | 403 return event; |
402 }, | 404 }, |
403 | 405 |
404 /** | 406 /** |
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1562 var managed = indicators[i].hasAttribute('managed'); | 1564 var managed = indicators[i].hasAttribute('managed'); |
1563 var attributeName = managed ? 'managed' : 'data'; | 1565 var attributeName = managed ? 'managed' : 'data'; |
1564 var propName = indicators[i].getAttribute(attributeName); | 1566 var propName = indicators[i].getAttribute(attributeName); |
1565 if (!propName) | 1567 if (!propName) |
1566 continue; | 1568 continue; |
1567 var propValue = managed ? | 1569 var propValue = managed ? |
1568 onc.getManagedProperty(propName) : | 1570 onc.getManagedProperty(propName) : |
1569 onc.getActiveValue(propName); | 1571 onc.getActiveValue(propName); |
1570 if (propValue == undefined) | 1572 if (propValue == undefined) |
1571 continue; | 1573 continue; |
1574 propValue = assertInstanceof(propValue, Object); | |
stevenjb
2014/11/05 20:30:15
While I do appreciate this effort, this actually i
| |
1572 var event; | 1575 var event; |
1573 if (managed) | 1576 if (managed) |
1574 event = detailsPage.createManagedEvent_(propName, propValue); | 1577 event = detailsPage.createManagedEvent_(propName, propValue); |
1575 else | 1578 else |
1576 event = detailsPage.createControlledEvent_(propName, propValue); | 1579 event = detailsPage.createControlledEvent_(propName, |
1580 /** @type {{value: *, controlledBy: *, recommendedValue: *}} */( | |
1581 propValue)); | |
1577 indicators[i].handlePrefChange(event); | 1582 indicators[i].handlePrefChange(event); |
1578 var forElement = $(indicators[i].getAttribute('for')); | 1583 var forElement = $(indicators[i].getAttribute('for')); |
1579 if (forElement) { | 1584 if (forElement) { |
1580 if (event.value.controlledBy == 'policy') | 1585 if (event.value.controlledBy == 'policy') |
1581 forElement.disabled = true; | 1586 forElement.disabled = true; |
1582 if (forElement.resetHandler) | 1587 if (forElement.resetHandler) |
1583 indicators[i].resetHandler = forElement.resetHandler; | 1588 indicators[i].resetHandler = forElement.resetHandler; |
1584 } | 1589 } |
1585 } | 1590 } |
1586 | 1591 |
1587 detailsPage.updateControls(); | 1592 detailsPage.updateControls(); |
1588 | 1593 |
1589 // Don't show page name in address bar and in history to prevent people | 1594 // Don't show page name in address bar and in history to prevent people |
1590 // navigate here by hand and solve issue with page session restore. | 1595 // navigate here by hand and solve issue with page session restore. |
1591 PageManager.showPageByName('detailsInternetPage', false); | 1596 PageManager.showPageByName('detailsInternetPage', false); |
1592 }; | 1597 }; |
1593 | 1598 |
1594 return { | 1599 return { |
1595 DetailsInternetPage: DetailsInternetPage | 1600 DetailsInternetPage: DetailsInternetPage |
1596 }; | 1601 }; |
1597 }); | 1602 }); |
OLD | NEW |