Commit 3ff1432b authored by Long Cheng's avatar Long Cheng Committed by Commit Bot

Migrate OOBE ARC dialog to Polymer 2

1. Move html out of string resources
2. polymer binding for UI properties most elements.
3. polymer binding for learn more callbacks
4. Move onNext/overlays to arc_terms_of_service for future
   reuse for in session opt-in extension.
5. Use multiple popup overlays with multiple <p> to support
   overlay text with multiple paragragh.
6. Remove skip button as it's no more supported for user.
   Add TODO for clean up.

Not all work is done with this cl. Things need follow up
1. Handle string loading before login.
2. Better handling webview.
3. Terms of service webview loading uses adding class to set
   display: none.
4. Large group of text are still not broken into blocks. 

Bug: 1047807
Test: Update browser tests
Test: Manual
Change-Id: If627f6680d416a134aa429359fb7352fe0cc5de3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2081252Reviewed-by: default avatarDenis Kuznetsov [CET] <antrim@chromium.org>
Commit-Queue: Long Cheng <lgcheng@google.com>
Cr-Commit-Position: refs/heads/master@{#748536}
parent f15f61d9
This diff is collapsed.
......@@ -102,7 +102,7 @@ std::string DialogToStringId(DemoSetupDialog dialog) {
case DemoSetupDialog::kEula:
return "eulaDialog";
case DemoSetupDialog::kArcTos:
return "arc-tos-dialog";
return "arcTosDialog";
case DemoSetupDialog::kProgress:
return "demoSetupProgressDialog";
case DemoSetupDialog::kError:
......@@ -565,12 +565,12 @@ IN_PROC_BROWSER_TEST_F(DemoSetupTest, OnlineSetupFlowSuccess) {
EXPECT_TRUE(IsScreenDialogElementVisible(
ArcTermsOfServiceScreenView::kScreenId, DemoSetupDialog::kArcTos,
"#arc-tos-metrics-demo-apps"));
"#arcTosMetricsDemoApps"));
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-next-button", JSExecution::kSync);
"#arcTosNextButton", JSExecution::kSync);
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-accept-button", JSExecution::kAsync);
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(UpdateView::kScreenId).Wait();
......@@ -658,9 +658,9 @@ IN_PROC_BROWSER_TEST_F(DemoSetupTest,
SetPlayStoreTermsForTesting();
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-next-button", JSExecution::kSync);
"#arcTosNextButton", JSExecution::kSync);
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-accept-button", JSExecution::kAsync);
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(UpdateView::kScreenId).Wait();
......@@ -712,9 +712,9 @@ IN_PROC_BROWSER_TEST_F(DemoSetupTest, OnlineSetupFlowErrorDefault) {
SetPlayStoreTermsForTesting();
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-next-button", JSExecution::kSync);
"#arcTosNextButton", JSExecution::kSync);
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-accept-button", JSExecution::kAsync);
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(UpdateView::kScreenId).Wait();
......@@ -776,9 +776,9 @@ IN_PROC_BROWSER_TEST_F(DemoSetupTest, OnlineSetupFlowErrorPowerwashRequired) {
SetPlayStoreTermsForTesting();
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-next-button", JSExecution::kSync);
"#arcTosNextButton", JSExecution::kSync);
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-accept-button", JSExecution::kAsync);
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(UpdateView::kScreenId).Wait();
......@@ -842,9 +842,9 @@ IN_PROC_BROWSER_TEST_F(DemoSetupTest, OnlineSetupFlowCrosComponentFailure) {
SetPlayStoreTermsForTesting();
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-next-button", JSExecution::kSync);
"#arcTosNextButton", JSExecution::kSync);
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-accept-button", JSExecution::kAsync);
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(UpdateView::kScreenId).Wait();
......@@ -922,12 +922,12 @@ IN_PROC_BROWSER_TEST_F(DemoSetupTest, OfflineSetupFlowSuccess) {
EXPECT_TRUE(IsScreenDialogElementVisible(
ArcTermsOfServiceScreenView::kScreenId, DemoSetupDialog::kArcTos,
"#arc-tos-metrics-demo-apps"));
"#arcTosMetricsDemoApps"));
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-next-button", JSExecution::kSync);
"#arcTosNextButton", JSExecution::kSync);
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-accept-button", JSExecution::kAsync);
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait();
// TODO(agawronska): Progress dialog transition is async - extra work is
......@@ -979,9 +979,9 @@ IN_PROC_BROWSER_TEST_F(DemoSetupTest, OfflineSetupFlowErrorDefault) {
SetPlayStoreTermsForTesting();
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-next-button", JSExecution::kSync);
"#arcTosNextButton", JSExecution::kSync);
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-accept-button", JSExecution::kAsync);
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait();
// TODO(agawronska): Progress dialog transition is async - extra work is
......@@ -1044,9 +1044,9 @@ IN_PROC_BROWSER_TEST_F(DemoSetupTest, OfflineSetupFlowErrorPowerwashRequired) {
SetPlayStoreTermsForTesting();
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-next-button", JSExecution::kSync);
"#arcTosNextButton", JSExecution::kSync);
ClickOobeButtonWithSelector(ArcTermsOfServiceScreenView::kScreenId,
"#arc-tos-accept-button", JSExecution::kAsync);
"#arcTosAcceptButton", JSExecution::kAsync);
OobeScreenWaiter(DemoSetupScreenView::kScreenId).Wait();
// TODO(agawronska): Progress dialog transition is async - extra work is
......
......@@ -77,7 +77,7 @@ using net::test_server::HttpResponse;
namespace chromeos {
namespace {
enum class ArcState { kNotAvailable, kAcceptTerms, kDeclineTerms };
enum class ArcState { kNotAvailable, kAcceptTerms };
std::string ArcStateToString(ArcState arc_state) {
switch (arc_state) {
......@@ -85,8 +85,6 @@ std::string ArcStateToString(ArcState arc_state) {
return "not-available";
case ArcState::kAcceptTerms:
return "accept-terms";
case ArcState::kDeclineTerms:
return "decline-terms";
}
NOTREACHED();
return "unknown";
......@@ -150,7 +148,7 @@ void WaitForGaiaSignInScreen(bool arc_available) {
if (arc_available) {
test::OobeJS()
.CreateHasClassWaiter(true, "arc-tos-loaded",
{"arc-tos-root", "arc-tos-dialog"})
{"arc-tos-root", "arcTosDialog"})
->Wait();
}
......@@ -202,10 +200,9 @@ void RunDiscoverScreenChecks() {
EXPECT_FALSE(ash::LoginScreenTestApi::IsAddUserButtonShown());
}
// Waits for the ARC terms of service screen to be shown, it accepts or
// declines the terms based in |accept_terms| value, and waits for the flow to
// leave the ARC terms of service screen.
void HandleArcTermsOfServiceScreen(bool accept_terms) {
// Waits for the ARC terms of service screen to be shown, it accepts
// the terms, and waits for the flow to leave the ARC terms of service screen.
void HandleArcTermsOfServiceScreen() {
OobeScreenWaiter(ArcTermsOfServiceScreenView::kScreenId).Wait();
LOG(INFO) << "OobeInteractiveUITest: Switched to 'arc-tos' screen.";
......@@ -214,19 +211,17 @@ void HandleArcTermsOfServiceScreen(bool accept_terms) {
EXPECT_FALSE(ash::LoginScreenTestApi::IsAddUserButtonShown());
test::OobeJS()
.CreateEnabledWaiter(true, {"arc-tos-root", "arc-tos-next-button"})
.CreateEnabledWaiter(true, {"arc-tos-root", "arcTosNextButton"})
->Wait();
test::OobeJS().TapOnPath({"arc-tos-root", "arc-tos-next-button"});
test::OobeJS().TapOnPath({"arc-tos-root", "arcTosNextButton"});
test::OobeJS()
.CreateVisibilityWaiter(true, {"arc-tos-root", "arc-location-service"})
.CreateVisibilityWaiter(true, {"arc-tos-root", "arcLocationService"})
->Wait();
test::OobeJS()
.CreateVisibilityWaiter(true, {"arc-tos-root", "arc-tos-accept-button"})
.CreateVisibilityWaiter(true, {"arc-tos-root", "arcTosAcceptButton"})
->Wait();
const std::string button_to_click =
accept_terms ? "arc-tos-accept-button" : "arc-tos-skip-button";
test::OobeJS().TapOnPath({"arc-tos-root", button_to_click});
test::OobeJS().TapOnPath({"arc-tos-root", "arcTosAcceptButton"});
OobeScreenExitWaiter(ArcTermsOfServiceScreenView::kScreenId).Wait();
LOG(INFO) << "OobeInteractiveUITest: 'arc-tos' screen done.";
......@@ -736,8 +731,7 @@ void OobeInteractiveUITest::PerformSessionSignInSteps(
}
if (test_setup()->arc_state() != ArcState::kNotAvailable) {
HandleArcTermsOfServiceScreen(test_setup()->arc_state() ==
ArcState::kAcceptTerms);
HandleArcTermsOfServiceScreen();
}
if (test_setup()->arc_state() == ArcState::kAcceptTerms) {
......@@ -787,8 +781,7 @@ INSTANTIATE_TEST_SUITE_P(
testing::Bool(),
testing::Bool(),
testing::Values(ArcState::kNotAvailable,
ArcState::kAcceptTerms,
ArcState::kDeclineTerms)));
ArcState::kAcceptTerms)));
class OobeZeroTouchInteractiveUITest : public OobeInteractiveUITest {
public:
......@@ -861,8 +854,7 @@ INSTANTIATE_TEST_SUITE_P(
testing::Bool(),
testing::Bool(),
testing::Values(ArcState::kNotAvailable,
ArcState::kAcceptTerms,
ArcState::kDeclineTerms)));
ArcState::kAcceptTerms)));
class PublicSessionOobeTest : public MixinBasedInProcessBrowserTest,
public ::testing::WithParamInterface<
......@@ -954,8 +946,7 @@ INSTANTIATE_TEST_SUITE_P(
testing::Combine(testing::Bool(),
testing::Bool(),
testing::Bool(),
testing::Values(ArcState::kNotAvailable,
ArcState::kDeclineTerms)));
testing::Values(ArcState::kNotAvailable)));
class PublicSessionWithTermsOfServiceOobeTest : public PublicSessionOobeTest {
public:
......@@ -989,8 +980,7 @@ INSTANTIATE_TEST_SUITE_P(
testing::Combine(testing::Bool(),
testing::Bool(),
testing::Bool(),
testing::Values(ArcState::kNotAvailable,
ArcState::kDeclineTerms)));
testing::Values(ArcState::kNotAvailable)));
class EphemeralUserOobeTest : public MixinBasedInProcessBrowserTest,
public ::testing::WithParamInterface<
......@@ -1071,8 +1061,7 @@ IN_PROC_BROWSER_TEST_P(EphemeralUserOobeTest, DISABLED_RegularEphemeralUser) {
}
if (test_setup()->arc_state() != ArcState::kNotAvailable) {
HandleArcTermsOfServiceScreen(test_setup()->arc_state() ==
ArcState::kAcceptTerms);
HandleArcTermsOfServiceScreen();
}
if (test_setup()->arc_state() == ArcState::kAcceptTerms) {
......@@ -1098,6 +1087,5 @@ INSTANTIATE_TEST_SUITE_P(
testing::Bool(),
testing::Bool(),
testing::Values(ArcState::kNotAvailable,
ArcState::kAcceptTerms,
ArcState::kDeclineTerms)));
ArcState::kAcceptTerms)));
} // namespace chromeos
......@@ -130,10 +130,6 @@ js_library("arc_terms_of_service") {
":html-echo",
":oobe_dialog_host_behavior",
":oobe_i18n_behavior",
# This is a temporary change to proceed with Polymer v2 migration.
# TODO (https://crbug.com/1047807) : remove this dependecy.
"//ui/webui/resources/js:i18n_template",
]
}
......
......@@ -14,37 +14,25 @@ p {
padding: 0;
}
.arc-tos-disable-skip #arc-tos-skip-button,
.arc-tos-loaded .arc-tos-loading,
.arc-tos-loaded .arc-tos-error,
.arc-tos-loaded #arc-tos-retry-button,
.arc-tos-loaded #arcTosRetryButton,
.arc-tos-loading .arc-tos-content,
.arc-tos-loading .arc-tos-error,
.arc-tos-loading #arc-tos-retry-button,
.arc-tos-loading #arc-tos-accept-button,
.arc-tos-loading #arcTosRetryButton,
.arc-tos-loading #arcTosAcceptButton,
.error .arc-tos-content,
.error .arc-tos-loading,
.error #arc-tos-accept-button,
.error #arc-tos-next-button {
.error #arcTosAcceptButton,
.error #arcTosNextButton {
display: none;
}
.arc-tos-loading #arc-tos-next-button,
.arc-tos-loading #arc-tos-skip-button,
.arc-tos-loading #arc-tos-retry-button {
.arc-tos-loading #arcTosNextButton,
.arc-tos-loading #arcTosRetryButton {
pointer-events: none;
}
.arc-tos-for-demo-mode #arc-location-service,
.arc-tos-for-demo-mode #arc-backup-service {
display: none;
}
#arc-tos-dialog:not(.arc-tos-for-demo-mode) #arc-tos-back-button,
#arc-tos-dialog:not(.arc-tos-for-demo-mode) #arc-tos-metrics-demo-apps {
display: none;
}
.arc-tos-loading p,
.error p {
color: rgba(0, 0, 0, 0.87);
......@@ -59,25 +47,22 @@ p {
padding: 0 20px 16px 20px;
}
#arc-policy-link {
#arcPolicyLink {
margin: 0;
padding: 16px 0 16px 20px;
}
#arc-tos-skip-button {
color: rgba(0, 0, 0, 0.54);
}
#google-service-confirmation-text {
#arcGoogleServiceConfirmation {
font-weight: 600;
}
#arc-tos-container::-webkit-scrollbar {
#arcTosContainer::-webkit-scrollbar {
display: none;
}
#arc-tos-view {
#arcTosView {
display: block;
height: 100%;
margin: auto;
......@@ -86,13 +71,27 @@ p {
width: 100%;
}
#arc-tos-view-container {
#arcTosViewContainer {
box-sizing: border-box;
margin: 0;
padding: 0;
}
#arc-tos-back-button,
#arc-tos-skip-button {
#arcTosBackButton {
padding-inline-end: 6px;
}
#arcTosOverlayWebview {
border: 1px solid #d9d9d9;
display: block;
height: 300px;
width: 100%;
}
#arcTosOverlayWebviewContainer {
box-sizing: border-box;
height: 332px;
margin: auto;
padding: 24px 8px 8px 8px;
width: 100%;
}
......@@ -11,49 +11,88 @@
<link rel="stylesheet" href="oobe_dialog_host.css">
<link rel="stylesheet" href="arc_terms_of_service.css">
<link rel="stylesheet" href="oobe_flex_layout.css">
<oobe-dialog id="arc-tos-dialog" has-buttons class="arc-tos-loading"
<oobe-dialog id="arcTosDialog" has-buttons class="arc-tos-loading"
title-key="arcTermsOfServiceScreenHeading"
subtitle-key="arcTermsOfServiceScreenDescription">
<iron-icon src="chrome://oobe/playstore.svg" slot="oobe-icon">
</iron-icon>
<div id="arc-tos-container" slot="footer" class="flex layout vertical">
<div id="arc-tos-view-container" class="arc-tos-content flex">
<webview id="arc-tos-view" allowTransparency
<div id="arcTosContainer" slot="footer" class="flex layout vertical">
<div id="arcTosViewContainer" class="arc-tos-content flex">
<webview id="arcTosView" allowTransparency
class="oobe-tos-webview"></webview>
</div>
<div id="arc-policy-link" class="arc-tos-content">
<a href="#" i18n-content="arcPolicyLink"></a>
<div id="arcPolicyLink" class="arc-tos-content">
<a href="#">[[i18nDynamic(locale, 'arcPolicyLink')]]</a>
</div>
<div class="parameter-section arc-tos-content">
<p id="arc-text-metrics"></p>
<div class="parameter-section arc-tos-content"
hidden="[[isMetricsHidden]]">
<p>
<span>[[i18nDynamic(locale, metricsTextKey)]]</span>
<a href="#" id="learnMoreLinkMetrics"
on-tap="onMetricsLearnMoreTap_">
[[i18nDynamic(locale, 'arcLearnMoreText')]]
</a>
</p>
</div>
<div id="arc-tos-metrics-demo-apps"
class="parameter-section arc-tos-content">
<div id="arcTosMetricsDemoApps"
class="parameter-section arc-tos-content"
hidden="[[!demoMode]]">
<p>[[i18nDynamic(locale, 'arcTextMetricsDemoApps')]]</p>
</div>
<div id="arc-backup-service" class="parameter-section arc-tos-content">
<cr-checkbox id="arc-enable-backup-restore">
<p i18n-values=".innerHTML:arcTextBackupRestore"></p>
<div id="arcBackupService"
class="parameter-section arc-tos-content"
disabled="[[backupRestoreManaged]]"
hidden="[[demoMode]]">
<cr-checkbox id="arcEnableBackupRestore"
checked="{{backupRestore}}"
disabled="[[backupRestoreManaged]]">
<p>
<span>[[i18nDynamic(locale, 'arcTextBackupRestore')]]</span>
<a href="#" id="learnMoreLinkBackupRestore"
on-tap="onBackupRestoreLearnMoreTap_">
[[i18nDynamic(locale, 'arcLearnMoreText')]]
</a>
</p>
</cr-checkbox>
</div>
<div id="arc-location-service"
class="parameter-section arc-tos-content">
<cr-checkbox id="arc-enable-location-service">
<p i18n-values=".innerHTML:arcTextLocationService"></p>
</cr-checkbox>
</div>
<div id="arc-pai-service" class="parameter-section arc-tos-content">
<p i18n-values=".innerHTML:arcTextPaiService"></p>
</div>
<div id="arc-google-service-confirmation"
class="parameter-section arc-tos-content">
<p id="google-service-confirmation-text"
i18n-values=".innerHTML:arcTextGoogleServiceConfirmation"></p>
</div>
<div id="arc-review-settings" class="parameter-section arc-tos-content">
<cr-checkbox id="arc-review-settings-checkbox">
<p i18n-values=".innerHTML:arcTextReviewSettings"></p>
</cr-checkbox>
<div id="arcExtraContent" hidden="[[!showFullDialog]]">
<div id="arcLocationService"
class="parameter-section arc-tos-content"
disabled="[[locationServiceManaged]]"
hidden="[[demoMode]]">
<cr-checkbox id="arcEnableLocationService"
checked="{{locationService}}"
disabled="[[locationServiceManaged]]">
<p>
<span>[[i18nDynamic(locale, 'arcTextLocationService')]]</span>
<a href="#" id="learnMoreLinkLocationService"
on-tap="onLocationServiceLearnMoreTap_">
[[i18nDynamic(locale, 'arcLearnMoreText')]]
</a>
</p>
</cr-checkbox>
</div>
<div id="arcPaiService" class="parameter-section arc-tos-content">
<p>
<span>[[i18nDynamic(locale, 'arcTextPaiService')]]</span>
<a href="#" id="learnMoreLinkPai"
on-tap="onPaiLearnMoreTap_">
[[i18nDynamic(locale, 'arcLearnMoreText')]]
</a>
</p>
</div>
<div id="arcGoogleServiceConfirmation"
class="parameter-section arc-tos-content">
<p>[[i18nDynamic(locale, googleServiceConfirmationTextKey)]]</p>
</div>
<div id="arcReviewSettings"
class="parameter-section arc-tos-content"
hidden="[[demoMode]]">
<cr-checkbox id="arcReviewSettingsCheckbox"
checked="{{reviewSettings}}">
<p>[[i18nDynamic(locale, 'arcTextReviewSettings')]]</p>
</cr-checkbox>
</div>
</div>
<div class="arc-tos-loading">
<p>[[i18nDynamic(locale, 'arcTermsOfServiceLoading')]]</p>
......@@ -63,26 +102,77 @@
</div>
</div>
<div slot="bottom-buttons" class="flex layout horizontal">
<oobe-back-button id="arc-tos-back-button"
<oobe-back-button id="arcTosBackButton" hidden="[[!demoMode]]"
on-click="onBack_"></oobe-back-button>
<div class="flex">
</div>
<oobe-text-button id="arc-tos-skip-button" border on-tap="onSkip_"
disabled="[[arcTosButtonsDisabled]]"
text-key="arcTermsOfServiceSkipButton"></oobe-text-button>
<oobe-text-button id="arc-tos-retry-button"
<oobe-text-button id="arcTosRetryButton"
inverse on-tap="onRetry_"
disabled="[[arcTosButtonsDisabled]]"
text-key="arcTermsOfServiceRetryButton"></oobe-text-button>
<oobe-text-button id="arc-tos-next-button"
<oobe-text-button id="arcTosNextButton"
inverse on-tap="onNext_"
disabled="[[arcTosButtonsDisabled]]"
hidden="[[showFullDialog]]"
text-key="arcTermsOfServiceNextButton"></oobe-text-button>
<oobe-text-button id="arc-tos-accept-button"
<oobe-text-button id="arcTosAcceptButton"
inverse on-tap="onAccept_"
disabled="[[arcTosButtonsDisabled]]"
text-key="arcTermsOfServiceAcceptButton"></oobe-text-button>
hidden="[[!showFullDialog]]"
text-key="[[acceptTextKey]]"></oobe-text-button>
</div>
</oobe-dialog>
<oobe-help-dialog id="arcMetricsPopup" on-close="onOverlayClosed_"
title-key="arcLearnMoreStatisticsTitle">
<div slot="content">
<p>[[i18nDynamic(locale, 'arcLearnMoreStatisticsP1')]]</p>
<p>[[i18nDynamic(locale, 'arcLearnMoreStatisticsP2')]]</p>
<p>[[i18nDynamic(locale, 'arcLearnMoreStatisticsP3')]]</p>
<p>[[i18nDynamic(locale, 'arcLearnMoreStatisticsP4')]]</p>
</div>
</oobe-help-dialog>
<oobe-help-dialog id="arcBackupRestorePopup" on-close="onOverlayClosed_"
title-key="arcLearnMoreBackupAndRestoreTitle">
<div slot="content">
<p>[[i18nDynamic(locale, 'arcLearnMoreBackupAndRestoreP1')]]</p>
<p>[[i18nDynamic(locale, 'arcLearnMoreBackupAndRestoreP2')]]</p>
<p>[[i18nDynamic(locale, 'arcLearnMoreBackupAndRestoreP3')]]</p>
<p>[[i18nDynamic(locale, 'arcLearnMoreBackupAndRestoreP4')]]</p>
<p>[[i18nDynamic(locale, 'arcLearnMoreBackupAndRestoreP5')]]</p>
</div>
</oobe-help-dialog>
<oobe-help-dialog id="arcBackupRestoreChildPopup"
on-close="onOverlayClosed_"
title-key="arcLearnMoreBackupAndRestoreTitle">
<div slot="content">
<p>[[i18nDynamic(locale, 'arcLearnMoreBackupAndRestoreChildP1')]]</p>
<p>[[i18nDynamic(locale, 'arcLearnMoreBackupAndRestoreChildP2')]]</p>
<p>[[i18nDynamic(locale, 'arcLearnMoreBackupAndRestoreChildP3')]]</p>
</div>
</oobe-help-dialog>
<oobe-help-dialog id="arcLocationServicePopup"
on-close="onOverlayClosed_"
title-key="arcLearnMoreLocationServiceTitle">
<div slot="content">
<p>[[i18nDynamic(locale, 'arcLearnMoreLocationServiceP1')]]</p>
<p>[[i18nDynamic(locale, 'arcLearnMoreLocationServiceP2')]]</p>
</div>
</oobe-help-dialog>
<oobe-help-dialog id="arcPaiPopup" on-close="onOverlayClosed_"
title-key="arcLearnMorePaiServiceTitle">
<div slot="content">
<p>[[i18nDynamic(locale, 'arcLearnMorePaiService')]]</p>
</div>
</oobe-help-dialog>
<oobe-help-dialog id="arcTosOverlayPrivacyPolicy"
on-close="onOverlayClosed_">
<div slot="content" id = "arcTosOverlayWebviewContainer">
<webview id="arcTosOverlayWebview" hidden="[[overlayLoading_]]">
</webview>
<throbber-notice class="flex layout center-justified vertical"
hidden="[[!overlayLoading_]]" style="height: 100%;">
</throbber-notice>
</div>
</oobe-help-dialog>
</template>
</dom-module>
......@@ -26,14 +26,118 @@ Polymer({
* Reference to OOBE screen object.
* @type {!{
* onAccept: function(),
* onNext: function(),
* onSkip: function(),
* reloadPlayStoreToS: function(),
* }}
*/
screen: {
type: Object,
},
/**
* Indicates whether metrics text should be hidden.
*/
isMetricsHidden: {
type: Boolean,
value: false,
},
/**
* String id for metrics collection text.
*/
metricsTextKey: {
type: String,
value: 'arcTextMetricsEnabled',
},
/**
* String id of Google service confirmation text.
*/
googleServiceConfirmationTextKey: {
type: String,
value: 'arcTextGoogleServiceConfirmation',
},
/**
* String id of text for Accept button.
*/
acceptTextKey: {
type: String,
value: 'arcTermsOfServiceAcceptButton',
},
/**
* Indicates whether backup and restore should be enabled.
*/
backupRestore: {
type: Boolean,
value: true,
},
/**
* Indicates whether backup and restore is managed.
* If backup and restore is managed, the checkbox will be disabled.
*/
backupRestoreManaged: {
type: Boolean,
value: false,
},
/**
* Indicates whether current account is child account.
*/
isChild: {
type: Boolean,
value: false,
},
/**
* Indicates whether location service should be enabled.
*/
locationService: {
type: Boolean,
value: true,
},
/**
* Indicates whether location service is managed.
* If location service is managed, the checkbox will be disabled.
*/
locationServiceManaged: {
type: Boolean,
value: false,
},
/**
* Indicates whether user will review Arc settings after login.
*/
reviewSettings: {
type: Boolean,
value: false,
},
/**
* Indicates whether user sees full content of terms of service.
*/
showFullDialog: {
type: Boolean,
value: false,
},
/**
* Indicates whether currently under demo mode.
*/
demoMode: {
type: Boolean,
value: false,
},
/**
* Indicates whether popup overlay webview is loading.
*/
overlayLoading_: {
type: Boolean,
value: true,
},
},
/**
......@@ -48,6 +152,13 @@ Polymer({
*/
is_shown_: false,
/**
* Last focused element when overlay is shown. Used to resume focus when
* overlay is dismissed.
* @private {Object|null}
*/
lastFocusedElement_: null,
/** Called when dialog is shown */
onBeforeShow() {
this.behaviors.forEach((behavior) => {
......@@ -58,29 +169,35 @@ Polymer({
window.setTimeout(this.applyOobeConfiguration_.bind(this), 0);
},
/**
* Returns element by its id.
*/
getElement(id) {
return this.$[id];
/** Setups overlay webview loading callback */
setupOverlay() {
var self = this;
this.$.arcTosOverlayWebview.addEventListener(
'contentload', function() {
self.overlayLoading_ = false;
});
},
/**
* Returns focused element inside this element.
* Opens external URL in popup overlay.
* @param {string} targetUrl to show in overlay webview.
* @param {boolean} isUsingOfflineTerm whether to use offline url.
*/
getActiveElement(id) {
return this.shadowRoot.activeElement;
showUrlOverlay(targetUrl, isUsingOfflineTerm) {
if (!isUsingOfflineTerm) {
this.$.arcTosOverlayWebview.src = targetUrl;
}
this.lastFocusedElement_ = this.shadowRoot.activeElement;
this.overlayLoading_ = true;
this.$.arcTosOverlayPrivacyPolicy.showDialog();
},
// TODO(crbug.com/1047807): This is a temporary quickfix to proceed with
// Polymer v2 migration. This screen should be reworked to avoid using
// i18nTemplate.process call.
i18nUpdateLocale() {
this.behaviors.forEach((behavior) => {
if (behavior.i18nUpdateLocale)
behavior.i18nUpdateLocale.call(this);
});
i18nTemplate.process(this.shadowRoot, loadTimeData);
/**
* Returns element by its id.
*/
getElement(id) {
return this.$[id];
},
/**
......@@ -134,7 +251,9 @@ Polymer({
* @private
*/
onNext_() {
this.screen.onNext();
this.showFullDialog = true;
this.$.arcTosDialog.scrollToBottom();
this.$.arcTosAcceptButton.focus();
},
/**
......@@ -147,20 +266,62 @@ Polymer({
},
/**
* On-tap event handler for Skip button.
* On-tap event handler for Back button.
*
* @private
*/
onSkip_() {
this.screen.onSkip();
onBack_() {
chrome.send('login.ArcTermsOfServiceScreen.userActed', ['go-back']);
},
/**
* On-tap event handler for Back button.
*
* On-tap event handler for metrics learn more link
* @private
*/
onBack_() {
chrome.send('login.ArcTermsOfServiceScreen.userActed', ['go-back']);
onMetricsLearnMoreTap_() {
this.lastFocusedElement_ = this.shadowRoot.activeElement;
this.$.arcMetricsPopup.showDialog();
},
/**
* On-tap event handler for backup and restore learn more link
* @private
*/
onBackupRestoreLearnMoreTap_() {
this.lastFocusedElement_ = this.shadowRoot.activeElement;
if (this.isChild) {
this.$.arcBackupRestoreChildPopup.showDialog();
} else {
this.$.arcBackupRestorePopup.showDialog();
}
},
/**
* On-tap event handler for location service learn more link
* @private
*/
onLocationServiceLearnMoreTap_() {
this.lastFocusedElement_ = this.shadowRoot.activeElement;
this.$.arcLocationServicePopup.showDialog();
},
/**
* On-tap event handler for Play auto install learn more link
* @private
*/
onPaiLearnMoreTap_() {
this.lastFocusedElement_ = this.shadowRoot.activeElement;
this.$.arcPaiPopup.showDialog();
},
/*
* Callback when overlay is closed.
* @private
*/
onOverlayClosed_() {
if (this.lastFocusedElement_) {
this.lastFocusedElement_.focus();
this.lastFocusedElement_ = null;
}
}
});
......@@ -53,7 +53,6 @@
<link rel="stylesheet" href="oobe_screen_auto_enrollment_check.css">
<link rel="stylesheet" href="oobe_screen_supervision_transition.css">
<link rel="stylesheet" href="screen_app_launch_splash.css">
<link rel="stylesheet" href="screen_arc_terms_of_service.css">
<link rel="stylesheet" href="screen_error_message.css">
<link rel="stylesheet" href="screen_tpm_error.css">
<link rel="stylesheet" href="screen_password_changed.css">
......
......@@ -59,7 +59,6 @@
<link rel="stylesheet" href="oobe_screen_supervision_transition.css">
<link rel="stylesheet" href="screen_app_launch_splash.css">
<link rel="stylesheet" href="screen_arc_terms_of_service.css">
<link rel="stylesheet" href="screen_error_message.css">
<link rel="stylesheet" href="screen_tpm_error.css">
<link rel="stylesheet" href="screen_password_changed.css">
......
/* Copyright 2016 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. */
#arc-tos-overlay-content-text p {
text-align: justify;
}
#arc-tos-overlay-webview {
border: 1px solid #d9d9d9;
display: block;
height: 300px;
width: 100%;
}
#arc-tos-overlay-webview-container.overlay-loading > webview,
#arc-tos-overlay-webview-container:not(.overlay-loading) > div {
display: none;
}
#arc-tos-overlay-webview-container {
box-sizing: border-box;
height: 332px;
margin: auto;
padding: 24px 8px 8px 8px;
width: 100%;
}
......@@ -5,17 +5,4 @@
<div class="step right hidden arc-tos-loading" id="arc-tos"
role="group" hidden>
<arc-tos-root id="arc-tos-root"></arc-tos-root>
<oobe-help-dialog id="arc-tos-overlay-privacy-policy">
<div slot="content" id="arc-tos-overlay-webview-container" >
<webview id="arc-tos-overlay-webview"></webview>
<div class="flex layout center-justified vertical" style="height: 100%;">
<throbber-notice></throbber-notice>
</div>
</div>
</oobe-help-dialog>
<oobe-help-dialog id="arc-tos-overlay-learn-more">
<span slot="content" id="arc-learn-more-content"></span>
</oobe-help-dialog>
</div>
......@@ -115,7 +115,6 @@ void ArcTermsOfServiceScreenHandler::DeclareLocalizedValues(
IDS_ARC_OOBE_TERMS_DESCRIPTION);
builder->Add("arcTermsOfServiceLoading", IDS_ARC_OOBE_TERMS_LOADING);
builder->Add("arcTermsOfServiceError", IDS_ARC_OOBE_TERMS_LOAD_ERROR);
builder->Add("arcTermsOfServiceSkipButton", IDS_ARC_OOBE_TERMS_BUTTON_SKIP);
builder->Add("arcTermsOfServiceRetryButton", IDS_ARC_OOBE_TERMS_BUTTON_RETRY);
builder->Add("arcTermsOfServiceAcceptButton",
IDS_ARC_OOBE_TERMS_BUTTON_ACCEPT);
......@@ -124,44 +123,84 @@ void ArcTermsOfServiceScreenHandler::DeclareLocalizedValues(
builder->Add("arcTermsOfServiceNextButton",
IDS_ARC_OPT_IN_DIALOG_BUTTON_NEXT);
builder->Add("arcPolicyLink", IDS_ARC_OPT_IN_PRIVACY_POLICY_LINK);
builder->Add("arcTextBackupRestore",
is_child_account_ ? IDS_ARC_OPT_IN_DIALOG_BACKUP_RESTORE_CHILD
: IDS_ARC_OPT_IN_DIALOG_BACKUP_RESTORE);
builder->Add("arcTextBackupRestore", is_child_account_
? IDS_ARC_OOBE_BACKUP_RESTORE_CHILD
: IDS_ARC_OOBE_BACKUP_RESTORE);
builder->Add("arcTextLocationService",
is_child_account_ ? IDS_ARC_OPT_IN_LOCATION_SETTING_CHILD
: IDS_ARC_OPT_IN_LOCATION_SETTING);
builder->Add("arcTextPaiService", IDS_ARC_OPT_IN_PAI);
is_child_account_ ? IDS_ARC_OOBE_LOCATION_SETTING_CHILD
: IDS_ARC_OOBE_LOCATION_SETTING);
builder->Add("arcTextPaiService", IDS_ARC_OOBE_PAI);
builder->Add("arcTextGoogleServiceConfirmation",
IDS_ARC_OPT_IN_GOOGLE_SERVICE_CONFIRMATION);
builder->Add("arcTextReviewSettings", IDS_ARC_REVIEW_SETTINGS);
builder->Add("arcTextMetricsEnabled",
IDS_ARC_OOBE_TERMS_DIALOG_METRICS_ENABLED);
builder->Add("arcTextMetricsDisabled",
IDS_ARC_OOBE_TERMS_DIALOG_METRICS_DISABLED);
builder->Add("arcTextMetricsManagedEnabled",
IDS_ARC_OOBE_TERMS_DIALOG_METRICS_MANAGED_ENABLED);
builder->Add("arcTextMetricsManagedDisabled",
IDS_ARC_OOBE_TERMS_DIALOG_METRICS_MANAGED_DISABLED);
builder->Add("arcTextMetricsEnabledChild",
IDS_ARC_OOBE_TERMS_DIALOG_METRICS_ENABLED_CHILD);
builder->Add("arcTextMetricsDisabledChild",
IDS_ARC_OOBE_TERMS_DIALOG_METRICS_DISABLED_CHILD);
builder->Add("arcTextMetricsManagedEnabledChild",
IDS_ARC_OOBE_TERMS_DIALOG_METRICS_MANAGED_ENABLED_CHILD);
builder->Add("arcTextMetricsManagedDisabledChild",
IDS_ARC_OOBE_TERMS_DIALOG_METRICS_MANAGED_DISABLED_CHILD);
builder->Add("arcTextMetricsDemoApps", IDS_ARC_OOBE_TERMS_DIALOG_DEMO_APPS);
builder->Add("arcAcceptAndContinueGoogleServiceConfirmation",
IDS_ARC_OPT_IN_ACCEPT_AND_CONTINUE_GOOGLE_SERVICE_CONFIRMATION);
builder->Add("arcLearnMoreStatisticsTitle",
IDS_ARC_OPT_IN_LEARN_MORE_STATISTICS_TITLE);
builder->Add("arcLearnMoreStatistics",
is_child_account_ ? IDS_ARC_OPT_IN_LEARN_MORE_STATISTICS_CHILD
: IDS_ARC_OPT_IN_LEARN_MORE_STATISTICS);
builder->Add("arcLearnMoreStatisticsP1",
is_child_account_ ? IDS_ARC_OPT_IN_LEARN_MORE_STATISTICS_CHILD_P1
: IDS_ARC_OPT_IN_LEARN_MORE_STATISTICS_P1);
builder->Add("arcLearnMoreStatisticsP2",
is_child_account_ ? IDS_ARC_OPT_IN_LEARN_MORE_STATISTICS_CHILD_P2
: IDS_ARC_OPT_IN_LEARN_MORE_STATISTICS_P2);
builder->Add("arcLearnMoreStatisticsP3",
is_child_account_ ? IDS_ARC_OPT_IN_LEARN_MORE_STATISTICS_CHILD_P3
: IDS_ARC_OPT_IN_LEARN_MORE_STATISTICS_P3);
builder->Add("arcLearnMoreStatisticsP4",
is_child_account_ ? IDS_ARC_OPT_IN_LEARN_MORE_STATISTICS_CHILD_P4
: IDS_ARC_OPT_IN_LEARN_MORE_STATISTICS_P4);
builder->Add("arcLearnMoreLocationServiceTitle",
IDS_ARC_OPT_IN_LEARN_MORE_LOCATION_SERVICES_TITLE);
builder->Add("arcLearnMoreLocationService",
builder->Add("arcLearnMoreLocationServiceP1",
is_child_account_
? IDS_ARC_OPT_IN_LEARN_MORE_LOCATION_SERVICES_CHILD
: IDS_ARC_OPT_IN_LEARN_MORE_LOCATION_SERVICES);
? IDS_ARC_OPT_IN_LEARN_MORE_LOCATION_SERVICES_CHILD_P1
: IDS_ARC_OPT_IN_LEARN_MORE_LOCATION_SERVICES_P1);
builder->Add("arcLearnMoreLocationServiceP2",
is_child_account_
? IDS_ARC_OPT_IN_LEARN_MORE_LOCATION_SERVICES_CHILD_P2
: IDS_ARC_OPT_IN_LEARN_MORE_LOCATION_SERVICES_P2);
builder->Add("arcLearnMoreBackupAndRestoreTitle",
IDS_ARC_OPT_IN_LEARN_MORE_BACKUP_AND_RESTORE_TITLE);
builder->Add("arcLearnMoreBackupAndRestore",
is_child_account_
? IDS_ARC_OPT_IN_LEARN_MORE_BACKUP_AND_RESTORE_CHILD
: IDS_ARC_OPT_IN_LEARN_MORE_BACKUP_AND_RESTORE);
builder->Add("arcLearnMoreBackupAndRestoreP1",
IDS_ARC_OPT_IN_LEARN_MORE_BACKUP_AND_RESTORE_P1);
builder->Add("arcLearnMoreBackupAndRestoreP2",
IDS_ARC_OPT_IN_LEARN_MORE_BACKUP_AND_RESTORE_P2);
builder->Add("arcLearnMoreBackupAndRestoreP3",
IDS_ARC_OPT_IN_LEARN_MORE_BACKUP_AND_RESTORE_P3);
builder->Add("arcLearnMoreBackupAndRestoreP4",
IDS_ARC_OPT_IN_LEARN_MORE_BACKUP_AND_RESTORE_P4);
builder->Add("arcLearnMoreBackupAndRestoreP5",
IDS_ARC_OPT_IN_LEARN_MORE_BACKUP_AND_RESTORE_P5);
builder->Add("arcLearnMoreBackupAndRestoreChildP1",
IDS_ARC_OPT_IN_LEARN_MORE_BACKUP_AND_RESTORE_CHILD_P1);
builder->Add("arcLearnMoreBackupAndRestoreChildP2",
IDS_ARC_OPT_IN_LEARN_MORE_BACKUP_AND_RESTORE_CHILD_P2);
builder->Add("arcLearnMoreBackupAndRestoreChildP3",
IDS_ARC_OPT_IN_LEARN_MORE_BACKUP_AND_RESTORE_CHILD_P3);
builder->Add("arcLearnMorePaiServiceTitle",
IDS_ARC_OPT_IN_LEARN_MORE_PAI_SERVICE_TITLE);
builder->Add("arcLearnMorePaiService", IDS_ARC_OPT_IN_LEARN_MORE_PAI_SERVICE);
builder->Add("arcLearnMorePaiService", IDS_ARC_OOBE_LEARN_MORE_PAI_SERVICE);
builder->Add("arcOverlayClose", IDS_ARC_OOBE_TERMS_POPUP_HELP_CLOSE_BUTTON);
builder->Add("oobeModalDialogClose", IDS_CHROMEOS_OOBE_CLOSE_DIALOG);
builder->Add("arcOverlayLoading", IDS_ARC_POPUP_HELP_LOADING);
builder->Add("arcLearnMoreText", IDS_ARC_OPT_IN_DIALOG_LEARN_MORE_LINK_TEXT);
}
void ArcTermsOfServiceScreenHandler::OnMetricsModeChanged(bool enabled,
......@@ -181,27 +220,24 @@ void ArcTermsOfServiceScreenHandler::OnMetricsModeChanged(bool enabled,
// managed flag.
const bool owner_profile = !owner.is_valid() || user->GetAccountId() == owner;
int message_id;
std::string message;
if (owner_profile && !managed) {
if (is_child_account_) {
message_id = enabled ? IDS_ARC_OOBE_TERMS_DIALOG_METRICS_ENABLED_CHILD
: IDS_ARC_OOBE_TERMS_DIALOG_METRICS_DISABLED_CHILD;
message = enabled ? "arcTextMetricsEnabledChild"
: "arcTextMetricsDisabledChild";
} else {
message_id = enabled ? IDS_ARC_OOBE_TERMS_DIALOG_METRICS_ENABLED
: IDS_ARC_OOBE_TERMS_DIALOG_METRICS_DISABLED;
message = enabled ? "arcTextMetricsEnabled" : "arcTextMetricsDisabled";
}
} else {
if (is_child_account_) {
message_id =
enabled ? IDS_ARC_OOBE_TERMS_DIALOG_METRICS_MANAGED_ENABLED_CHILD
: IDS_ARC_OOBE_TERMS_DIALOG_METRICS_MANAGED_DISABLED_CHILD;
message = enabled ? "arcTextMetricsManagedEnabledChild"
: "arcTextMetricsManagedDisabledChild";
} else {
message_id = enabled ? IDS_ARC_OOBE_TERMS_DIALOG_METRICS_MANAGED_ENABLED
: IDS_ARC_OOBE_TERMS_DIALOG_METRICS_MANAGED_DISABLED;
message = enabled ? "arcTextMetricsManagedEnabled"
: "arcTextMetricsManagedDisabled";
}
}
CallJS("login.ArcTermsOfServiceScreen.setMetricsMode",
l10n_util::GetStringUTF16(message_id), true);
CallJS("login.ArcTermsOfServiceScreen.setMetricsMode", message, true);
}
void ArcTermsOfServiceScreenHandler::OnBackupAndRestoreModeChanged(
......@@ -298,7 +334,8 @@ void ArcTermsOfServiceScreenHandler::DoShow() {
ShowScreen(kScreenId);
arc_managed_ = arc::IsArcPlayStoreEnabledPreferenceManagedForProfile(profile);
CallJS("login.ArcTermsOfServiceScreen.setArcManaged", arc_managed_);
CallJS("login.ArcTermsOfServiceScreen.setArcManaged", arc_managed_,
is_child_account_);
MaybeLoadPlayStoreToS(true);
StartNetworkAndTimeZoneObserving();
......
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