| 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 cr.define('options.internet', function() { | 5 cr.define('options.internet', function() { |
| 6 /** | 6 /** |
| 7 * Creates a new network list div. | 7 * Creates a new network list div. |
| 8 * @param {Object=} opt_propertyBag Optional properties. | 8 * @param {Object=} opt_propertyBag Optional properties. |
| 9 * @constructor | 9 * @constructor |
| 10 * @extends {HTMLDivElement} | 10 * @extends {HTMLDivElement} |
| 11 */ | 11 */ |
| 12 var CellularPlanElement = cr.ui.define('div'); | 12 var CellularPlanElement = cr.ui.define('div'); |
| 13 | 13 |
| 14 CellularPlanElement.prototype = { | 14 CellularPlanElement.prototype = { |
| 15 __proto__: HTMLDivElement.prototype, | 15 __proto__: HTMLDivElement.prototype, |
| 16 | 16 |
| 17 /** @inheritDoc */ | 17 /** @inheritDoc */ |
| 18 decorate: function() { | 18 decorate: function() { |
| 19 }, | 19 }, |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * Loads given network list. | 22 * Loads given network list. |
| 23 * @param {Array} networks An array of network object. | 23 * @param {Array} networks An array of network object. |
| 24 */ | 24 */ |
| 25 load: function(plans) { | 25 load: function(plans) { |
| 26 this.textContent = ''; | 26 this.textContent = ''; |
| 27 if (!plans || !plans.length) { | 27 if (!plans || !plans.length) { |
| 28 var noplansDiv = this.ownerDocument.createElement('div'); | 28 var noplansDiv = this.ownerDocument.createElement('div'); |
| 29 noplansDiv.textContent = localStrings.getString('noPlansFound'); | 29 noplansDiv.textContent = loadTimeData.getString('noPlansFound'); |
| 30 this.appendChild(detailsTable); | 30 this.appendChild(detailsTable); |
| 31 } else { | 31 } else { |
| 32 for (var i = 0; i < plans.length; ++i) { | 32 for (var i = 0; i < plans.length; ++i) { |
| 33 this.appendChild(new CellularPlanItem(i, plans[i])); | 33 this.appendChild(new CellularPlanItem(i, plans[i])); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 /** | 39 /** |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 __proto__: HTMLDivElement.prototype, | 71 __proto__: HTMLDivElement.prototype, |
| 72 | 72 |
| 73 /** @inheritDoc */ | 73 /** @inheritDoc */ |
| 74 decorate: function() { | 74 decorate: function() { |
| 75 this.className = 'cellular-plan'; | 75 this.className = 'cellular-plan'; |
| 76 var detailsTable = this.createTable_('details-plan-table', | 76 var detailsTable = this.createTable_('details-plan-table', |
| 77 'option-control-table'); | 77 'option-control-table'); |
| 78 this.addRow_(detailsTable, 'plan-details-info', | 78 this.addRow_(detailsTable, 'plan-details-info', |
| 79 'option-name', 'planSummary', this.data.planSummary); | 79 'option-name', 'planSummary', this.data.planSummary); |
| 80 this.addRow_(detailsTable, 'plan-details-info', | 80 this.addRow_(detailsTable, 'plan-details-info', |
| 81 'option-name', null, localStrings.getString('planName'), | 81 'option-name', null, loadTimeData.getString('planName'), |
| 82 'option-value', 'planName', this.data.name); | 82 'option-value', 'planName', this.data.name); |
| 83 this.addRow_(detailsTable, 'plan-details-info', | 83 this.addRow_(detailsTable, 'plan-details-info', |
| 84 'option-name', null, localStrings.getString('dataRemaining'), | 84 'option-name', null, loadTimeData.getString('dataRemaining'), |
| 85 'option-value', 'dataRemaining', this.data.dataRemaining); | 85 'option-value', 'dataRemaining', this.data.dataRemaining); |
| 86 this.addRow_(detailsTable, 'plan-details-info', | 86 this.addRow_(detailsTable, 'plan-details-info', |
| 87 'option-name', null, localStrings.getString('planExpires'), | 87 'option-name', null, loadTimeData.getString('planExpires'), |
| 88 'option-value', 'dataRemaining', this.data.planExpires); | 88 'option-value', 'dataRemaining', this.data.planExpires); |
| 89 if (this.data.warning && this.data.warning != '') { | 89 if (this.data.warning && this.data.warning != '') { |
| 90 this.addRow_(detailsTable, 'plan-details-info', | 90 this.addRow_(detailsTable, 'plan-details-info', |
| 91 'option-name', 'planWarning', this.data.warning); | 91 'option-name', 'planWarning', this.data.warning); |
| 92 } | 92 } |
| 93 this.appendChild(detailsTable); | 93 this.appendChild(detailsTable); |
| 94 this.appendChild(this.ownerDocument.createElement('hr')); | 94 this.appendChild(this.ownerDocument.createElement('hr')); |
| 95 }, | 95 }, |
| 96 | 96 |
| 97 createTable_: function(tableId, tableClass) { | 97 createTable_: function(tableId, tableClass) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 123 row.appendChild(col2); | 123 row.appendChild(col2); |
| 124 } | 124 } |
| 125 table.appendChild(row); | 125 table.appendChild(row); |
| 126 } | 126 } |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 return { | 129 return { |
| 130 CellularPlanElement: CellularPlanElement | 130 CellularPlanElement: CellularPlanElement |
| 131 }; | 131 }; |
| 132 }); | 132 }); |
| OLD | NEW |