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 f4be041bb13e1411797b59a9d5d7ed12ebfb6ed5..5ce5a5e69237d16b6131239e13f58f4b9c4863a1 100644 |
--- a/chrome/browser/resources/options/chromeos/internet_detail.js |
+++ b/chrome/browser/resources/options/chromeos/internet_detail.js |
@@ -9,6 +9,24 @@ |
// networkingPrivate API. See network_config.js. |
// See crbug.com/279351 for more info. |
+/** @typedef {{activationState: (string|undefined), |
+ * carriers: Array, |
+ * currentCarrierIndex; (number|undefined), |
+ * ipAutoConfig: boolean, |
+ * ipconfig: Object, |
+ * nameServerType: string, |
+ * restrictedPool: (string|undefined), |
+ * roamingState: (string|undefined), |
+ * savedIP: Object, |
+ * showActivateButton: (boolean|undefined) |
+ * showViewAccountButton: (boolean|undefined), |
+ * staticIP: Object}} |
+ * Only the keys which had caused problems are declared in this typedef. |
+ * There are many more of them. |
+ * @see chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc |
+ */ |
+var InternetDetailedInfo; |
+ |
cr.define('options.internet', function() { |
var Page = cr.ui.pageManager.Page; |
var PageManager = cr.ui.pageManager.PageManager; |
@@ -25,22 +43,22 @@ cr.define('options.internet', function() { |
* Gets the value of a property from a dictionary |data| that includes ONC |
* managed properties, e.g. getManagedValue(data, 'Name'). See notes for |
* getManagedProperty. |
- * @param {object} data The properties dictionary. |
+ * @param {Object} data The properties dictionary. |
* @param {string} key The property key. |
- * @param {string} type (Optional) The type of property to get as defined in |
+ * @param {string=} opt_type The type of property to get as defined in |
* GetManagedTypes: |
* 'ACTIVE' (default) - gets the active value |
* 'TRANSLATED' - gets the traslated or active value |
* 'RECOMMENDED' - gets the recommended value |
* @return {*} The property value or undefined. |
*/ |
- function getManagedValue(data, key, type) { |
+ function getManagedValue(data, key, opt_type) { |
var property = getManagedProperty(data, key); |
if (Array.isArray(property) || typeof property != 'object') |
return property; |
- if (type == GetManagedTypes.RECOMMENDED) |
+ if (opt_type == GetManagedTypes.RECOMMENDED) |
return getRecommendedValue(property); |
- if (type == GetManagedTypes.TRANSLATED && 'Translated' in property) |
+ if (opt_type == GetManagedTypes.TRANSLATED && 'Translated' in property) |
return property['Translated']; |
// Otherwise get the Active value (defalt behavior). |
if ('Active' in property) |
@@ -55,7 +73,7 @@ cr.define('options.internet', function() { |
/** |
* Get the recommended value from a Managed property ONC dictionary. |
- * @param {object} property The managed property ONC dictionary. |
+ * @param {Object} property The managed property ONC dictionary. |
* @return {*} the effective value or undefined. |
*/ |
function getRecommendedValue(property) { |
@@ -69,7 +87,7 @@ cr.define('options.internet', function() { |
/** |
* Get the effective value from a Managed property ONC dictionary. |
- * @param {object} property The managed property ONC dictionary. |
+ * @param {Object} property The managed property ONC dictionary. |
* @return {*} The effective value or undefined. |
*/ |
function getEffectiveValue(property) { |
@@ -85,7 +103,7 @@ cr.define('options.internet', function() { |
* Gets either a managed property dictionary or an unmanaged value from |
* dictionary |data| that includes ONC managed properties. This supports |
* nested dictionaries, e.g. getManagedProperty(data, 'VPN.Type'). |
- * @param {object} data The properties dictionary. |
+ * @param {Object} data The properties dictionary. |
* @param {string} key The property key. |
* @return {*} The property value or dictionary if it exists, otherwise |
* undefined. |
@@ -108,9 +126,9 @@ cr.define('options.internet', function() { |
* Set the value of a property in dictionary |data| that includes ONC |
* managed properties, e.g. setManagedValue(data, 'Name', 'MyNetwork'). |
* See notes for getManagedProperty. |
- * @param {object} data The properties dictionary. |
+ * @param {Object} data The properties dictionary. |
* @param {string} key The property key. |
- * @param {string} value The property value to set. |
+ * @param {*} value The property value to set. |
*/ |
function setManagedProperty(data, key, value) { |
while (true) { |
@@ -141,7 +159,7 @@ cr.define('options.internet', function() { |
/** |
* Helper function to set hidden attribute for elements matching a selector. |
* @param {string} selector CSS selector for extracting a list of elements. |
- * @param {bool} hidden New hidden value. |
+ * @param {boolean} hidden New hidden value. |
*/ |
function updateHidden(selector, hidden) { |
var elements = cr.doc.querySelectorAll(selector); |
@@ -182,7 +200,7 @@ cr.define('options.internet', function() { |
/** |
* Simple helper method for converting a field to a string. It is used to |
* easily assign an empty string from fields that may be unknown or undefined. |
- * @param {object} value that should be converted to a string. |
+ * @param {Object} value that should be converted to a string. |
* @return {string} the result. |
*/ |
function stringFromValue(value) { |
@@ -230,9 +248,10 @@ cr.define('options.internet', function() { |
/** |
* Encapsulated handling of ChromeOS internet details overlay page. |
* @constructor |
+ * @extends {cr.ui.pageManager.Page} |
*/ |
function DetailsInternetPage() { |
- Page.call(this, 'detailsInternetPage', null, 'details-internet-page'); |
+ Page.call(this, 'detailsInternetPage', '', 'details-internet-page'); |
} |
cr.addSingletonGetter(DetailsInternetPage); |
@@ -244,7 +263,7 @@ cr.define('options.internet', function() { |
initializePage: function() { |
Page.prototype.initializePage.call(this); |
var params = parseQueryParams(window.location); |
Dan Beam
2014/09/06 02:22:36
^ can you just put this into showNetworkDetails_ n
Vitaly Pavlenko
2014/09/06 22:54:08
Done.
Dan Beam
2014/09/09 02:59:09
i meant call parseQueryParams() inside showNetwork
Vitaly Pavlenko
2014/09/09 17:54:51
Done.
|
- this.initializePageContents_(params); |
+ this.initializePageContents_(); |
this.showNetworkDetails_(params); |
}, |
@@ -263,7 +282,7 @@ cr.define('options.internet', function() { |
/** |
* Initializes the contents of the page. |
*/ |
- initializePageContents_: function(params) { |
+ initializePageContents_: function() { |
$('details-internet-dismiss').addEventListener('click', function(event) { |
DetailsInternetPage.setDetails(); |
}); |
@@ -310,7 +329,7 @@ cr.define('options.internet', function() { |
data.userApnIndex = -1; |
} |
- var activeApn; |
+ var activeApn = {}; |
Dan Beam
2014/09/06 02:22:36
did this work before?
Vitaly Pavlenko
2014/09/06 22:54:07
Yes, and I don't know how. Should I contact the co
Dan Beam
2014/09/09 02:59:09
stevenjb@ said he's fixing this
Vitaly Pavlenko
2014/09/09 17:54:51
Acknowledged.
|
var iApn = -1; |
var apnList = getManagedValue(data, 'Cellular.APNList'); |
if (apnList != undefined && apnList.length > 0) { |
@@ -678,9 +697,9 @@ cr.define('options.internet', function() { |
* Handler for when the user clicks on the checkbox to allow a |
* single proxy usage. |
* @private |
- * @param {Event} e Click Event. |
+ * @param {Event=} opt_e Click event. |
*/ |
- toggleSingleProxy_: function(e) { |
+ toggleSingleProxy_: function(opt_e) { |
if ($('proxy-all-protocols').checked) { |
$('multi-proxy').hidden = true; |
$('single-proxy').hidden = false; |
@@ -694,9 +713,9 @@ cr.define('options.internet', function() { |
* Handler for when the user clicks on the checkbox to enter |
* auto configuration URL. |
* @private |
- * @param {Event} e Click Event. |
+ * @param {Event=} opt_e Click Event. |
*/ |
- handleAutoConfigProxy_: function(e) { |
+ handleAutoConfigProxy_: function(opt_e) { |
Dan Beam
2014/09/06 02:22:36
can you just make these methods not take a paramet
Vitaly Pavlenko
2014/09/06 22:54:08
Done.
|
$('proxy-pac-url').disabled = !$('proxy-use-pac-url').checked; |
}, |
@@ -704,9 +723,9 @@ cr.define('options.internet', function() { |
* Handler for selecting a radio button that will disable the manual |
* controls. |
* @private |
- * @param {Event} e Click event. |
+ * @param {Event=} opt_e Click event. |
*/ |
- disableManualProxy_: function(e) { |
+ disableManualProxy_: function(opt_e) { |
$('ignored-host-list').disabled = true; |
$('new-host').disabled = true; |
$('remove-host').disabled = true; |
@@ -736,9 +755,9 @@ cr.define('options.internet', function() { |
* Handler for selecting a radio button that will enable the manual |
* controls. |
* @private |
- * @param {Event} e Click event. |
+ * @param {Event=} opt_e Click event. |
*/ |
- enableManualProxy_: function(e) { |
+ enableManualProxy_: function(opt_e) { |
$('ignored-host-list').redraw(); |
var allDisabled = $('manual-proxy').disabled; |
$('ignored-host-list').disabled = allDisabled; |
@@ -911,21 +930,21 @@ cr.define('options.internet', function() { |
var servicePath = data.servicePath; |
if (data.type == 'WiFi') { |
sendCheckedIfEnabled(servicePath, 'setPreferNetwork', |
- $('prefer-network-wifi')); |
+ /** @type {HTMLInputElement} */($('prefer-network-wifi'))); |
Dan Beam
2014/09/06 02:22:36
assertInstanceof, IMO
Vitaly Pavlenko
2014/09/06 22:54:08
Done.
|
sendCheckedIfEnabled(servicePath, 'setAutoConnect', |
- $('auto-connect-network-wifi')); |
+ /** @type {HTMLInputElement} */($('auto-connect-network-wifi'))); |
} else if (data.type == 'Wimax') { |
sendCheckedIfEnabled(servicePath, 'setAutoConnect', |
- $('auto-connect-network-wimax')); |
+ /** @type {HTMLInputElement} */($('auto-connect-network-wimax'))); |
} else if (data.type == 'Cellular') { |
sendCheckedIfEnabled(servicePath, 'setAutoConnect', |
- $('auto-connect-network-cellular')); |
+ /** @type {HTMLInputElement} */($('auto-connect-network-cellular'))); |
} else if (data.type == 'VPN') { |
chrome.send('setServerHostname', |
[servicePath, |
$('inet-server-hostname').value]); |
sendCheckedIfEnabled(servicePath, 'setAutoConnect', |
- $('auto-connect-network-vpn')); |
+ /** @type {HTMLInputElement} */($('auto-connect-network-vpn'))); |
} |
var nameServerTypes = ['automatic', 'google', 'user']; |
@@ -1055,7 +1074,7 @@ cr.define('options.internet', function() { |
} else if (data.type == 'Cellular') { |
$('activation-state').textContent = data.activationState; |
- $('buyplan-details').hidden = !data.showBuyButton; |
+ $('buyplan-details').hidden = true; |
$('view-account-details').hidden = !data.showViewAccountButton; |
$('activate-details').hidden = !data.showActivateButton; |
@@ -1073,6 +1092,9 @@ cr.define('options.internet', function() { |
$('connection-state').data = data; |
}; |
+ /** |
+ * @param {InternetDetailedInfo} data |
+ */ |
DetailsInternetPage.showDetailedInfo = function(data) { |
var detailsPage = DetailsInternetPage.getInstance(); |
@@ -1423,7 +1445,7 @@ cr.define('options.internet', function() { |
getManagedValue(data, 'AutoConnect'); |
$('auto-connect-network-cellular').disabled = false; |
- $('buyplan-details').hidden = !data.showBuyButton; |
+ $('buyplan-details').hidden = true; |
Dan Beam
2014/09/06 02:22:36
it doesn't seem like this button is ever used (nor
Vitaly Pavlenko
2014/09/06 22:54:07
Do you know how can I open this internet_detail.ht
Dan Beam
2014/09/09 02:59:09
stevenjb@ is removing this, I think
Vitaly Pavlenko
2014/09/09 17:54:51
Acknowledged.
|
$('view-account-details').hidden = !data.showViewAccountButton; |
$('activate-details').hidden = !data.showActivateButton; |
if (data.showActivateButton) { |