summaryrefslogtreecommitdiff
path: root/chromium/ui/webui
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/webui')
-rw-r--r--chromium/ui/webui/resources/cr_components/chromeos/network/network_config.html29
-rw-r--r--chromium/ui/webui/resources/cr_components/chromeos/network/network_config.js101
-rw-r--r--chromium/ui/webui/resources/cr_components/chromeos/network/network_nameservers.html2
-rw-r--r--chromium/ui/webui/resources/cr_components/chromeos/network/network_nameservers.js8
-rw-r--r--chromium/ui/webui/resources/cr_elements/chromeos/network/compiled_resources2.gyp1
-rw-r--r--chromium/ui/webui/resources/cr_elements/chromeos/network/cr_onc_types.js9
6 files changed, 58 insertions, 92 deletions
diff --git a/chromium/ui/webui/resources/cr_components/chromeos/network/network_config.html b/chromium/ui/webui/resources/cr_components/chromeos/network/network_config.html
index 5902a64a662..a2ba57be7c2 100644
--- a/chromium/ui/webui/resources/cr_components/chromeos/network/network_config.html
+++ b/chromium/ui/webui/resources/cr_components/chromeos/network/network_config.html
@@ -1,6 +1,5 @@
<link rel="import" href="chrome://resources/html/polymer.html">
-<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_network_icon.html">
<link rel="import" href="chrome://resources/cr_elements/chromeos/network/cr_onc_types.html">
<link rel="import" href="chrome://resources/html/i18n_behavior.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-a11y-keys/iron-a11y-keys.html">
@@ -13,14 +12,6 @@
<dom-module id="network-config">
<template>
<style include="network-shared iron-flex">
- #error {
- color: red;
- font-weight: 500;
- }
-
- cr-network-icon {
- -webkit-margin-end: 10px;
- }
</style>
<!-- SSID (WiFi) -->
@@ -167,26 +158,6 @@
</div>
</template>
- <template is="dom-if"
- if="[[connectingIsVisible_(propertiesSent_, error_)]]">
- <div class="property-box">
- <div class="start layout horizontal center">
- <cr-network-icon is-list-item
- network-state="[[getIconState_(configProperties_)]]">
- </cr-network-icon>
- <div>[[i18n('OncConnecting')]]</div>
- </div>
- </div>
- </template>
-
- <template is="dom-if" if="[[error_]]">
- <div class="property-box">
- <div id="error" class="start">
- [[getError_(error_)]]
- </div>
- </div>
- </template>
-
</template>
<script src="network_config.js"></script>
</dom-module>
diff --git a/chromium/ui/webui/resources/cr_components/chromeos/network/network_config.js b/chromium/ui/webui/resources/cr_components/chromeos/network/network_config.js
index 26c479f7e0b..74cdc9b049f 100644
--- a/chromium/ui/webui/resources/cr_components/chromeos/network/network_config.js
+++ b/chromium/ui/webui/resources/cr_components/chromeos/network/network_config.js
@@ -86,6 +86,12 @@ Polymer({
notify: true,
},
+ /** Set to any error from the last configuration result. */
+ error: {
+ type: String,
+ notify: true,
+ },
+
/** Set if |guid| is not empty once networkProperties are received. */
propertiesReceived_: Boolean,
@@ -219,9 +225,6 @@ Polymer({
value: null,
},
- /** @private */
- error_: String,
-
/**
* Object providing network type values for data binding. Note: Currently
* we only support WiFi, but support for other types will be following
@@ -343,37 +346,36 @@ Polymer({
this.guid = this.networkProperties.GUID;
this.type = this.networkProperties.Type;
if (this.guid) {
- this.networkingPrivate.getProperties(
- this.guid, this.getPropertiesCallback_.bind(this));
+ this.networkingPrivate.getProperties(this.guid, (properties) => {
+ this.getPropertiesCallback_(properties);
+ this.focusFirstInput_();
+ });
+ } else {
+ this.async(() => {
+ this.focusFirstInput_();
+ });
}
this.onCertificateListsChanged_();
this.updateIsConfigured_();
this.setShareNetwork_();
- requestAnimationFrame(() => {
- var e = this.$$(
- 'network-config-input:not([disabled]),' +
- 'network-config-select:not([disabled])');
- if (e)
- e.focus();
- });
},
saveOrConnect: function() {
if (this.propertiesSent_)
return;
this.propertiesSent_ = true;
- this.error_ = '';
+ this.error = '';
var propertiesToSet = this.getPropertiesToSet_();
if (this.getSource_() == CrOnc.Source.NONE) {
- // New non VPN network configurations default to 'AutoConnect' unless
- // prohibited by policy.
- var prohibitAutoConnect = this.globalPolicy &&
- this.globalPolicy.AllowOnlyPolicyNetworksToConnect;
- CrOnc.setTypeProperty(
- propertiesToSet, 'AutoConnect',
- this.type != CrOnc.Type.VPN && !prohibitAutoConnect);
-
+ // Set 'AutoConnect' to false for VPN or if prohibited by policy.
+ // Note: Do not set AutoConnect to true, the connection manager will do
+ // that on a successful connection (unless set to false here).
+ if (this.type == CrOnc.Type.VPN ||
+ (this.globalPolicy &&
+ this.globalPolicy.AllowOnlyPolicyNetworksToConnect)) {
+ CrOnc.setTypeProperty(propertiesToSet, 'AutoConnect', false);
+ }
// Create the configuration, then connect to it in the callback.
this.networkingPrivate.createNetwork(
this.shareNetwork_, propertiesToSet,
@@ -386,6 +388,16 @@ Polymer({
},
/** @private */
+ focusFirstInput_: function() {
+ Polymer.dom.flush();
+ var e = this.$$(
+ 'network-config-input:not([disabled]),' +
+ 'network-config-select:not([disabled])');
+ if (e)
+ e.focus();
+ },
+
+ /** @private */
connectIfConfigured_: function() {
if (!this.isConfigured_)
return;
@@ -893,7 +905,7 @@ Polymer({
/** @private */
updateCertError_: function() {
/** @const */ var certError = 'networkErrorNoUserCertificate';
- if (this.error_ && this.error_ != certError)
+ if (this.error && this.error != certError)
return;
var requireCerts = (this.showEap_ && this.showEap_.UserCert) ||
@@ -1029,14 +1041,6 @@ Polymer({
* @return {boolean}
* @private
*/
- connectingIsVisible_: function() {
- return this.propertiesSent_ && !this.error_;
- },
-
- /**
- * @return {boolean}
- * @private
- */
shareIsEnabled_: function() {
if (!this.shareAllowEnable || this.getSource_() != CrOnc.Source.NONE)
return false;
@@ -1202,8 +1206,8 @@ Polymer({
/** @private */
setPropertiesCallback_: function() {
this.setError_(this.getRuntimeError_());
- if (this.error_) {
- console.error('setProperties error: ' + this.guid + ': ' + this.error_);
+ if (this.error) {
+ console.error('setProperties error: ' + this.guid + ': ' + this.error);
this.propertiesSent_ = false;
return;
}
@@ -1223,10 +1227,10 @@ Polymer({
*/
createNetworkCallback_: function(guid) {
this.setError_(this.getRuntimeError_());
- if (this.error_) {
+ if (this.error) {
console.error(
'createNetworkError, type: ' + this.networkProperties.Type + ': ' +
- 'error: ' + this.error_);
+ 'error: ' + this.error);
this.propertiesSent_ = false;
return;
}
@@ -1278,38 +1282,11 @@ Polymer({
},
/**
- * @param {!chrome.networkingPrivate.NetworkConfigProperties} properties
- * @return {!CrOnc.NetworkStateProperties}
- * @private
- */
- getIconState_: function(properties) {
- return {
- ConnectionState: CrOnc.ConnectionState.CONNECTING,
- GUID: properties.GUID || '',
- Type: this.type,
- };
- },
-
- /**
* @param {string|undefined} error
* @private
*/
setError_: function(error) {
- if (!error) {
- this.error_ = '';
- return;
- }
- this.error_ = error;
+ this.error = error || '';
},
-
- /**
- * @return {string}
- * @private
- */
- getError_: function() {
- if (this.i18nExists(this.error_))
- return this.i18n(this.error_);
- return this.i18n('networkErrorUnknown');
- }
});
})();
diff --git a/chromium/ui/webui/resources/cr_components/chromeos/network/network_nameservers.html b/chromium/ui/webui/resources/cr_components/chromeos/network/network_nameservers.html
index 7cf53bad009..0f8bc18aa14 100644
--- a/chromium/ui/webui/resources/cr_components/chromeos/network/network_nameservers.html
+++ b/chromium/ui/webui/resources/cr_components/chromeos/network/network_nameservers.html
@@ -69,7 +69,7 @@
<template is="dom-if"
if="[[i18nExists('networkGoogleNameserversLearnMoreUrl')]]">
<a href="[[i18n('networkGoogleNameserversLearnMoreUrl')]]"
- target="_blank">
+ target="_blank" on-tap="doNothing_">
[[i18n('networkNameserversLearnMore')]]
</a>
</template>
diff --git a/chromium/ui/webui/resources/cr_components/chromeos/network/network_nameservers.js b/chromium/ui/webui/resources/cr_components/chromeos/network/network_nameservers.js
index b9e9cf47da5..c59320d6aaa 100644
--- a/chromium/ui/webui/resources/cr_components/chromeos/network/network_nameservers.js
+++ b/chromium/ui/webui/resources/cr_components/chromeos/network/network_nameservers.js
@@ -238,4 +238,12 @@ Polymer({
clearEmptyNameServers_: function(nameservers) {
return nameservers.filter((nameserver) => !!nameserver);
},
+
+ /**
+ * @param {!Event} event
+ * @private
+ */
+ doNothing_: function(event) {
+ event.stopPropagation();
+ },
});
diff --git a/chromium/ui/webui/resources/cr_elements/chromeos/network/compiled_resources2.gyp b/chromium/ui/webui/resources/cr_elements/chromeos/network/compiled_resources2.gyp
index d7600a57f6e..d4b76454dc0 100644
--- a/chromium/ui/webui/resources/cr_elements/chromeos/network/compiled_resources2.gyp
+++ b/chromium/ui/webui/resources/cr_elements/chromeos/network/compiled_resources2.gyp
@@ -54,6 +54,7 @@
{
'target_name': 'cr_onc_types',
'dependencies': [
+ '<(DEPTH)/ui/webui/resources/js/compiled_resources2.gyp:util',
'<(EXTERNS_GYP):networking_private',
],
'includes': ['../../../../../../third_party/closure_compiler/compile_js2.gypi'],
diff --git a/chromium/ui/webui/resources/cr_elements/chromeos/network/cr_onc_types.js b/chromium/ui/webui/resources/cr_elements/chromeos/network/cr_onc_types.js
index 9a2d13ef567..5a7ed921c7b 100644
--- a/chromium/ui/webui/resources/cr_elements/chromeos/network/cr_onc_types.js
+++ b/chromium/ui/webui/resources/cr_elements/chromeos/network/cr_onc_types.js
@@ -424,6 +424,15 @@ CrOnc.getNetworkName = function(properties) {
/**
* @param {!CrOnc.NetworkProperties|!CrOnc.NetworkStateProperties|undefined}
+ * properties The ONC network properties or state properties.
+ * @return {string} The name to display for |network|.
+ */
+CrOnc.getEscapedNetworkName = function(properties) {
+ return HTMLEscape(CrOnc.getNetworkName(properties));
+};
+
+/**
+ * @param {!CrOnc.NetworkProperties|!CrOnc.NetworkStateProperties|undefined}
* properties The ONC network properties or state properties.
* @return {boolean} True if |properties| is a Cellular network with a
* locked SIM.