Commit 3a9467fd authored by Steven Bennetts's avatar Steven Bennetts Committed by Commit Bot

Use mojo api in internet-known-networks-page

This replaces networkingPrivate calls for everything except
setProperties and forgetNetwork (neither of which have been migrated
to mojo yet).

Bug: 853953
Change-Id: I7f0ddbf180dad6a79a282b38a721e795ed0976d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1717747
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682349}
parent faf64570
...@@ -84,7 +84,7 @@ js_library("internet_known_networks_page") { ...@@ -84,7 +84,7 @@ js_library("internet_known_networks_page") {
"//ui/webui/resources/cr_elements/chromeos/network:cr_network_listener_behavior", "//ui/webui/resources/cr_elements/chromeos/network:cr_network_listener_behavior",
"//ui/webui/resources/cr_elements/chromeos/network:cr_onc_types", "//ui/webui/resources/cr_elements/chromeos/network:cr_onc_types",
"//ui/webui/resources/cr_elements/cr_action_menu:cr_action_menu", "//ui/webui/resources/cr_elements/cr_action_menu:cr_action_menu",
"//ui/webui/resources/cr_elements/policy:cr_policy_network_behavior", "//ui/webui/resources/cr_elements/policy:cr_policy_network_behavior_mojo",
"//ui/webui/resources/js:assert", "//ui/webui/resources/js:assert",
] ]
externs_list = [ "$externs_path/networking_private.js" ] externs_list = [ "$externs_path/networking_private.js" ]
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html"> <link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html">
<link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html"> <link rel="import" href="chrome://resources/cr_elements/cr_link_row/cr_link_row.html">
<link rel="import" href="chrome://resources/cr_elements/icons.html"> <link rel="import" href="chrome://resources/cr_elements/icons.html">
<link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_network_behavior.html"> <link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_network_behavior_mojo.html">
<link rel="import" href="../settings_shared_css.html"> <link rel="import" href="../settings_shared_css.html">
<dom-module id="settings-internet-known-networks-page"> <dom-module id="settings-internet-known-networks-page">
...@@ -38,8 +38,7 @@ ...@@ -38,8 +38,7 @@
on-click="fireShowDetails_"> on-click="fireShowDetails_">
<template is="dom-if" if="[[isPolicySourceMojo(item.source))]]"> <template is="dom-if" if="[[isPolicySourceMojo(item.source))]]">
<cr-policy-indicator on-click="doNothing_" <cr-policy-indicator on-click="doNothing_"
indicator-type="[[getIndicatorTypeForSourceMojo( indicator-type="[[getIndicatorTypeForSource(item.source)]]">
item.source)]]">
</cr-policy-indicator> </cr-policy-indicator>
</template> </template>
</cr-link-row> </cr-link-row>
...@@ -63,8 +62,7 @@ ...@@ -63,8 +62,7 @@
on-click="fireShowDetails_"> on-click="fireShowDetails_">
<template is="dom-if" if="[[isPolicySourceMojo(item.source))]]"> <template is="dom-if" if="[[isPolicySourceMojo(item.source))]]">
<cr-policy-indicator on-click="doNothing_" <cr-policy-indicator on-click="doNothing_"
indicator-type="[[getIndicatorTypeForSourceMojo( indicator-type="[[getIndicatorTypeForSource(item.source)]]">
item.source)]]">
</cr-policy-indicator> </cr-policy-indicator>
</template> </template>
</cr-link-row> </cr-link-row>
......
...@@ -12,7 +12,7 @@ Polymer({ ...@@ -12,7 +12,7 @@ Polymer({
behaviors: [ behaviors: [
CrNetworkListenerBehavior, CrNetworkListenerBehavior,
CrPolicyNetworkBehavior, CrPolicyNetworkBehaviorMojo,
], ],
properties: { properties: {
...@@ -162,14 +162,15 @@ Polymer({ ...@@ -162,14 +162,15 @@ Polymer({
// We need to make a round trip to Chrome in order to retrieve the managed // We need to make a round trip to Chrome in order to retrieve the managed
// properties for the network. The delay is not noticeable (~5ms) and is // properties for the network. The delay is not noticeable (~5ms) and is
// preferable to initiating a query for every known network at load time. // preferable to initiating a query for every known network at load time.
this.networkingPrivate.getManagedProperties( this.networkConfigProxy_.getManagedProperties(this.selectedGuid_)
this.selectedGuid_, properties => { .then(response => {
if (chrome.runtime.lastError || !properties) { const properties = response.result;
console.error( if (!properties) {
'Unexpected error: ' + chrome.runtime.lastError.message); console.error('Properties not found for: ' + this.selectedGuid_);
return; return;
} }
if (this.isNetworkPolicyEnforced(properties.Priority)) { if (properties.priority &&
this.isNetworkPolicyEnforced(properties.priority)) {
this.showAddPreferred_ = false; this.showAddPreferred_ = false;
this.showRemovePreferred_ = false; this.showRemovePreferred_ = false;
} else { } else {
...@@ -177,7 +178,7 @@ Polymer({ ...@@ -177,7 +178,7 @@ Polymer({
this.showAddPreferred_ = !preferred; this.showAddPreferred_ = !preferred;
this.showRemovePreferred_ = preferred; this.showRemovePreferred_ = preferred;
} }
this.enableForget_ = !this.isPolicySource(properties.Source); this.enableForget_ = !this.isPolicySource(networkState.source);
/** @type {!CrActionMenuElement} */ (this.$.dotsMenu) /** @type {!CrActionMenuElement} */ (this.$.dotsMenu)
.showAt(/** @type {!Element} */ (button)); .showAt(/** @type {!Element} */ (button));
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment