Commit 72858c46 authored by Giovanni Ortuño Urquidi's avatar Giovanni Ortuño Urquidi Committed by Commit Bot

mojo: network-config: Use new bindings names for network config interface

Mojo JS Lite Bindings were recently renamed to align with the new C++
names. This CL changes usage of the old names with the new ones. See
bug for more details.

Bug: 968369
Change-Id: I83dd8b8a3275c06da10d6552fdce01b032f0692d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1722138Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#685424}
parent c8e3fb44
...@@ -64,9 +64,9 @@ const NetworkUI = (function() { ...@@ -64,9 +64,9 @@ const NetworkUI = (function() {
* This UI will use both the networkingPrivate extension API and the * This UI will use both the networkingPrivate extension API and the
* networkConfig mojo API until we provide all of the required functionality * networkConfig mojo API until we provide all of the required functionality
* in networkConfig. TODO(stevenjb): Remove use of networkingPrivate api. * in networkConfig. TODO(stevenjb): Remove use of networkingPrivate api.
* @type {?mojom.CrosNetworkConfigProxy} * @type {?mojom.CrosNetworkConfigRemote}
*/ */
let networkConfigProxy = null; let networkConfig = null;
/** /**
* Creates and returns a typed HTMLTableCellElement. * Creates and returns a typed HTMLTableCellElement.
...@@ -326,7 +326,7 @@ const NetworkUI = (function() { ...@@ -326,7 +326,7 @@ const NetworkUI = (function() {
if (selectedId == 'shill') { if (selectedId == 'shill') {
chrome.send('getShillNetworkProperties', [guid]); chrome.send('getShillNetworkProperties', [guid]);
} else if (selectedId == 'state') { } else if (selectedId == 'state') {
networkConfigProxy.getNetworkState(guid) networkConfig.getNetworkState(guid)
.then((responseParams) => { .then((responseParams) => {
if (responseParams && responseParams.result) { if (responseParams && responseParams.result) {
showDetail(detailCell, responseParams.result); showDetail(detailCell, responseParams.result);
...@@ -339,7 +339,7 @@ const NetworkUI = (function() { ...@@ -339,7 +339,7 @@ const NetworkUI = (function() {
showDetailError(detailCell, 'Mojo service failure: ' + error); showDetailError(detailCell, 'Mojo service failure: ' + error);
}); });
} else if (selectedId == 'managed') { } else if (selectedId == 'managed') {
networkConfigProxy.getManagedProperties(guid) networkConfig.getManagedProperties(guid)
.then((responseParams) => { .then((responseParams) => {
if (responseParams && responseParams.result) { if (responseParams && responseParams.result) {
showDetail(detailCell, responseParams.result); showDetail(detailCell, responseParams.result);
...@@ -475,7 +475,7 @@ const NetworkUI = (function() { ...@@ -475,7 +475,7 @@ const NetworkUI = (function() {
* Requests an update of all network info. * Requests an update of all network info.
*/ */
const requestNetworks = function() { const requestNetworks = function() {
networkConfigProxy networkConfig
.getNetworkStateList({ .getNetworkStateList({
filter: mojom.FilterType.kVisible, filter: mojom.FilterType.kVisible,
networkType: mojom.NetworkType.kAll, networkType: mojom.NetworkType.kAll,
...@@ -485,7 +485,7 @@ const NetworkUI = (function() { ...@@ -485,7 +485,7 @@ const NetworkUI = (function() {
onVisibleNetworksReceived(responseParams.result); onVisibleNetworksReceived(responseParams.result);
}); });
networkConfigProxy networkConfig
.getNetworkStateList({ .getNetworkStateList({
filter: mojom.FilterType.kConfigured, filter: mojom.FilterType.kConfigured,
networkType: mojom.NetworkType.kAll, networkType: mojom.NetworkType.kAll,
...@@ -495,7 +495,7 @@ const NetworkUI = (function() { ...@@ -495,7 +495,7 @@ const NetworkUI = (function() {
onFavoriteNetworksReceived(responseParams.result); onFavoriteNetworksReceived(responseParams.result);
}); });
networkConfigProxy.getDeviceStateList().then((responseParams) => { networkConfig.getDeviceStateList().then((responseParams) => {
onDeviceStatesReceived(responseParams.result); onDeviceStatesReceived(responseParams.result);
}); });
}; };
...@@ -512,8 +512,8 @@ const NetworkUI = (function() { ...@@ -512,8 +512,8 @@ const NetworkUI = (function() {
/** Initialize NetworkUI state. */ /** Initialize NetworkUI state. */
const init = function() { const init = function() {
networkConfigProxy = network_config.MojoInterfaceProviderImpl.getInstance() networkConfig = network_config.MojoInterfaceProviderImpl.getInstance()
.getMojoServiceProxy(); .getMojoServiceRemote();
/** Set the refresh rate if the interval is found in the url. */ /** Set the refresh rate if the interval is found in the url. */
const interval = new URL(window.location.href).searchParams.get('refresh'); const interval = new URL(window.location.href).searchParams.get('refresh');
......
...@@ -209,16 +209,15 @@ Polymer({ ...@@ -209,16 +209,15 @@ Polymer({
* This UI will use both the networkingPrivate extension API and the * This UI will use both the networkingPrivate extension API and the
* networkConfig mojo API until we provide all of the required functionality * networkConfig mojo API until we provide all of the required functionality
* in networkConfig. TODO(stevenjb): Remove use of networkingPrivate api. * in networkConfig. TODO(stevenjb): Remove use of networkingPrivate api.
* @private {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} * @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote}
*/ */
networkConfigProxy_: null, networkConfig_: null,
/** @override */ /** @override */
created: function() { created: function() {
this.browserProxy_ = settings.InternetPageBrowserProxyImpl.getInstance(); this.browserProxy_ = settings.InternetPageBrowserProxyImpl.getInstance();
this.networkConfigProxy_ = this.networkConfig_ = network_config.MojoInterfaceProviderImpl.getInstance()
network_config.MojoInterfaceProviderImpl.getInstance() .getMojoServiceRemote();
.getMojoServiceProxy();
}, },
/** /**
...@@ -455,7 +454,7 @@ Polymer({ ...@@ -455,7 +454,7 @@ Polymer({
getNetworkDetails_: function() { getNetworkDetails_: function() {
assert(this.guid); assert(this.guid);
if (this.isSecondaryUser_) { if (this.isSecondaryUser_) {
this.networkConfigProxy_.getNetworkState(this.guid).then(response => { this.networkConfig_.getNetworkState(this.guid).then(response => {
this.getStateCallback_(response.result); this.getStateCallback_(response.result);
}); });
} else { } else {
......
...@@ -64,15 +64,14 @@ Polymer({ ...@@ -64,15 +64,14 @@ Polymer({
* This UI will use both the networkingPrivate extension API and the * This UI will use both the networkingPrivate extension API and the
* networkConfig mojo API until we provide all of the required functionality * networkConfig mojo API until we provide all of the required functionality
* in networkConfig. TODO(stevenjb): Remove use of networkingPrivate api. * in networkConfig. TODO(stevenjb): Remove use of networkingPrivate api.
* @private {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} * @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote}
*/ */
networkConfigProxy_: null, networkConfig_: null,
/** @override */ /** @override */
created: function() { created: function() {
this.networkConfigProxy_ = this.networkConfig_ = network_config.MojoInterfaceProviderImpl.getInstance()
network_config.MojoInterfaceProviderImpl.getInstance() .getMojoServiceRemote();
.getMojoServiceProxy();
}, },
/** CrosNetworkConfigObserver impl */ /** CrosNetworkConfigObserver impl */
...@@ -99,7 +98,7 @@ Polymer({ ...@@ -99,7 +98,7 @@ Polymer({
limit: chromeos.networkConfig.mojom.kNoLimit, limit: chromeos.networkConfig.mojom.kNoLimit,
networkType: OncMojo.getNetworkTypeFromString(this.networkType), networkType: OncMojo.getNetworkTypeFromString(this.networkType),
}; };
this.networkConfigProxy_.getNetworkStateList(filter).then(response => { this.networkConfig_.getNetworkStateList(filter).then(response => {
this.networkStateList_ = response.result; this.networkStateList_ = response.result;
}); });
}, },
...@@ -162,7 +161,7 @@ Polymer({ ...@@ -162,7 +161,7 @@ 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.networkConfigProxy_.getManagedProperties(this.selectedGuid_) this.networkConfig_.getManagedProperties(this.selectedGuid_)
.then(response => { .then(response => {
const properties = response.result; const properties = response.result;
if (!properties) { if (!properties) {
......
...@@ -162,16 +162,15 @@ Polymer({ ...@@ -162,16 +162,15 @@ Polymer({
* This UI will use both the networkingPrivate extension API and the * This UI will use both the networkingPrivate extension API and the
* networkConfig mojo API until we provide all of the required functionality * networkConfig mojo API until we provide all of the required functionality
* in networkConfig. TODO(stevenjb): Remove use of networkingPrivate api. * in networkConfig. TODO(stevenjb): Remove use of networkingPrivate api.
* @private {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} * @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote}
*/ */
networkConfigProxy_: null, networkConfig_: null,
/** @override */ /** @override */
created: function() { created: function() {
this.browserProxy_ = settings.InternetPageBrowserProxyImpl.getInstance(); this.browserProxy_ = settings.InternetPageBrowserProxyImpl.getInstance();
this.networkConfigProxy_ = this.networkConfig_ = network_config.MojoInterfaceProviderImpl.getInstance()
network_config.MojoInterfaceProviderImpl.getInstance() .getMojoServiceRemote();
.getMojoServiceProxy();
}, },
/** @override */ /** @override */
...@@ -287,7 +286,7 @@ Polymer({ ...@@ -287,7 +286,7 @@ Polymer({
* @private * @private
*/ */
onDeviceEnabledToggled_: function(event) { onDeviceEnabledToggled_: function(event) {
this.networkConfigProxy_.setNetworkTypeEnabledState( this.networkConfig_.setNetworkTypeEnabledState(
event.detail.type, event.detail.enabled); event.detail.type, event.detail.enabled);
}, },
......
...@@ -136,16 +136,15 @@ Polymer({ ...@@ -136,16 +136,15 @@ Polymer({
* This UI will use both the networkingPrivate extension API and the * This UI will use both the networkingPrivate extension API and the
* networkConfig mojo API until we provide all of the required functionality * networkConfig mojo API until we provide all of the required functionality
* in networkConfig. TODO(stevenjb): Remove use of networkingPrivate api. * in networkConfig. TODO(stevenjb): Remove use of networkingPrivate api.
* @private {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} * @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote}
*/ */
networkConfigProxy_: null, networkConfig_: null,
/** @override */ /** @override */
created: function() { created: function() {
this.browserProxy_ = settings.InternetPageBrowserProxyImpl.getInstance(); this.browserProxy_ = settings.InternetPageBrowserProxyImpl.getInstance();
this.networkConfigProxy_ = this.networkConfig_ = network_config.MojoInterfaceProviderImpl.getInstance()
network_config.MojoInterfaceProviderImpl.getInstance() .getMojoServiceRemote();
.getMojoServiceProxy();
}, },
/** @override */ /** @override */
...@@ -246,9 +245,9 @@ Polymer({ ...@@ -246,9 +245,9 @@ Polymer({
return; return;
} }
const INTERVAL_MS = 10 * 1000; const INTERVAL_MS = 10 * 1000;
this.networkConfigProxy_.requestNetworkScan(this.deviceState.type); this.networkConfig_.requestNetworkScan(this.deviceState.type);
this.scanIntervalId_ = window.setInterval(() => { this.scanIntervalId_ = window.setInterval(() => {
this.networkConfigProxy_.requestNetworkScan(this.deviceState.type); this.networkConfig_.requestNetworkScan(this.deviceState.type);
}, INTERVAL_MS); }, INTERVAL_MS);
}, },
...@@ -271,7 +270,7 @@ Polymer({ ...@@ -271,7 +270,7 @@ Polymer({
limit: chromeos.networkConfig.mojom.kNoLimit, limit: chromeos.networkConfig.mojom.kNoLimit,
networkType: this.deviceState.type, networkType: this.deviceState.type,
}; };
this.networkConfigProxy_.getNetworkStateList(filter).then(response => { this.networkConfig_.getNetworkStateList(filter).then(response => {
this.onGetNetworks_(response.result); this.onGetNetworks_(response.result);
}); });
}, },
...@@ -294,7 +293,7 @@ Polymer({ ...@@ -294,7 +293,7 @@ Polymer({
limit: chromeos.networkConfig.mojom.kNoLimit, limit: chromeos.networkConfig.mojom.kNoLimit,
networkType: mojom.NetworkType.kTether, networkType: mojom.NetworkType.kTether,
}; };
this.networkConfigProxy_.getNetworkStateList(filter).then(response => { this.networkConfig_.getNetworkStateList(filter).then(response => {
const tetherNetworkStates = response.result; const tetherNetworkStates = response.result;
this.networkStateList_ = networkStates.concat(tetherNetworkStates); this.networkStateList_ = networkStates.concat(tetherNetworkStates);
}); });
......
...@@ -76,8 +76,8 @@ Polymer({ ...@@ -76,8 +76,8 @@ Polymer({
}, },
}, },
/** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} */ /** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
networkConfigProxy_: null, networkConfig_: null,
/** /**
* Set of GUIDs identifying active networks, one for each type. * Set of GUIDs identifying active networks, one for each type.
...@@ -87,9 +87,8 @@ Polymer({ ...@@ -87,9 +87,8 @@ Polymer({
/** @override */ /** @override */
created: function() { created: function() {
this.networkConfigProxy_ = this.networkConfig_ = network_config.MojoInterfaceProviderImpl.getInstance()
network_config.MojoInterfaceProviderImpl.getInstance() .getMojoServiceRemote();
.getMojoServiceProxy();
}, },
/** @override */ /** @override */
...@@ -135,7 +134,7 @@ Polymer({ ...@@ -135,7 +134,7 @@ Polymer({
*/ */
getNetworkLists_: function() { getNetworkLists_: function() {
// First get the device states. // First get the device states.
this.networkConfigProxy_.getDeviceStateList().then(response => { this.networkConfig_.getDeviceStateList().then(response => {
// Second get the network states. // Second get the network states.
this.getNetworkStates_(response.result); this.getNetworkStates_(response.result);
}); });
...@@ -154,7 +153,7 @@ Polymer({ ...@@ -154,7 +153,7 @@ Polymer({
limit: chromeos.networkConfig.mojom.kNoLimit, limit: chromeos.networkConfig.mojom.kNoLimit,
networkType: mojom.NetworkType.kAll, networkType: mojom.NetworkType.kAll,
}; };
this.networkConfigProxy_.getNetworkStateList(filter).then(response => { this.networkConfig_.getNetworkStateList(filter).then(response => {
this.updateNetworkStates_(response.result, deviceStateList); this.updateNetworkStates_(response.result, deviceStateList);
}); });
}, },
......
...@@ -56,14 +56,13 @@ Polymer({ ...@@ -56,14 +56,13 @@ Polymer({
}, },
}, },
/** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} */ /** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
networkConfigProxy_: null, networkConfig_: null,
/** @override */ /** @override */
created: function() { created: function() {
this.networkConfigProxy_ = this.networkConfig_ = network_config.MojoInterfaceProviderImpl.getInstance()
network_config.MojoInterfaceProviderImpl.getInstance() .getMojoServiceRemote();
.getMojoServiceProxy();
}, },
/** @override */ /** @override */
...@@ -87,7 +86,7 @@ Polymer({ ...@@ -87,7 +86,7 @@ Polymer({
if (!networks.find(network => network.guid == guid)) { if (!networks.find(network => network.guid == guid)) {
return; return;
} }
this.networkConfigProxy_.getNetworkState(guid).then(response => { this.networkConfig_.getNetworkState(guid).then(response => {
if (response.result) { if (response.result) {
this.activeNetworkState_ = response.result; this.activeNetworkState_ = response.result;
} }
...@@ -113,7 +112,7 @@ Polymer({ ...@@ -113,7 +112,7 @@ Polymer({
* @private * @private
*/ */
updateTetherDeviceState_: function() { updateTetherDeviceState_: function() {
this.networkConfigProxy_.getDeviceStateList().then(response => { this.networkConfig_.getDeviceStateList().then(response => {
const kTether = chromeos.networkConfig.mojom.NetworkType.kTether; const kTether = chromeos.networkConfig.mojom.NetworkType.kTether;
const deviceStates = response.result; const deviceStates = response.result;
const deviceState = const deviceState =
...@@ -143,7 +142,7 @@ Polymer({ ...@@ -143,7 +142,7 @@ Polymer({
limit: 1, limit: 1,
networkType: kTether, networkType: kTether,
}; };
this.networkConfigProxy_.getNetworkStateList(filter).then(response => { this.networkConfig_.getNetworkStateList(filter).then(response => {
const networks = response.result; const networks = response.result;
this.activeNetworkState_ = this.activeNetworkState_ =
networks[0] || OncMojo.getDefaultNetworkState(kTether); networks[0] || OncMojo.getDefaultNetworkState(kTether);
......
...@@ -125,14 +125,13 @@ Polymer({ ...@@ -125,14 +125,13 @@ Polymer({
'onModelChanged_(pendingPrinter_.ppdModel)', 'onModelChanged_(pendingPrinter_.ppdModel)',
], ],
/** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} */ /** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
networkConfigProxy_: null, networkConfig_: null,
/** @override */ /** @override */
created: function() { created: function() {
this.networkConfigProxy_ = this.networkConfig_ = network_config.MojoInterfaceProviderImpl.getInstance()
network_config.MojoInterfaceProviderImpl.getInstance() .getMojoServiceRemote();
.getMojoServiceProxy();
}, },
/** @override */ /** @override */
...@@ -431,7 +430,7 @@ Polymer({ ...@@ -431,7 +430,7 @@ Polymer({
* @private * @private
*/ */
refreshNetworks_: function() { refreshNetworks_: function() {
this.networkConfigProxy_ this.networkConfig_
.getNetworkStateList({ .getNetworkStateList({
filter: chromeos.networkConfig.mojom.FilterType.kActive, filter: chromeos.networkConfig.mojom.FilterType.kActive,
networkType: chromeos.networkConfig.mojom.NetworkType.kAll, networkType: chromeos.networkConfig.mojom.NetworkType.kAll,
......
...@@ -65,19 +65,19 @@ Polymer({ ...@@ -65,19 +65,19 @@ Polymer({
'openManufacturerModelDialogForSpecifiedPrinter_', 'openManufacturerModelDialogForSpecifiedPrinter_',
}, },
/** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} */ /** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
networkConfigProxy_: null, networkConfig_: null,
/** @override */ /** @override */
created: function() { created: function() {
this.networkConfigProxy_ = this.networkConfig_ =
network_config.MojoInterfaceProviderImpl.getInstance() network_config.MojoInterfaceProviderImpl.getInstance()
.getMojoServiceProxy(); .getMojoServiceRemote();
}, },
/** @override */ /** @override */
attached: function() { attached: function() {
this.networkConfigProxy_ this.networkConfig_
.getNetworkStateList({ .getNetworkStateList({
filter: chromeos.networkConfig.mojom.FilterType.kActive, filter: chromeos.networkConfig.mojom.FilterType.kActive,
networkType: chromeos.networkConfig.mojom.NetworkType.kAll, networkType: chromeos.networkConfig.mojom.NetworkType.kAll,
......
...@@ -202,13 +202,13 @@ suite('CupsSavedPrintersTests', function() { ...@@ -202,13 +202,13 @@ suite('CupsSavedPrintersTests', function() {
/** @type {NetworkingPrivate} */ /** @type {NetworkingPrivate} */
let api_; let api_;
/** @type {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} */ /** @type {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
let mojoApi_; let mojoApi_;
suiteSetup(function() { suiteSetup(function() {
api_ = new chrome.FakeNetworkingPrivate(); api_ = new chrome.FakeNetworkingPrivate();
mojoApi_ = new FakeNetworkConfig(api_); mojoApi_ = new FakeNetworkConfig(api_);
network_config.MojoInterfaceProviderImpl.getInstance().proxy_ = mojoApi_; network_config.MojoInterfaceProviderImpl.getInstance().remote_ = mojoApi_;
}); });
setup(function() { setup(function() {
...@@ -411,7 +411,7 @@ suite('CupsNearbyPrintersTests', function() { ...@@ -411,7 +411,7 @@ suite('CupsNearbyPrintersTests', function() {
/** @type {?NetworkingPrivate} */ /** @type {?NetworkingPrivate} */
let api_; let api_;
/** @type {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} */ /** @type {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
let mojoApi_; let mojoApi_;
/** @type {!Array<crOnc.NetworkStateProperties>} networks */ /** @type {!Array<crOnc.NetworkStateProperties>} networks */
...@@ -438,7 +438,7 @@ suite('CupsNearbyPrintersTests', function() { ...@@ -438,7 +438,7 @@ suite('CupsNearbyPrintersTests', function() {
suiteSetup(function() { suiteSetup(function() {
api_ = new chrome.FakeNetworkingPrivate(); api_ = new chrome.FakeNetworkingPrivate();
mojoApi_ = new FakeNetworkConfig(api_); mojoApi_ = new FakeNetworkConfig(api_);
network_config.MojoInterfaceProviderImpl.getInstance().proxy_ = mojoApi_; network_config.MojoInterfaceProviderImpl.getInstance().remote_ = mojoApi_;
}); });
setup(function() { setup(function() {
......
...@@ -12,7 +12,7 @@ suite('InternetPage', function() { ...@@ -12,7 +12,7 @@ suite('InternetPage', function() {
/** @type {?NetworkingPrivate} */ /** @type {?NetworkingPrivate} */
let api_; let api_;
/** @type {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} */ /** @type {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
let mojoApi_; let mojoApi_;
suiteSetup(function() { suiteSetup(function() {
...@@ -47,7 +47,7 @@ suite('InternetPage', function() { ...@@ -47,7 +47,7 @@ suite('InternetPage', function() {
api_ = new chrome.FakeNetworkingPrivate(); api_ = new chrome.FakeNetworkingPrivate();
mojoApi_ = new FakeNetworkConfig(api_); mojoApi_ = new FakeNetworkConfig(api_);
network_config.MojoInterfaceProviderImpl.getInstance().proxy_ = mojoApi_; network_config.MojoInterfaceProviderImpl.getInstance().remote_ = mojoApi_;
// Disable animations so sub-pages open within one event loop. // Disable animations so sub-pages open within one event loop.
testing.Test.disableAnimationsAndTransitions(); testing.Test.disableAnimationsAndTransitions();
......
...@@ -13,7 +13,4 @@ mojom("mojom") { ...@@ -13,7 +13,4 @@ mojom("mojom") {
deps = [ deps = [
"//services/network/public/mojom:mojom_ip_address", "//services/network/public/mojom:mojom_ip_address",
] ]
# TODO(https://crbug.com/968369): Change to use new names.
use_old_js_lite_bindings_names = true
} }
...@@ -5,24 +5,25 @@ ...@@ -5,24 +5,25 @@
cr.define('network_config', function() { cr.define('network_config', function() {
/** @interface */ /** @interface */
class MojoInterfaceProvider { class MojoInterfaceProvider {
/** @return {!chromeos.networkConfig.mojom.CrosNetworkConfigProxy} */ /** @return {!chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
getMojoServiceProxy() {} getMojoServiceRemote() {}
} }
/** @implements {network_config.MojoInterfaceProvider} */ /** @implements {network_config.MojoInterfaceProvider} */
class MojoInterfaceProviderImpl { class MojoInterfaceProviderImpl {
constructor() { constructor() {
/** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} */ /** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
this.proxy_ = null; this.remote_ = null;
} }
/** @override */ /** @override */
getMojoServiceProxy() { getMojoServiceRemote() {
if (!this.proxy_) { if (!this.remote_) {
this.proxy_ = chromeos.networkConfig.mojom.CrosNetworkConfig.getProxy(); this.remote_ =
chromeos.networkConfig.mojom.CrosNetworkConfig.getRemote();
} }
return this.proxy_; return this.remote_;
} }
} }
......
...@@ -118,14 +118,13 @@ Polymer({ ...@@ -118,14 +118,13 @@ Polymer({
/** @private {boolean} */ /** @private {boolean} */
simUnlockSent_: false, simUnlockSent_: false,
/** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} */ /** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
networkConfigProxy_: null, networkConfig_: null,
/** @override */ /** @override */
created: function() { created: function() {
this.networkConfigProxy_ = this.networkConfig_ = network_config.MojoInterfaceProviderImpl.getInstance()
network_config.MojoInterfaceProviderImpl.getInstance() .getMojoServiceRemote();
.getMojoServiceProxy();
this.getDeviceStateProperties_(); this.getDeviceStateProperties_();
}, },
...@@ -176,7 +175,7 @@ Polymer({ ...@@ -176,7 +175,7 @@ Polymer({
/** @private */ /** @private */
getDeviceStateProperties_: function() { getDeviceStateProperties_: function() {
this.networkConfigProxy_.getDeviceStateList().then(response => { this.networkConfig_.getDeviceStateList().then(response => {
const devices = response.result; const devices = response.result;
const kCellular = chromeos.networkConfig.mojom.NetworkType.kCellular; const kCellular = chromeos.networkConfig.mojom.NetworkType.kCellular;
this.deviceStateProperties_ = this.deviceStateProperties_ =
...@@ -310,18 +309,17 @@ Polymer({ ...@@ -310,18 +309,17 @@ Polymer({
*/ */
setCellularSimState_: function(cellularSimState) { setCellularSimState_: function(cellularSimState) {
this.setInProgress_(); this.setInProgress_();
this.networkConfigProxy_.setCellularSimState(cellularSimState) this.networkConfig_.setCellularSimState(cellularSimState).then(response => {
.then(response => { this.inProgress_ = false;
this.inProgress_ = false; if (!response.success) {
if (!response.success) { this.error_ = ErrorType.INCORRECT_PIN;
this.error_ = ErrorType.INCORRECT_PIN; this.focusDialogInput_();
this.focusDialogInput_(); } else {
} else { this.error_ = ErrorType.NONE;
this.error_ = ErrorType.NONE; this.closeDialogs_();
this.closeDialogs_(); this.delayUpdateLockEnabled_();
this.delayUpdateLockEnabled_(); }
} });
});
}, },
/** /**
...@@ -338,19 +336,17 @@ Polymer({ ...@@ -338,19 +336,17 @@ Polymer({
if (puk) { if (puk) {
cellularSimState.newPin = pin; cellularSimState.newPin = pin;
} }
this.networkConfigProxy_.setCellularSimState(cellularSimState) this.networkConfig_.setCellularSimState(cellularSimState).then(response => {
.then(response => { this.inProgress_ = false;
this.inProgress_ = false; if (!response.success) {
if (!response.success) { this.error_ = puk ? ErrorType.INCORRECT_PUK : ErrorType.INCORRECT_PIN;
this.error_ = this.focusDialogInput_();
puk ? ErrorType.INCORRECT_PUK : ErrorType.INCORRECT_PIN; } else {
this.focusDialogInput_(); this.error_ = ErrorType.NONE;
} else { this.closeDialogs_();
this.error_ = ErrorType.NONE; this.delayUpdateLockEnabled_();
this.closeDialogs_(); }
this.delayUpdateLockEnabled_(); });
}
});
}, },
/** /**
......
...@@ -15,10 +15,11 @@ const CrNetworkListenerBehavior = { ...@@ -15,10 +15,11 @@ const CrNetworkListenerBehavior = {
/** @override */ /** @override */
attached: function() { attached: function() {
this.observer_ = this.observer_ =
new chromeos.networkConfig.mojom.CrosNetworkConfigObserver(this); new chromeos.networkConfig.mojom.CrosNetworkConfigObserverReceiver(
this);
network_config.MojoInterfaceProviderImpl.getInstance() network_config.MojoInterfaceProviderImpl.getInstance()
.getMojoServiceProxy() .getMojoServiceRemote()
.addObserver(this.observer_.$.createProxy()); .addObserver(this.observer_.$.bindNewPipeAndPassRemote());
}, },
// CrosNetworkConfigObserver methods. Override these in the implementation. // CrosNetworkConfigObserver methods. Override these in the implementation.
......
...@@ -78,14 +78,13 @@ Polymer({ ...@@ -78,14 +78,13 @@ Polymer({
/** @private {number|null} */ /** @private {number|null} */
scanIntervalId_: null, scanIntervalId_: null,
/** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigProxy} */ /** @private {?chromeos.networkConfig.mojom.CrosNetworkConfigRemote} */
networkConfigProxy_: null, networkConfig_: null,
/** @override */ /** @override */
created: function() { created: function() {
this.networkConfigProxy_ = this.networkConfig_ = network_config.MojoInterfaceProviderImpl.getInstance()
network_config.MojoInterfaceProviderImpl.getInstance() .getMojoServiceRemote();
.getMojoServiceProxy();
}, },
/** @override */ /** @override */
...@@ -94,9 +93,9 @@ Polymer({ ...@@ -94,9 +93,9 @@ Polymer({
const INTERVAL_MS = 10 * 1000; const INTERVAL_MS = 10 * 1000;
const kAll = chromeos.networkConfig.mojom.NetworkType.kAll; const kAll = chromeos.networkConfig.mojom.NetworkType.kAll;
this.networkConfigProxy_.requestNetworkScan(kAll); this.networkConfig_.requestNetworkScan(kAll);
this.scanIntervalId_ = window.setInterval(function() { this.scanIntervalId_ = window.setInterval(function() {
this.networkConfigProxy_.requestNetworkScan(kAll); this.networkConfig_.requestNetworkScan(kAll);
}.bind(this), INTERVAL_MS); }.bind(this), INTERVAL_MS);
}, },
...@@ -133,7 +132,7 @@ Polymer({ ...@@ -133,7 +132,7 @@ Polymer({
* refresh and list update (e.g. when the element is shown). * refresh and list update (e.g. when the element is shown).
*/ */
refreshNetworks: function() { refreshNetworks: function() {
this.networkConfigProxy_.getDeviceStateList().then(response => { this.networkConfig_.getDeviceStateList().then(response => {
this.onGetDeviceStates_(response.result); this.onGetDeviceStates_(response.result);
}); });
}, },
...@@ -186,7 +185,7 @@ Polymer({ ...@@ -186,7 +185,7 @@ Polymer({
networkType: mojom.NetworkType.kAll, networkType: mojom.NetworkType.kAll,
limit: chromeos.networkConfig.mojom.kNoLimit, limit: chromeos.networkConfig.mojom.kNoLimit,
}; };
this.networkConfigProxy_.getNetworkStateList(filter).then(response => { this.networkConfig_.getNetworkStateList(filter).then(response => {
this.onGetNetworkStateList_(deviceStates, response.result); this.onGetNetworkStateList_(deviceStates, response.result);
}); });
}, },
......
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