Skip to content

Commit

Permalink
[fyfre] Add tangible sync feature to Sync Confirmation
Browse files Browse the repository at this point in the history
Bug: 1374702
Change-Id: I1eb63284f5876719d278b0dc9ed6a412d7f1f3f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3956057
Reviewed-by: Nicolas Dossou-Gbété <dgn@chromium.org>
Reviewed-by: Alex Ilin <alexilin@chromium.org>
Commit-Queue: Gabriel Oliveira <gabolvr@google.com>
Cr-Commit-Position: refs/heads/main@{#1067458}
  • Loading branch information
Gabriel Oliveira authored and Chromium LUCI CQ committed Nov 4, 2022
1 parent 550394d commit 659a059
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
which user clicks to indicate consent.
-->

<template is="dom-if" if="[[isModalDialog_]]">
<template is="dom-if" if="[[isModalDialogWithoutTangibleSync_()]]">
<template is="dom-if" if="[[!isSigninInterceptFre_]]">
<div id="illustration-container">
<div id="grey-banner"></div>
Expand Down Expand Up @@ -357,7 +357,7 @@ <h1 id="syncConfirmationHeading" class="heading" consent-description>
</div>
</template>

<template is="dom-if" if="[[!isModalDialog_]]">
<template is="dom-if" if="[[isWindowVersionWithoutTangibleSync_()]]">
<div id="confirmationContainer">
<div id="headerContainer">
<div id="syncPromoBanner"></div>
Expand Down Expand Up @@ -409,3 +409,7 @@ <h2 consent-description id="syncConfirmationHeading">
</div>
</div>
</template>

<template is="dom-if" if="[[isTangibleSync_]]">
Tangible Sync under construction.
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ export class SyncConfirmationAppElement extends SyncConfirmationAppElementBase {
},
},

isTangibleSync_: {
type: Boolean,
value() {
return loadTimeData.getBoolean('isTangibleSync');
},
},

showEnterpriseBadge_: {
type: Boolean,
value: false,
Expand All @@ -75,6 +82,7 @@ export class SyncConfirmationAppElement extends SyncConfirmationAppElementBase {
private anyButtonClicked_: boolean;
private isModalDialog_: boolean;
private isSigninInterceptFre_: boolean;
private isTangibleSync_: boolean;
private showEnterpriseBadge_: boolean;
private syncConfirmationBrowserProxy_: SyncConfirmationBrowserProxy =
SyncConfirmationBrowserProxyImpl.getInstance();
Expand Down Expand Up @@ -144,6 +152,14 @@ export class SyncConfirmationAppElement extends SyncConfirmationAppElementBase {
string {
return isSigninInterceptFre ? 'signin-intercept-design' : '';
}

private isModalDialogWithoutTangibleSync_(): boolean {
return this.isModalDialog_ && !this.isTangibleSync_;
}

private isWindowVersionWithoutTangibleSync_(): boolean {
return !this.isModalDialog_ && !this.isTangibleSync_;
}
}

declare global {
Expand Down
9 changes: 9 additions & 0 deletions chrome/browser/ui/webui/signin/sync_confirmation_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/signin_resources.h"
#include "components/signin/public/base/avatar_icon_util.h"
#include "components/signin/public/base/signin_switches.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/web_ui.h"
Expand Down Expand Up @@ -78,6 +79,12 @@ SyncConfirmationUI::SyncConfirmationUI(content::WebUI* web_ui)
g_browser_process->GetApplicationLocale(), &strings);
source->AddLocalizedStrings(strings);

if (url.query().find("debug") != std::string::npos) {
// Not intended to be hooked to anything. The dialog will not initialize it
// so we force it here.
InitializeMessageHandlerWithBrowser(nullptr);
}

content::WebUIDataSource::Add(profile_, source);
}

Expand Down Expand Up @@ -113,11 +120,13 @@ void SyncConfirmationUI::InitializeForSyncConfirmation(
source->SetDefaultResource(
IDR_SIGNIN_SYNC_CONFIRMATION_SYNC_CONFIRMATION_HTML);

bool isTangibleSync = base::FeatureList::IsEnabled(switches::kTangibleSync);
source->AddBoolean("isModalDialog",
style == SyncConfirmationStyle::kDefaultModal ||
style == SyncConfirmationStyle::kSigninInterceptModal);
source->AddBoolean("isSigninInterceptFre",
style == SyncConfirmationStyle::kSigninInterceptModal);
source->AddBoolean("isTangibleSync", isTangibleSync);

source->AddString("accountPictureUrl",
profiles::GetPlaceholderAvatarIconUrl());
Expand Down
3 changes: 2 additions & 1 deletion components/signin/public/base/signin_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ BASE_FEATURE(kForceDisableExtendedSyncPromos,
BASE_FEATURE(kForceStartupSigninPromo,
"ForceStartupSigninPromo",
base::FEATURE_DISABLED_BY_DEFAULT);
#endif

// Enables a new version of the sync confirmation UI.
BASE_FEATURE(kTangibleSync, "TangibleSync", base::FEATURE_DISABLED_BY_DEFAULT);
#endif

} // namespace switches
3 changes: 2 additions & 1 deletion components/signin/public/base/signin_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ BASE_DECLARE_FEATURE(kForceDisableExtendedSyncPromos);
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
BASE_DECLARE_FEATURE(kEnableCbdSignOut);
BASE_DECLARE_FEATURE(kForceStartupSigninPromo);
BASE_DECLARE_FEATURE(kTangibleSync);
#endif

BASE_DECLARE_FEATURE(kTangibleSync);

} // namespace switches

#endif // COMPONENTS_SIGNIN_PUBLIC_BASE_SIGNIN_SWITCHES_H_

0 comments on commit 659a059

Please sign in to comment.