Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2902)

Unified Diff: chrome/browser/resources/options/chromeos/internet_detail.js

Issue 561073002: Use ONC carrier info in JS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_279351_internet_options_10a
Patch Set: Rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 267e32ffef511f9e980074ea034518c891fde8d1..5822463f4cb4fc6374c33cd82ac3944a6064732a 100644
--- a/chrome/browser/resources/options/chromeos/internet_detail.js
+++ b/chrome/browser/resources/options/chromeos/internet_detail.js
@@ -15,8 +15,6 @@
* InternetDetailedInfo argument passed to showDetailedInfo.
* @see chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
* @typedef {{
- * carriers: (Array.<string>|undefined),
- * currentCarrierIndex: (number|undefined),
* deviceConnected: (boolean|undefined),
* errorMessage: (string|undefined),
* servicePath: string,
@@ -33,6 +31,7 @@ cr.define('options.internet', function() {
/** @const */ var IPAddressField = options.internet.IPAddressField;
/** @const */ var GoogleNameServersString = '8.8.4.4,8.8.8.8';
+ /** @const */ var CarrierGenericUMTS = 'Generic UMTS';
/**
* Helper function to set hidden attribute for elements matching a selector.
@@ -1356,19 +1355,35 @@ cr.define('options.internet', function() {
$('wimax-signal-strength').textContent = strengthString;
} else if (type == 'Cellular') {
OptionsPage.showTab($('cellular-conn-nav-tab'));
- if (data.showCarrierSelect && data.currentCarrierIndex != -1) {
- var carrierSelector = $('select-carrier');
- carrierSelector.onchange = DetailsInternetPage.handleCarrierChanged;
- carrierSelector.options.length = 0;
- for (var i = 0; i < data.carriers.length; ++i) {
- var option = document.createElement('option');
- option.textContent = data.carriers[i];
- carrierSelector.add(option);
+
+ var isGsm = onc.getActiveValue('Cellular.Family') == 'GSM';
+
+ var currentCarrierIndex = -1;
+ if (data.showCarrierSelect) {
+ var currentCarrier =
+ isGsm ? CarrierGenericUMTS : onc.getActiveValue('Cellular.Carrier');
+ var supportedCarriers =
+ onc.getActiveValue('Cellular.SupportedCarriers');
+ for (var c1 = 0; c1 < supportedCarriers.length; ++c1) {
+ if (supportedCarriers[c1] == currentCarrier) {
+ currentCarrierIndex = c1;
+ break;
+ }
+ }
+ if (currentCarrierIndex != -1) {
+ var carrierSelector = $('select-carrier');
+ carrierSelector.onchange = DetailsInternetPage.handleCarrierChanged;
+ carrierSelector.options.length = 0;
+ for (var c2 = 0; c2 < supportedCarriers.length; ++c2) {
+ var option = document.createElement('option');
+ option.textContent = supportedCarriers[c2];
+ carrierSelector.add(option);
+ }
+ carrierSelector.selectedIndex = currentCarrierIndex;
}
- carrierSelector.selectedIndex = data.currentCarrierIndex;
- } else {
- $('service-name').textContent = networkName;
}
+ if (currentCarrierIndex == -1)
+ $('service-name').textContent = networkName;
$('network-technology').textContent =
onc.getActiveValue('Cellular.NetworkTechnology');
@@ -1411,7 +1426,7 @@ cr.define('options.internet', function() {
setOrHideParent('min', onc.getActiveValue('Cellular.MIN'));
setOrHideParent('prl-version', onc.getActiveValue('Cellular.PRLVersion'));
- if (onc.getActiveValue('Cellular.Family') == 'GSM') {
+ if (isGsm) {
$('iccid').textContent = onc.getActiveValue('Cellular.ICCID');
$('imsi').textContent = onc.getActiveValue('Cellular.IMSI');
detailsPage.initializeApnList_();
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698