Commit d9380003 authored by Yunke Zhou's avatar Yunke Zhou Committed by Commit Bot

Oobe: refactor AssistantOptInScreen to use LoginScreenBehavior

Bug: 1132761
Change-Id: I7c1692e80bf6c593cb56f746245b5a2a25cf8bc1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2438379Reviewed-by: default avatarDenis Kuznetsov [CET] <antrim@chromium.org>
Commit-Queue: Yunke Zhou <yunkez@google.com>
Cr-Commit-Position: refs/heads/master@{#814098}
parent 52ff08a3
......@@ -34,6 +34,7 @@ js_type_check("closure_compile") {
":oobe_i18n_dropdown",
":oobe_network",
":oobe_reset",
":oobe_screen_assistant_optin_flow",
":oobe_select",
":oobe_supervision_transition",
":oobe_update",
......@@ -250,6 +251,14 @@ js_library("oobe_reset") {
]
}
js_library("oobe_screen_assistant_optin_flow") {
deps = [
"components:login_screen_behavior",
"components:oobe_dialog_host_behavior",
"components:oobe_i18n_behavior",
]
}
js_library("oobe_supervision_transition") {
deps = [
"components:login_screen_behavior",
......
......@@ -20,7 +20,6 @@
// src="../../../../../ui/login/account_picker/chromeos_user_pod_row.js">
// <include src="cr_ui.js">
// <include src="oobe_screen_autolaunch.js">
// <include src="oobe_screen_assistant_optin_flow.js">
// <include src="oobe_select.js">
// <include src="screen_app_launch_splash.js">
......@@ -58,7 +57,6 @@ cr.define('cr.ui.Oobe', function() {
login.AppLaunchSplashScreen.register();
login.FatalErrorScreen.register();
login.DiscoverScreen.register();
login.AssistantOptInFlowScreen.register();
login.MultiDeviceSetupScreen.register();
cr.ui.Bubble.decorate($('bubble-persistent'));
......
......@@ -21,7 +21,6 @@
// src="../../../../../ui/login/account_picker/chromeos_user_pod_row.js">
// <include src="cr_ui.js">
// <include src="oobe_screen_autolaunch.js">
// <include src="oobe_screen_assistant_optin_flow.js">
// <include src="oobe_select.js">
// <include src="screen_app_launch_splash.js">
......@@ -54,7 +53,6 @@ cr.define('cr.ui.Oobe', function() {
login.AppLaunchSplashScreen.register();
login.FatalErrorScreen.register();
login.DiscoverScreen.register();
login.AssistantOptInFlowScreen.register();
login.MultiDeviceSetupScreen.register();
cr.ui.Bubble.decorate($('bubble-persistent'));
......
......@@ -2,7 +2,10 @@
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<div class="step hidden" id="assistant-optin-flow"
role="group" hidden>
<assistant-optin-flow id="assistant-optin-flow-card"></assistant-optin-flow>
</div>
<include src="../assistant_optin/assistant_optin_flow.html">
<dom-module id="assistant-optin">
<template>
<assistant-optin-flow id="card"></assistant-optin-flow>
</template>
</dom-module>
......@@ -2,58 +2,85 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// <include src="../assistant_optin/assistant_optin_flow.js">
/**
* @fileoverview Oobe Assistant OptIn Flow screen implementation.
*/
login.createScreen(
'AssistantOptInFlowScreen', 'assistant-optin-flow', function() {
return {
EXTERNAL_API: [
'reloadContent', 'addSettingZippy', 'showNextScreen',
'onVoiceMatchUpdate'
],
/** Initial UI State for screen */
getOobeUIInitialState() {
return OOBE_UI_STATE.ONBOARDING;
},
/** @Override */
onBeforeShow(data) {
$('assistant-optin-flow-card').onShow();
},
/**
* Reloads localized strings.
* @param {!Object} data New dictionary with i18n values.
*/
reloadContent(data) {
$('assistant-optin-flow-card').reloadContent(data);
},
/**
* Add a setting zippy object in the corresponding screen.
* @param {string} type type of the setting zippy.
* @param {!Object} data String and url for the setting zippy.
*/
addSettingZippy(type, data) {
$('assistant-optin-flow-card').addSettingZippy(type, data);
},
/**
* Show the next screen in the flow.
*/
showNextScreen() {
$('assistant-optin-flow-card').showNextScreen();
},
/**
* Called when the Voice match state is updated.
* @param {string} state the voice match state.
*/
onVoiceMatchUpdate(state) {
$('assistant-optin-flow-card').onVoiceMatchUpdate(state);
},
};
Polymer({
is: 'assistant-optin',
behaviors: [OobeI18nBehavior, OobeDialogHostBehavior, LoginScreenBehavior],
EXTERNAL_API: [
'reloadContent',
'addSettingZippy',
'showNextScreen',
'onVoiceMatchUpdate',
],
ready() {
this.initializeLoginScreen('AssistantOptInFlowScreen', {
resetAllowed: false,
});
},
/**
* Returns default event target element.
* @type {Object}
*/
get defaultControl() {
return this.$.card;
},
/** Initial UI State for screen */
getOobeUIInitialState() {
return OOBE_UI_STATE.ONBOARDING;
},
/**
* Event handler that is invoked just before the frame is shown.
* @param {Object} data Screen init payload
* @suppress {missingProperties}
*/
onBeforeShow(data) {
this.$.card.onShow();
},
/**
* Reloads localized strings.
* @param {!Object} data New dictionary with i18n values.
* @suppress {missingProperties}
*/
reloadContent(data) {
this.$.card.reloadContent(data);
},
/**
* Add a setting zippy object in the corresponding screen.
* @param {string} type type of the setting zippy.
* @param {!Object} data String and url for the setting zippy.
* @suppress {missingProperties}
*/
addSettingZippy(type, data) {
this.$.card.addSettingZippy(type, data);
},
/**
* Show the next screen in the flow.
* @suppress {missingProperties}
*/
showNextScreen() {
this.$.card.showNextScreen();
},
/**
* Called when the Voice match state is updated.
* @param {string} state the voice match state.
* @suppress {missingProperties}
*/
onVoiceMatchUpdate(state) {
this.$.card.onVoiceMatchUpdate(state);
},
});
......@@ -44,7 +44,7 @@
<include src="../app_downloading.html">
<include src="../discover/discover_components.html">
<include src="../marketing_opt_in.html">
<include src="../../assistant_optin/assistant_optin_flow.html">
<include src="../oobe_screen_assistant_optin_flow.html">
<include src="../multidevice_setup_first_run.html">
<include src="../security_token_pin.html">
<include src="../gesture_navigation.html">
......
......@@ -43,7 +43,7 @@
// <include src="../app_downloading.js">
// <include src="../discover/discover_components.js">
// <include src="../marketing_opt_in.js">
// <include src="../../assistant_optin/assistant_optin_flow.js">
// <include src="../oobe_screen_assistant_optin_flow.js">
// <include src="../multidevice_setup_first_run.js">
// <include src="../security_token_pin.js">
// <include src="../gesture_navigation.js">
......
......@@ -9,7 +9,8 @@
</oobe-adb-sideloading-screen>
<kiosk-enable id="kiosk-enable" class="step hidden">
</kiosk-enable>
<include src="../oobe_screen_assistant_optin_flow.html">
<assistant-optin id="assistant-optin-flow" class="step hidden">
</assistant-optin>
<include src="../../../../../../ui/login/account_picker/chromeos_screen_account_picker.html">
<include src="../screen_error_message.html">
<include src="../screen_arc_terms_of_service.html">
......
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