Commit 0e4a1ef0 authored by Nnamdi Theodore Johnson-Kanu's avatar Nnamdi Theodore Johnson-Kanu Committed by Commit Bot

[CrOS cellular] Migrate cellular_setup/psim_flow_ui.js to Polymer3

Bug: 1111477
Change-Id: I4604ea00cd12cead7dcff72e2c4f615355320d07
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2375599
Commit-Queue: Nnamdi Theodore Johnson-kanu <tjohnsonkanu@google.com>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801952}
parent 6e040ba3
......@@ -245,8 +245,9 @@ if (include_js_tests) {
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/cellular_setup/base_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/cellular_setup/button_bar_test.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/cellular_setup/final_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/cellular_setup/sim_detect_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/cellular_setup/provisioning_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/cellular_setup/psim_flow_ui_test.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/cellular_setup/sim_detect_page_test.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/cr_policy_network_behavior_mojo_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/cr_policy_network_indicator_mojo_tests.m.js",
"$root_gen_dir/chrome/test/data/webui/cr_components/chromeos/network/network_apnlist_test.m.js",
......
......@@ -2,16 +2,17 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//ui/webui/resources/tools/js_modulizer.gni")
import("//ui/webui/resources/cr_components/chromeos/os_cr_components.gni")
import("//ui/webui/resources/tools/js_modulizer.gni")
js_modulizer("modulize") {
input_files = [
"base_page_test.js",
"button_bar_test.js",
"final_page_test.js",
"sim_detect_page_test.js",
"provisioning_page_test.js",
"psim_flow_ui_test.js",
"sim_detect_page_test.js",
]
namespace_rewrites = cr_components_chromeos_namespace_rewrites
}
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// clang-format off
// #import 'chrome://os-settings/strings.m.js';
// #import 'chrome://resources/cr_components/chromeos/cellular_setup/psim_flow_ui.m.js';
// #import {flush, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
// #import {assertTrue} from '../../../chai_assert.js';
// clang-format on
suite('CrComponentsPsimFlowUiTest', function() {
let pSimPage;
setup(function() {
pSimPage = document.createElement('psim-flow-ui');
document.body.appendChild(pSimPage);
Polymer.dom.flush();
});
test('Base test', function() {
const ironPage = pSimPage.$$('iron-pages');
assertTrue(!!ironPage);
});
});
......@@ -46,6 +46,7 @@ GEN('#include "content/public/test/browser_test.h"');
['ButtonBar', 'cellular_setup/button_bar_test.js',[]],
['FinalPage', 'cellular_setup/final_page_test.js', []],
['ProvisioningPage', 'cellular_setup/provisioning_page_test.js',[]],
['PsimFlowUi', 'cellular_setup/psim_flow_ui_test.js',[]],
['SimDetectPage', 'cellular_setup/sim_detect_page_test.js', []],
].forEach(test => registerTest('CellularSetup', 'cellular-setup', ...test));
// clang-format on
......
......@@ -26,6 +26,7 @@ GEN('#include "chromeos/constants/chromeos_features.h"');
['ButtonBar', 'cellular_setup/button_bar_test.m.js'],
['FinalPage', 'cellular_setup/final_page_test.m.js'],
['ProvisioningPage', 'cellular_setup/provisioning_page_test.m.js'],
['PsimFlowUi', 'cellular_setup/psim_flow_ui_test.m.js'],
['SimDetectPage', 'cellular_setup/sim_detect_page_test.m.js'],
].forEach(test => registerTest('CellularSetup', ...test));
// clang-format on
......
......@@ -70,6 +70,7 @@ js_library("psim_flow_ui") {
":sim_detect_page",
":subflow_behavior",
"//chromeos/services/cellular_setup/public/mojom:mojom_js_library_for_compile",
"//ui/webui/resources/js:assert.m",
"//ui/webui/resources/js:i18n_behavior",
]
}
......@@ -133,8 +134,7 @@ js_type_check("closure_compile_module") {
":final_page.m",
":mojo_interface_provider.m",
":provisioning_page.m",
# ":psim_flow_ui.m",
":psim_flow_ui.m",
":sim_detect_page.m",
":subflow_behavior.m",
......@@ -223,6 +223,24 @@ js_library("subflow_behavior.m") {
extra_deps = [ ":modulize" ]
}
js_library("psim_flow_ui.m") {
sources = [ "$root_gen_dir/ui/webui/resources/cr_components/chromeos/cellular_setup/psim_flow_ui.m.js" ]
deps = [
":cellular_types.m",
":cellular_types.m",
":final_page.m",
":mojo_interface_provider.m",
":provisioning_page.m",
":sim_detect_page.m",
":subflow_behavior.m",
"//chromeos/services/cellular_setup/public/mojom:mojom_js_library_for_compile",
"//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled",
"//ui/webui/resources/js:assert.m",
"//ui/webui/resources/js:i18n_behavior.m",
]
extra_deps = [ ":psim_flow_ui_module" ]
}
group("polymer3_elements") {
public_deps = [
":base_page_module",
......@@ -230,6 +248,7 @@ group("polymer3_elements") {
":final_page_module",
":modulize",
":provisioning_page_module",
":psim_flow_ui_module",
":sim_detect_page_module",
]
}
......@@ -274,6 +293,14 @@ polymer_modulizer("provisioning_page") {
auto_imports = cr_components_chromeos_auto_imports
}
polymer_modulizer("psim_flow_ui") {
js_file = "psim_flow_ui.js"
html_file = "psim_flow_ui.html"
html_type = "dom-module"
namespace_rewrites = cr_components_chromeos_namespace_rewrites
auto_imports = cr_components_chromeos_auto_imports
}
js_modulizer("modulize") {
input_files = [
"cellular_types.js",
......
......@@ -6,10 +6,13 @@
<link rel="import" href="provisioning_page.html">
<link rel="import" href="final_page.html">
<link rel="import" href="subflow_behavior.html">
<link rel="import" href="cellular_types.html">
<link rel="import" href="chrome://resources/html/assert.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-flex-layout/iron-flex-layout-classes.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-pages/iron-pages.html">
<dom-module id="psim-flow-ui">
<template>
<style include="iron-flex">
......@@ -31,6 +34,5 @@
<final-page show-error="[[showError_]]"></final-page>
</iron-pages>
</template>
<script src="psim_flow_ui.js">
</script>
<script src="psim_flow_ui.js"></script>
</dom-module>
......@@ -52,306 +52,312 @@ cr.define('cellularSetup', function() {
return null;
}
return {
PSimPageName: PSimPageName,
PSimUIState: PSimUIState,
getTimeoutMsForPSimUIState: getTimeoutMsForPSimUIState
};
});
/**
* Root element for the pSIM cellular setup flow. This element interacts with
* the CellularSetup service to carry out the psim activation flow. It contains
* navigation buttons and sub-pages corresponding to each step of the flow.
*/
Polymer({
is: 'psim-flow-ui',
behaviors: [
I18nBehavior,
SubflowBehavior,
],
properties: {
/** @private {!cellularSetup.PSimUIState} */
state_: {
type: String,
value: cellularSetup.PSimUIState.IDLE,
/**
* Root element for the pSIM cellular setup flow. This element interacts with
* the CellularSetup service to carry out the psim activation flow. It
* contains navigation buttons and sub-pages corresponding to each step of the
* flow.
*/
Polymer({
is: 'psim-flow-ui',
behaviors: [
I18nBehavior,
SubflowBehavior,
],
properties: {
/**
* @type {!cellularSetup.PSimUIState}
* @private
*/
state_: {
type: String,
value: PSimUIState.IDLE,
},
/**
* Element name of the current selected sub-page.
* @type {!cellularSetup.PSimPageName}
* @private
*/
selectedPSimPageName_: {
type: String,
value: PSimPageName.SIM_DETECT,
notify: true,
},
/**
* DOM Element for the current selected sub-page.
* @private {!SimDetectPageElement|!ProvisioningPageElement|
* !FinalPageElement}
*/
selectedPage_: Object,
/**
* Whether error state should be shown for the current page.
* @private {boolean}
*/
showError_: {type: Boolean, value: false},
/**
* Cellular metadata received via the onActivationStarted() callback. If
* that callback has not occurred, this field is null.
* @private {?chromeos.cellularSetup.mojom.CellularMetadata}
*/
cellularMetadata_: {
type: Object,
value: null,
},
/**
* Whether try again should be shown in the button bar.
* @private {boolean}
*/
showTryAgainButton_: {type: Boolean, value: false},
/**
* Whether finish button should be shown in the button bar.
* @private {boolean}
*/
showFinishButton_: {type: Boolean, value: false},
/**
* Whether cancel button should be shown in the button bar.
* @private {boolean}
*/
showCancelButton_: {type: Boolean, value: false}
},
observers: [
'updateShowError_(state_)',
'updateSelectedPage_(state_)',
'handlePSimUIStateChange_(state_)',
],
/**
* Element name of the current selected sub-page.
* @private {!cellularSetup.PSimPageName}
* Provides an interface to the CellularSetup Mojo service.
* @private {?cellular_setup.MojoInterfaceProvider}
*/
selectedPSimPageName_: {
type: String,
value: cellularSetup.PSimPageName.SIM_DETECT,
notify: true,
},
mojoInterfaceProvider_: null,
/**
* DOM Element for the current selected sub-page.
* @private {!SimDetectPageElement|!ProvisioningPageElement|
* !FinalPageElement}
* Delegate responsible for routing activation started/finished events.
* @private {?chromeos.cellularSetup.mojom.ActivationDelegateReceiver}
*/
selectedPage_: Object,
activationDelegateReceiver_: null,
/**
* Whether error state should be shown for the current page.
* @private {boolean}
* The timeout ID corresponding to a timeout for the current state. If no
* timeout is active, this value is null.
* @private {?number}
*/
showError_: {type: Boolean, value: false},
currentTimeoutId_: null,
/**
* Cellular metadata received via the onActivationStarted() callback. If
* that callback has not occurred, this field is null.
* @private {?chromeos.cellularSetup.mojom.CellularMetadata}
* Handler used to communicate state updates back to the CellularSetup
* service.
* @private {?chromeos.cellularSetup.mojom.CarrierPortalHandlerRemote}
*/
cellularMetadata_: {
type: Object,
value: null,
carrierPortalHandler_: null,
/** @override */
created() {
this.mojoInterfaceProvider_ =
cellular_setup.MojoInterfaceProviderImpl.getInstance();
},
/**
* Whether try again should be shown in the button bar.
* @private {boolean}
* Overrides chromeos.cellularSetup.mojom.ActivationDelegateInterface.
* @param {!chromeos.cellularSetup.mojom.CellularMetadata} metadata
* @private
*/
showTryAgainButton_: {type: Boolean, value: false},
onActivationStarted(metadata) {
this.clearTimer_();
this.cellularMetadata_ = metadata;
this.state_ = PSimUIState.WAITING_FOR_PORTAL_TO_LOAD;
},
/**
* Whether finish button should be shown in the button bar.
* @private {boolean}
*/
showFinishButton_: {type: Boolean, value: false},
initSubflow() {
this.state_ = PSimUIState.STARTING_ACTIVATION;
this.set('buttonState', {
backward: cellularSetup.ButtonState.HIDDEN,
cancel: cellularSetup.ButtonState.SHOWN_AND_ENABLED,
finish: cellularSetup.ButtonState.HIDDEN,
next: cellularSetup.ButtonState.SHOWN_AND_ENABLED,
tryAgain: cellularSetup.ButtonState.HIDDEN
});
},
/**
* Whether cancel button should be shown in the button bar.
* @private {boolean}
* Overrides chromeos.cellularSetup.mojom.ActivationDelegateInterface.
* @param {!chromeos.cellularSetup.mojom.ActivationResult} result
* @private
*/
showCancelButton_: {type: Boolean, value: false}
},
observers: [
'updateShowError_(state_)',
'updateSelectedPage_(state_)',
'handlePSimUIStateChange_(state_)',
],
/**
* Provides an interface to the CellularSetup Mojo service.
* @private {?cellular_setup.MojoInterfaceProvider}
*/
mojoInterfaceProvider_: null,
/**
* Delegate responsible for routing activation started/finished events.
* @private {?chromeos.cellularSetup.mojom.ActivationDelegateReceiver}
*/
activationDelegateReceiver_: null,
onActivationFinished(result) {
this.closeActivationConnection_();
const ActivationResult = chromeos.cellularSetup.mojom.ActivationResult;
switch (result) {
case ActivationResult.kSuccessfullyStartedActivation:
this.state_ = PSimUIState.ALREADY_ACTIVATED;
break;
case ActivationResult.kAlreadyActivated:
this.state_ = PSimUIState.ACTIVATION_SUCCESS;
break;
case ActivationResult.kFailedToActivate:
this.state_ = PSimUIState.ACTIVATION_FAILURE;
break;
default:
assertNotReached();
}
},
/**
* The timeout ID corresponding to a timeout for the current state. If no
* timeout is active, this value is null.
* @private {?number}
*/
currentTimeoutId_: null,
/** @private */
updateShowError_() {
switch (this.state_) {
case PSimUIState.TIMEOUT_START_ACTIVATION:
case PSimUIState.TIMEOUT_PORTAL_LOAD:
case PSimUIState.TIMEOUT_FINISH_ACTIVATION:
case PSimUIState.ACTIVATION_FAILURE:
this.showError_ = true;
return;
default:
this.showError_ = false;
return;
}
},
/**
* Handler used to communicate state updates back to the CellularSetup
* service.
* @private {?chromeos.cellularSetup.mojom.CarrierPortalHandlerRemote}
*/
carrierPortalHandler_: null,
/** @private */
updateSelectedPage_() {
switch (this.state_) {
case PSimUIState.IDLE:
case PSimUIState.STARTING_ACTIVATION:
case PSimUIState.WAITING_FOR_ACTIVATION_TO_START:
case PSimUIState.TIMEOUT_START_ACTIVATION:
this.selectedPSimPageName_ = PSimPageName.SIM_DETECT;
return;
case PSimUIState.WAITING_FOR_PORTAL_TO_LOAD:
case PSimUIState.TIMEOUT_PORTAL_LOAD:
case PSimUIState.WAITING_FOR_USER_PAYMENT:
this.selectedPSimPageName_ = PSimPageName.PROVISIONING;
return;
case PSimUIState.WAITING_FOR_ACTIVATION_TO_FINISH:
case PSimUIState.TIMEOUT_FINISH_ACTIVATION:
case PSimUIState.ACTIVATION_SUCCESS:
case PSimUIState.ALREADY_ACTIVATED:
case PSimUIState.ACTIVATION_FAILURE:
this.selectedPSimPageName_ = PSimPageName.FINAL;
return;
default:
assertNotReached();
}
},
/** @override */
created() {
this.mojoInterfaceProvider_ =
cellular_setup.MojoInterfaceProviderImpl.getInstance();
},
/** @private */
handlePSimUIStateChange_() {
// Since the state has changed, the previous state did not time out, so
// clear any active timeout.
this.clearTimer_();
// If the new state has an associated timeout, set it.
const timeoutMs = getTimeoutMsForPSimUIState(this.state_);
if (timeoutMs !== null) {
this.currentTimeoutId_ =
setTimeout(this.onTimeout_.bind(this), timeoutMs);
}
if (this.state_ === PSimUIState.STARTING_ACTIVATION) {
this.startActivation_();
return;
}
},
/**
* Overrides chromeos.cellularSetup.mojom.ActivationDelegateInterface.
* @param {!chromeos.cellularSetup.mojom.CellularMetadata} metadata
* @private
*/
onActivationStarted(metadata) {
this.clearTimer_();
this.cellularMetadata_ = metadata;
this.state_ = cellularSetup.PSimUIState.WAITING_FOR_PORTAL_TO_LOAD;
},
initSubflow() {
this.state_ = cellularSetup.PSimUIState.STARTING_ACTIVATION;
this.set('buttonState', {
backward: cellularSetup.ButtonState.HIDDEN,
cancel: cellularSetup.ButtonState.SHOWN_AND_ENABLED,
finish: cellularSetup.ButtonState.HIDDEN,
next: cellularSetup.ButtonState.SHOWN_AND_ENABLED,
tryAgain: cellularSetup.ButtonState.HIDDEN
});
},
/** @private */
onTimeout_() {
// The activation attempt failed, so close the connection to the service.
this.closeActivationConnection_();
switch (this.state_) {
case PSimUIState.STARTING_ACTIVATION:
this.state_ = PSimUIState.TIMEOUT_START_ACTIVATION;
return;
case PSimUIState.WAITING_FOR_PORTAL_TO_LOAD:
this.state_ = PSimUIState.TIMEOUT_PORTAL_LOAD;
return;
case PSimUIState.WAITING_FOR_ACTIVATION_TO_FINISH:
this.state_ = PSimUIState.TIMEOUT_FINISH_ACTIVATION;
return;
default:
// Only the above states are expected to time out.
assertNotReached();
}
},
/**
* Overrides chromeos.cellularSetup.mojom.ActivationDelegateInterface.
* @param {!chromeos.cellularSetup.mojom.ActivationResult} result
* @private
*/
onActivationFinished(result) {
this.closeActivationConnection_();
const ActivationResult = chromeos.cellularSetup.mojom.ActivationResult;
switch (result) {
case ActivationResult.kSuccessfullyStartedActivation:
this.state_ = cellularSetup.PSimUIState.ALREADY_ACTIVATED;
break;
case ActivationResult.kAlreadyActivated:
this.state_ = cellularSetup.PSimUIState.ACTIVATION_SUCCESS;
break;
case ActivationResult.kFailedToActivate:
this.state_ = cellularSetup.PSimUIState.ACTIVATION_FAILURE;
break;
default:
assertNotReached();
}
},
/** @private */
updateShowError_() {
switch (this.state_) {
case cellularSetup.PSimUIState.TIMEOUT_START_ACTIVATION:
case cellularSetup.PSimUIState.TIMEOUT_PORTAL_LOAD:
case cellularSetup.PSimUIState.TIMEOUT_FINISH_ACTIVATION:
case cellularSetup.PSimUIState.ACTIVATION_FAILURE:
this.showError_ = true;
return;
default:
this.showError_ = false;
return;
}
},
/** @private */
updateSelectedPage_() {
switch (this.state_) {
case cellularSetup.PSimUIState.IDLE:
case cellularSetup.PSimUIState.STARTING_ACTIVATION:
case cellularSetup.PSimUIState.WAITING_FOR_ACTIVATION_TO_START:
case cellularSetup.PSimUIState.TIMEOUT_START_ACTIVATION:
this.selectedPSimPageName_ = cellularSetup.PSimPageName.SIM_DETECT;
return;
case cellularSetup.PSimUIState.WAITING_FOR_PORTAL_TO_LOAD:
case cellularSetup.PSimUIState.TIMEOUT_PORTAL_LOAD:
case cellularSetup.PSimUIState.WAITING_FOR_USER_PAYMENT:
this.selectedPSimPageName_ = cellularSetup.PSimPageName.PROVISIONING;
return;
case cellularSetup.PSimUIState.WAITING_FOR_ACTIVATION_TO_FINISH:
case cellularSetup.PSimUIState.TIMEOUT_FINISH_ACTIVATION:
case cellularSetup.PSimUIState.ACTIVATION_SUCCESS:
case cellularSetup.PSimUIState.ALREADY_ACTIVATED:
case cellularSetup.PSimUIState.ACTIVATION_FAILURE:
this.selectedPSimPageName_ = cellularSetup.PSimPageName.FINAL;
return;
default:
assertNotReached();
}
},
/** @private */
handlePSimUIStateChange_() {
// Since the state has changed, the previous state did not time out, so
// clear any active timeout.
this.clearTimer_();
// If the new state has an associated timeout, set it.
const timeoutMs = cellularSetup.getTimeoutMsForPSimUIState(this.state_);
if (timeoutMs !== null) {
this.currentTimeoutId_ =
setTimeout(this.onTimeout_.bind(this), timeoutMs);
}
/** @private */
startActivation_() {
assert(!this.activationDelegateReceiver_);
this.activationDelegateReceiver_ =
new chromeos.cellularSetup.mojom.ActivationDelegateReceiver(
/**
* @type {!chromeos.cellularSetup.mojom.ActivationDelegateInterface}
*/
(this));
this.mojoInterfaceProvider_.getMojoServiceRemote()
.startActivation(
this.activationDelegateReceiver_.$.bindNewPipeAndPassRemote())
.then(
/**
* @param {!chromeos.cellularSetup.
* mojom.CellularSetup_StartActivation_ResponseParams}
* params
*/
(params) => {
this.carrierPortalHandler_ = params.observer;
});
},
if (this.state_ === cellularSetup.PSimUIState.STARTING_ACTIVATION) {
this.startActivation_();
return;
}
},
/** @private */
closeActivationConnection_() {
assert(!!this.activationDelegateReceiver_);
this.activationDelegateReceiver_.$.close();
this.activationDelegateReceiver_ = null;
this.carrierPortalHandler_ = null;
this.cellularMetadata_ = null;
},
/** @private */
onTimeout_() {
// The activation attempt failed, so close the connection to the service.
this.closeActivationConnection_();
/** @private */
clearTimer_() {
if (this.currentTimeoutId_) {
clearTimeout(this.currentTimeoutId_);
}
this.currentTimeoutId_ = null;
},
switch (this.state_) {
case cellularSetup.PSimUIState.STARTING_ACTIVATION:
this.state_ = cellularSetup.PSimUIState.TIMEOUT_START_ACTIVATION;
return;
case cellularSetup.PSimUIState.WAITING_FOR_PORTAL_TO_LOAD:
this.state_ = cellularSetup.PSimUIState.TIMEOUT_PORTAL_LOAD;
return;
case cellularSetup.PSimUIState.WAITING_FOR_ACTIVATION_TO_FINISH:
this.state_ = cellularSetup.PSimUIState.TIMEOUT_FINISH_ACTIVATION;
return;
default:
// Only the above states are expected to time out.
assertNotReached();
}
},
/** @private */
startActivation_() {
assert(!this.activationDelegateReceiver_);
this.activationDelegateReceiver_ =
new chromeos.cellularSetup.mojom.ActivationDelegateReceiver(
/**
* @type {!chromeos.cellularSetup.mojom.ActivationDelegateInterface}
*/
(this));
this.mojoInterfaceProvider_.getMojoServiceRemote()
.startActivation(
this.activationDelegateReceiver_.$.bindNewPipeAndPassRemote())
.then(
/**
* @param {!chromeos.cellularSetup.
* mojom.CellularSetup_StartActivation_ResponseParams}
* params
*/
(params) => {
this.carrierPortalHandler_ = params.observer;
});
},
/** @private */
closeActivationConnection_() {
assert(!!this.activationDelegateReceiver_);
this.activationDelegateReceiver_.$.close();
this.activationDelegateReceiver_ = null;
this.carrierPortalHandler_ = null;
this.cellularMetadata_ = null;
},
/** @private */
clearTimer_() {
if (this.currentTimeoutId_) {
clearTimeout(this.currentTimeoutId_);
}
this.currentTimeoutId_ = null;
},
/** @private */
onCarrierPortalLoaded_() {
this.state_ = PSimUIState.WAITING_FOR_USER_PAYMENT;
this.carrierPortalHandler_.onCarrierPortalStatusChange(
chromeos.cellularSetup.mojom.CarrierPortalStatus
.kPortalLoadedWithoutPaidUser);
},
/** @private */
onCarrierPortalLoaded_() {
this.state_ = cellularSetup.PSimUIState.WAITING_FOR_USER_PAYMENT;
this.carrierPortalHandler_.onCarrierPortalStatusChange(
chromeos.cellularSetup.mojom.CarrierPortalStatus
.kPortalLoadedWithoutPaidUser);
},
/**
* @param {!CustomEvent<boolean>} event
* @private
*/
onCarrierPortalResult_(event) {
const success = event.detail;
this.state_ = success ? PSimUIState.ACTIVATION_SUCCESS :
PSimUIState.ACTIVATION_FAILURE;
},
});
/**
* @param {!CustomEvent<boolean>} event
* @private
*/
onCarrierPortalResult_(event) {
const success = event.detail;
this.state_ = success ? cellularSetup.PSimUIState.ACTIVATION_SUCCESS :
cellularSetup.PSimUIState.ACTIVATION_FAILURE;
},
// #cr_define_end
return {
PSimPageName: PSimPageName,
PSimUIState: PSimUIState,
getTimeoutMsForPSimUIState: getTimeoutMsForPSimUIState
};
});
......@@ -14,11 +14,16 @@ cr_components_chromeos_namespace_rewrites = [
"cellularSetup.Button|Button",
"cellularSetup.ButtonBarState|ButtonBarState",
"cellularSetup.CellularSetupPageName|CellularSetupPageName",
"cellularSetup.PSimPageName|PSimPageName",
"cellularSetup.PSimUIState|PSimUIState",
"cellularSetup.getTimeoutMsForPSimUIState|getTimeoutMsForPSimUIState",
]
cr_components_chromeos_auto_imports = [
"ui/webui/resources/cr_elements/policy/cr_policy_indicator_behavior.html|CrPolicyIndicatorType",
"ui/webui/resources/cr_components/chromeos/cellular_setup/cellular_types.html|ButtonState,Button,ButtonBarState,CellularSetupPageName",
"ui/webui/resources/cr_components/chromeos/cellular_setup/subflow_behavior.html|SubflowBehavior",
"ui/webui/resources/cr_components/chromeos/cellular_setup/mojo_interface_provider.html|MojoInterfaceProviderImpl,MojoInterfaceProvider",
"ui/webui/resources/cr_components/chromeos/network/cr_policy_network_behavior_mojo.html|CrPolicyNetworkBehaviorMojo",
"ui/webui/resources/cr_components/chromeos/network/onc_mojo.html|OncMojo",
"ui/webui/resources/cr_components/chromeos/network/network_listener_behavior.html|NetworkListenerBehavior",
......
......@@ -156,6 +156,14 @@
file="${root_gen_dir}/ui/webui/resources/cr_components/chromeos/cellular_setup/cellular_types.m.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_WEBUI_CHROMEOS_CELLULAR_SETUP_SUBFLOW_BEHAVIOR_M_JS"
file="${root_gen_dir}/ui/webui/resources/cr_components/chromeos/cellular_setup/subflow_behavior.m.js"
use_base_dir="false"
type="BINDATA" />
<include name="IDR_WEBUI_CHROMEOS_CELLULAR_SETUP_PSIM_FLOW_UI_M_JS"
file="${root_gen_dir}/ui/webui/resources/cr_components/chromeos/cellular_setup/psim_flow_ui.m.js"
use_base_dir="false"
type="BINDATA" />
</if>
<if expr="use_nss_certs">
<include name="IDR_WEBUI_CA_TRUST_EDIT_DIALOG_JS"
......
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