Chromium Code Reviews| Index: chrome/browser/resources/options/chromeos/internet_detail.js |
| diff --git a/chrome/browser/resources/options/chromeos/internet_detail.js b/chrome/browser/resources/options/chromeos/internet_detail.js |
| index fa7c86252f8ac9d98a6dffd3f3984989da91c768..80ce8ed0c713d185d2ec585ad09d1a7f93359924 100644 |
| --- a/chrome/browser/resources/options/chromeos/internet_detail.js |
| +++ b/chrome/browser/resources/options/chromeos/internet_detail.js |
| @@ -34,6 +34,20 @@ cr.define('options.internet', function() { |
| } |
| } |
| + /* |
| + * Helper function to update the properties of the data object from the |
| + * properties in the update object. |
| + * @param {object} data object to update. |
| + * @param {object} object containing the updated properties. |
| + */ |
| + function updateDataObject(data, update) { |
| + for (prop in update) { |
| + if (prop in data) { |
|
Evan Stade
2013/01/09 23:24:08
no curlies
rkc
2013/01/09 23:34:35
Done.
|
| + data[prop] = update[prop]; |
| + } |
| + } |
| + } |
| + |
| /** |
| * Monitor pref change of given element. |
| * @param {Element} el Target element. |
| @@ -492,7 +506,6 @@ cr.define('options.internet', function() { |
| chrome.send('setCarrier', [data.servicePath, carrier]); |
| }; |
| - |
| /** |
| * Performs minimal initialization of the InternetDetails dialog in |
| * preparation for showing proxy-setttings. |
| @@ -682,6 +695,48 @@ cr.define('options.internet', function() { |
| } |
| }; |
| + DetailsInternetPage.updateConnectionData = function(update) { |
| + var detailsPage = DetailsInternetPage.getInstance(); |
| + if (!detailsPage.visible) |
| + return; |
| + |
| + var data = $('connection-state').data; |
| + if (!data) |
| + return; |
| + |
| + // Update our cached data object. |
| + updateDataObject(data, update); |
| + |
| + detailsPage.deviceConnected = data.deviceConnected; |
| + detailsPage.connecting = data.connecting; |
| + detailsPage.connected = data.connected; |
| + $('connection-state').textContent = data.connectionState; |
| + |
| + $('details-internet-login').hidden = data.connected; |
| + $('details-internet-login').disabled = data.disableConnectButton; |
| + |
| + if (data.type == Constants.TYPE_WIFI) { |
| + $('wifi-connection-state').textContent = data.connectionState; |
| + } else if (data.type == Constants.TYPE_WIMAX) { |
| + $('wimax-connection-state').textContent = data.connectionState; |
| + } else if (data.type == Constants.TYPE_CELLULAR) { |
| + $('activation-state').textContent = data.activationState; |
| + |
| + $('buyplan-details').hidden = !data.showBuyButton; |
| + $('view-account-details').hidden = !data.showViewAccountButton; |
| + |
| + $('activate-details').hidden = !data.showActivateButton; |
| + if (data.showActivateButton) { |
|
Evan Stade
2013/01/09 23:24:08
no curlies
rkc
2013/01/09 23:34:35
Done.
|
| + $('details-internet-login').hidden = true; |
| + } |
| + } |
| + |
| + if (data.type != Constants.TYPE_ETHERNET) |
| + $('details-internet-disconnect').hidden = !data.connected; |
| + |
| + $('connection-state').data = data; |
| + } |
| + |
| DetailsInternetPage.showDetailedInfo = function(data) { |
| var detailsPage = DetailsInternetPage.getInstance(); |
| @@ -728,6 +783,7 @@ cr.define('options.internet', function() { |
| $('activate-details').hidden = true; |
| $('view-account-details').hidden = true; |
| $('details-internet-login').hidden = data.connected; |
| + $('details-internet-login').disabled = data.disableConnectButton; |
| if (data.type == Constants.TYPE_ETHERNET) |
| $('details-internet-disconnect').hidden = true; |
| else |