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

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

Issue 673313003: More changes to make network settings better match extension API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Append -> Add Created 6 years, 2 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/resources/options/chromeos/network_list.js » ('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 2ca8f596f1d2c6c7a7f8d3371b19f67fd8d26ab0..ed08b6c458f5f8689b7a31d38fa213f669ab3e7d 100644
--- a/chrome/browser/resources/options/chromeos/internet_detail.js
+++ b/chrome/browser/resources/options/chromeos/internet_detail.js
@@ -20,17 +20,6 @@
*/
var IPInfo;
-/**
- * InternetDetailedInfo argument passed to showDetailedInfo.
- * @see chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc
- * @typedef {{
- * servicePath: string,
- * showCarrierSelect: (boolean|undefined),
- * showViewAccountButton: (boolean|undefined)
- * }}
- */
-var InternetDetailedInfo;
-
cr.define('options.internet', function() {
var OncData = cr.onc.OncData;
var Page = cr.ui.pageManager.Page;
@@ -108,7 +97,7 @@ cr.define('options.internet', function() {
function sendCheckedIfEnabled(path, message, checkboxId, opt_action) {
var checkbox = assertInstanceof($(checkboxId), HTMLInputElement);
if (!checkbox.hidden && !checkbox.disabled) {
- chrome.send(message, [path, checkbox.checked ? 'true' : 'false']);
+ chrome.send(message, [path, !!checkbox.checked]);
if (opt_action)
sendChromeMetricsAction(opt_action);
}
@@ -179,10 +168,6 @@ cr.define('options.internet', function() {
// We show the Proxy configuration tab for remembered networks and when
// configuring a proxy from the login screen.
this.showProxy_ = false;
- // In Chrome we sometimes want to enable the Cellular carrier select UI.
- this.showCarrierSelect_ = false;
- // In Chrome we sometimes want to show the 'View Account' button.
- this.showViewAccountButton_ = false;
Page.call(this, 'detailsInternetPage', '', 'details-internet-page');
}
@@ -207,8 +192,9 @@ cr.define('options.internet', function() {
var servicePath = parseQueryParams(window.location).servicePath;
if (!servicePath || !servicePath.length)
return;
- var networkType = ''; // ignored for 'showDetails'
- chrome.send('networkCommand', [networkType, servicePath, 'showDetails']);
+ // TODO(stevenjb): chrome.networkingPrivate.getManagedProperties
+ // with initializeDetailsPage as the callback.
+ chrome.send('getManagedProperties', [servicePath]);
},
/**
@@ -476,7 +462,7 @@ cr.define('options.internet', function() {
*/
updateControls: function() {
// Note: onc may be undefined when called from a pref update before
- // initialized in sendNetworkDetails.
+ // initialized in initializeDetailsPage.
var onc = this.onc_;
// Always show the ipconfig section. TODO(stevenjb): Improve the display
@@ -644,7 +630,7 @@ cr.define('options.internet', function() {
},
/**
- * Helper method called from showDetailedInfo and updateConnectionData.
+ * Helper method called from initializeDetailsPage and updateConnectionData.
* Updates visibility/enabled of the login/disconnect/configure buttons.
* @private
*/
@@ -683,7 +669,7 @@ cr.define('options.internet', function() {
},
/**
- * Helper method called from showDetailedInfo and updateConnectionData.
+ * Helper method called from initializeDetailsPage and updateConnectionData.
* Updates the connection state property and account / sim card links.
* @private
*/
@@ -709,7 +695,7 @@ cr.define('options.internet', function() {
$('sim-card-lock-enabled').checked = lockEnabled;
$('change-pin').hidden = !lockEnabled;
}
- showViewAccount = this.showViewAccountButton_;
+ showViewAccount = onc.getActiveValue('showViewAccountButton');
var activationState = onc.getActiveValue('Cellular.ActivationState');
showActivate = activationState == 'NotActivated' ||
activationState == 'PartiallyActivated';
@@ -723,7 +709,7 @@ cr.define('options.internet', function() {
},
/**
- * Helper method called from showDetailedInfo and updateConnectionData.
+ * Helper method called from initializeDetailsPage and updateConnectionData.
* Updates the fields in the header section of the details frame.
* @private
*/
@@ -762,7 +748,8 @@ cr.define('options.internet', function() {
},
/**
- * Helper method called from showDetailedInfo to initialize the Apn list.
+ * Helper method called from initializeDetailsPage to initialize the Apn
+ * list.
* @private
*/
initializeApnList_: function() {
@@ -1076,16 +1063,14 @@ cr.define('options.internet', function() {
DetailsInternetPage.configureNetwork = function() {
var detailsPage = DetailsInternetPage.getInstance();
- chrome.send('networkCommand',
- [detailsPage.type_, detailsPage.servicePath_, 'configure']);
+ chrome.send('configureNetwork', [detailsPage.servicePath_]);
PageManager.closeOverlay();
};
DetailsInternetPage.activateFromDetails = function() {
var detailsPage = DetailsInternetPage.getInstance();
if (detailsPage.type_ == 'Cellular') {
- chrome.send('networkCommand',
- [detailsPage.type_, detailsPage.servicePath_, 'activate']);
+ chrome.send('activateNetwork', [detailsPage.servicePath_]);
}
PageManager.closeOverlay();
};
@@ -1177,29 +1162,6 @@ cr.define('options.internet', function() {
};
/**
- * Method called from Chrome with a dictionary of non ONC configuration
- * properties, including the HUID and service path to be used for requesting
- * the ONC properties. Note: currently GUID is only used to confirm that the
- * selected network still exists. It will be used instead of servicePath
- * once switching to the networkingPrivate API (see TODO below).
- * @param {InternetDetailedInfo} info
- */
- DetailsInternetPage.showDetailedInfo = function(info) {
- if (!('GUID' in info)) {
- // No network was found for, close the overlay.
- PageManager.closeOverlay();
- return;
- }
- var detailsPage = DetailsInternetPage.getInstance();
- detailsPage.servicePath_ = info.servicePath;
- detailsPage.showCarrierSelect_ = info.showCarrierSelect;
- detailsPage.showViewAccountButton_ = info.showViewAccountButton;
- // Ask Chrome to call sendNetworkDetails with the ONC properties.
- // TODO(stevenjb): Use networkingPrivate.getManagedProperties(info.guid).
- chrome.send('getManagedProperties', [info.servicePath]);
- };
-
- /**
* Method called from Chrome when the ONC properties for the displayed
* network may have changed.
* @param {Object} oncData The updated ONC dictionary for the network.
@@ -1221,14 +1183,25 @@ cr.define('options.internet', function() {
};
/**
- * Method called from Chrome when the initial dictionary of ONC configuration
- * properties is available.
+ * Method called from Chrome in response to getManagedProperties.
+ * We only use this when we want to call initializeDetailsPage.
+ * TODO(stevenjb): Eliminate when we switch to networkingPrivate
+ * (initializeDetailsPage will be provided as the callback).
+ * @param {Object} oncData Dictionary of ONC properties.
+ */
+ DetailsInternetPage.getManagedPropertiesResult = function(oncData) {
+ DetailsInternetPage.initializeDetailsPage(oncData);
+ };
+
+ /**
+ * Initializes the details page with the provided ONC data.
* @param {Object} oncData Dictionary of ONC properties.
*/
- DetailsInternetPage.sendNetworkDetails = function(oncData) {
+ DetailsInternetPage.initializeDetailsPage = function(oncData) {
var onc = new OncData(oncData);
var detailsPage = DetailsInternetPage.getInstance();
+ detailsPage.servicePath_ = oncData.servicePath;
detailsPage.onc_ = onc;
var type = onc.getActiveValue('Type');
detailsPage.type_ = type;
@@ -1474,7 +1447,7 @@ cr.define('options.internet', function() {
var isGsm = onc.getActiveValue('Cellular.Family') == 'GSM';
var currentCarrierIndex = -1;
- if (this.showCarrierSelect_) {
+ if (loadTimeData.getValue('showCarrierSelect')) {
var currentCarrier =
isGsm ? CarrierGenericUMTS : onc.getActiveValue('Cellular.Carrier');
var supportedCarriers =
« no previous file with comments | « no previous file | chrome/browser/resources/options/chromeos/network_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698