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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
347 */ | 347 */ |
348 handleNameServerTypeChange_: function(event) { | 348 handleNameServerTypeChange_: function(event) { |
349 var type = event.target.value; | 349 var type = event.target.value; |
350 DetailsInternetPage.updateNameServerDisplay(type); | 350 DetailsInternetPage.updateNameServerDisplay(type); |
351 }, | 351 }, |
352 | 352 |
353 /** | 353 /** |
354 * Creates an indicator event for controlled properties using | 354 * Creates an indicator event for controlled properties using |
355 * the same dictionary format as CoreOptionsHandler::CreateValueForPref. | 355 * the same dictionary format as CoreOptionsHandler::CreateValueForPref. |
356 * @param {string} name The name for the Event. | 356 * @param {string} name The name for the Event. |
357 * @param {!{value: *, controlledBy: *, recommendedValue: *}} propData | 357 * @param {Object} propData Property dictionary, Expected content: |
358 * Property dictionary, | 358 * {value: *, controlledBy: *, recommendedValue: *}. |
Dan Beam
2014/09/12 03:25:19
why?
Vitaly Pavlenko
2014/09/12 19:16:23
Otherwise I need a cast on line 1447 (added), whic
| |
359 * @private | 359 * @private |
360 */ | 360 */ |
361 createControlledEvent_: function(name, propData) { | 361 createControlledEvent_: function(name, propData) { |
362 assert('value' in propData && 'controlledBy' in propData && | |
363 'recommendedValue' in propData); | |
362 var event = new Event(name); | 364 var event = new Event(name); |
363 event.value = { | 365 event.value = { |
364 value: propData.value, | 366 value: propData.value, |
365 controlledBy: propData.controlledBy, | 367 controlledBy: propData.controlledBy, |
366 recommendedValue: propData.recommendedValue | 368 recommendedValue: propData.recommendedValue |
367 }; | 369 }; |
368 return event; | 370 return event; |
369 }, | 371 }, |
370 | 372 |
371 /** | 373 /** |
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1429 var managed = indicators[i].hasAttribute('managed'); | 1431 var managed = indicators[i].hasAttribute('managed'); |
1430 var attributeName = managed ? 'managed' : 'data'; | 1432 var attributeName = managed ? 'managed' : 'data'; |
1431 var propName = indicators[i].getAttribute(attributeName); | 1433 var propName = indicators[i].getAttribute(attributeName); |
1432 if (!propName) | 1434 if (!propName) |
1433 continue; | 1435 continue; |
1434 var propValue = managed ? | 1436 var propValue = managed ? |
1435 onc.getManagedProperty(propName) : | 1437 onc.getManagedProperty(propName) : |
1436 onc.getActiveValue(propName); | 1438 onc.getActiveValue(propName); |
1437 if (propValue == undefined) | 1439 if (propValue == undefined) |
1438 continue; | 1440 continue; |
1441 propValue = assertInstanceof(propValue, Object); | |
1439 var event; | 1442 var event; |
1440 if (managed) | 1443 if (managed) |
1441 event = detailsPage.createManagedEvent_(propName, propValue); | 1444 event = detailsPage.createManagedEvent_(propName, propValue); |
1442 else | 1445 else |
1443 event = detailsPage.createControlledEvent_(propName, propValue); | 1446 event = detailsPage.createControlledEvent_(propName, propValue); |
1444 indicators[i].handlePrefChange(event); | 1447 indicators[i].handlePrefChange(event); |
1445 var forElement = $(indicators[i].getAttribute('for')); | 1448 var forElement = $(indicators[i].getAttribute('for')); |
1446 if (forElement) { | 1449 if (forElement) { |
1447 if (event.value.controlledBy == 'policy') | 1450 if (event.value.controlledBy == 'policy') |
1448 forElement.disabled = true; | 1451 forElement.disabled = true; |
1449 if (forElement.resetHandler) | 1452 if (forElement.resetHandler) |
1450 indicators[i].resetHandler = forElement.resetHandler; | 1453 indicators[i].resetHandler = forElement.resetHandler; |
1451 } | 1454 } |
1452 } | 1455 } |
1453 | 1456 |
1454 detailsPage.updateControls(); | 1457 detailsPage.updateControls(); |
1455 | 1458 |
1456 // Don't show page name in address bar and in history to prevent people | 1459 // Don't show page name in address bar and in history to prevent people |
1457 // navigate here by hand and solve issue with page session restore. | 1460 // navigate here by hand and solve issue with page session restore. |
1458 PageManager.showPageByName('detailsInternetPage', false); | 1461 PageManager.showPageByName('detailsInternetPage', false); |
1459 }; | 1462 }; |
1460 | 1463 |
1461 return { | 1464 return { |
1462 DetailsInternetPage: DetailsInternetPage | 1465 DetailsInternetPage: DetailsInternetPage |
1463 }; | 1466 }; |
1464 }); | 1467 }); |
OLD | NEW |