Skip to content

Commit

Permalink
[fyfre]Add manager name in enterprise disclaimer
Browse files Browse the repository at this point in the history
Bug: 1385801
Change-Id: I270f9daff9c050fd9004971cb70a34bd6e2aed1d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4165946
Reviewed-by: Nicolas Dossou-Gbété <dgn@chromium.org>
Reviewed-by: David Roger <droger@chromium.org>
Commit-Queue: Jack Yammine <jyammine@google.com>
Reviewed-by: Monica Basta <msalama@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1096103}
  • Loading branch information
Jack Yammine authored and Chromium LUCI CQ committed Jan 24, 2023
1 parent 8c0a757 commit 1ec0885
Show file tree
Hide file tree
Showing 10 changed files with 269 additions and 47 deletions.
5 changes: 4 additions & 1 deletion chrome/app/profiles_strings.grdp
Original file line number Diff line number Diff line change
Expand Up @@ -761,9 +761,12 @@
<message name="IDS_FRE_ACCEPT_SIGN_IN_BUTTON_TITLE" desc="The title of the button giving the users the choice to sign in to Chrome">
Sign in
</message>
<message name="IDS_FRE_MANAGED_DESCRIPTION" desc="The disclaimer explaining to the users that their device is managed by their organisation">
<message name="IDS_FRE_MANAGED_DESCRIPTION" desc="The disclaimer explaining to the users that their device is managed by their organization">
Your device is managed by your organization. Administrators can access the data in any profile on this device.
</message>
<message name="IDS_FRE_MANAGED_BY_DESCRIPTION" desc="The disclaimer explaining to the users that their device is managed by an administrator">
Your device is managed by <ph name="DOMAIN">$1<ex>example.com</ex></ph>. Administrators can access the data in any profile on this device.
</message>
</if>

</if>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
65d52ef7c5cc53fb94c09d212f2400b8f2426c8a
7 changes: 7 additions & 0 deletions chrome/browser/resources/intro/browser_proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ export interface IntroBrowserProxy {

// Called when the user clicks the "continue without account" button.
continueWithoutAccount(): void;

// Initializes the FRE intro main view.
initializeMainView(): void;
}

export class IntroBrowserProxyImpl implements IntroBrowserProxy {
Expand All @@ -24,6 +27,10 @@ export class IntroBrowserProxyImpl implements IntroBrowserProxy {
chrome.send('continueWithoutAccount');
}

initializeMainView() {
chrome.send('initializeMainView');
}

static getInstance(): IntroBrowserProxy {
return instance || (instance = new IntroBrowserProxyImpl());
}
Expand Down
45 changes: 28 additions & 17 deletions chrome/browser/resources/intro/sign_in_promo.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,11 @@
}

.fade-in {
animation: fade-in-animation 500ms 1 ease-in-out;
animation: fade-in-animation 500ms ease-in-out;
}

.fast-fade-in {
animation: fade-in-animation 300ms ease-in-out;
}

#contentArea {
Expand Down Expand Up @@ -239,7 +243,6 @@

#left-background-image {
animation-duration: 500ms;
animation-iteration-count: 1;
animation-name: left-background-slide-animation, fade-in-animation;
content: var(--left-background-image-url);
left: 0;
Expand All @@ -248,14 +251,13 @@

#right-background-image {
animation-duration: 500ms;
animation-iteration-count: 1;
animation-name: right-background-slide-animation, fade-in-animation;
content: var(--right-background-image-url);
right: 0;
}

#safeZone {
animation: safe-zone-transition-animation 500ms 1 ease-in-out;
animation: safe-zone-transition-animation 500ms ease-in-out;
box-sizing: border-box;
display: flex;
height: calc(100% - var(--btn-container-height));
Expand All @@ -269,7 +271,7 @@
border-top: var(--cr-separator-line);
}

#managed-device-disclaimer {
#managedDeviceDisclaimer {
align-items: center;
border: 1px solid var(--disclaimer-border-color);
border-radius: 8px;
Expand All @@ -283,7 +285,15 @@
padding-inline-end: 18px;
}

#managed-device-disclaimer > p {
#managedDeviceDisclaimer.hidden {
display: none;
}

#managedDeviceDisclaimer.temporarily-hidden {
visibility: hidden;
}

#managedDeviceDisclaimer > p {
flex-grow: 1;
font-family: Roboto, Cantarell, Arial, sans-serif;
margin-block: 0;
Expand Down Expand Up @@ -324,25 +334,26 @@ <h2>[[item.title]]</h2>
</div>
</template>
</div>
<template is="dom-if" if="[[shouldDisplayManagedDisclaimer_]]">
<div id="managed-device-disclaimer" class="fade-in">
<div id="icon-container">
<iron-icon icon="cr:domain"></iron-icon>
</div>
<p>
$i18n{managedDeviceDisclaimer}
</p>
<div class$="[[getDisclaimerVisibilityClass_(isDeviceManaged_, managedDeviceDisclaimer_)]]"
id="managedDeviceDisclaimer">
<div id="icon-container">
<iron-icon icon="cr:domain"></iron-icon>
</div>
</template>
<p>
[[managedDeviceDisclaimer_]]
</p>
</div>
</div>
</div>

<div class="fade-in" id="buttonRow">
<div id="buttonContainer">
<cr-button id="declineSignInButton"
on-click="onContinueWithoutAccountClick_">$i18n{declineSignInButtonTitle}</cr-button>
</cr-button>
disabled="[[areButtonsDisabled_(isDeviceManaged_, managedDeviceDisclaimer_)]]"
on-click="onContinueWithoutAccountClick_">$i18n{declineSignInButtonTitle}</cr-button>
</cr-button>
<cr-button class="action-button" id="acceptSignInButton"
disabled="[[areButtonsDisabled_(isDeviceManaged_, managedDeviceDisclaimer_)]]"
on-click="onContinueWithAccountClick_">$i18n{acceptSignInButtonTitle}</cr-button>
</div>
</div>
58 changes: 49 additions & 9 deletions chrome/browser/resources/intro/sign_in_promo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import './strings.m.js';

import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.js';
import {I18nMixin} from 'chrome://resources/cr_elements/i18n_mixin.js';
import {WebUiListenerMixin} from 'chrome://resources/cr_elements/web_ui_listener_mixin.js';
import {loadTimeData} from 'chrome://resources/js/load_time_data.js';
import {PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';

Expand All @@ -23,6 +24,7 @@ export interface SignInPromoElement {
buttonRow: HTMLElement,
contentArea: HTMLElement,
declineSignInButton: CrButtonElement,
managedDeviceDisclaimer: HTMLElement,
safeZone: HTMLElement,
};
}
Expand All @@ -33,7 +35,7 @@ export interface BenefitCard {
iconName: string;
}

const SignInPromoElementBase = I18nMixin(PolymerElement);
const SignInPromoElementBase = WebUiListenerMixin(I18nMixin(PolymerElement));

export class SignInPromoElement extends SignInPromoElementBase {
static get is() {
Expand Down Expand Up @@ -74,11 +76,14 @@ export class SignInPromoElement extends SignInPromoElementBase {
type: Array,
},

shouldDisplayManagedDisclaimer_: {
managedDeviceDisclaimer_: {
type: String,
value: '',
},

isDeviceManaged_: {
type: Boolean,
value() {
return loadTimeData.getString('managedDeviceDisclaimer').length > 0;
},
value: loadTimeData.getBoolean('isDeviceManaged'),
},
};
}
Expand All @@ -87,11 +92,20 @@ export class SignInPromoElement extends SignInPromoElementBase {
IntroBrowserProxyImpl.getInstance();
private benefitCards_: BenefitCard[];
private divisionLineResizeObserver_: ResizeObserver|null = null;
private shouldDisplayManagedDisclaimer_: boolean;
private managedDeviceDisclaimer_: string;
private isDeviceManaged_: boolean;

override connectedCallback() {
super.connectedCallback();

this.browserProxy_.initializeMainView();
this.toggleDivisionLine_();

if (this.isDeviceManaged_) {
this.addWebUiListener(
'managed-device-disclaimer-updated',
this.handleManagedDeviceDisclaimerUpdate_.bind(this));
}
}

override disconnectedCallback() {
Expand All @@ -101,11 +115,12 @@ export class SignInPromoElement extends SignInPromoElementBase {

override ready() {
super.ready();
this.addEventListener('view-enter-start', this.onViewEnterStart_);
this.addEventListener(
'view-enter-start', this.onViewEnterStart_.bind(this));
}

private onViewEnterStart_() {
this.setTranslationHeightToAlignLogoAndAnimation();
this.setTranslationHeightToAlignLogoAndAnimation_();
}

private toggleDivisionLine_() {
Expand All @@ -118,11 +133,25 @@ export class SignInPromoElement extends SignInPromoElementBase {
this.divisionLineResizeObserver_.observe(safeZone);
}

private handleManagedDeviceDisclaimerUpdate_(disclaimer: string) {
this.managedDeviceDisclaimer_ = disclaimer;
this.$.managedDeviceDisclaimer.classList.remove('temporarily-hidden');
this.$.managedDeviceDisclaimer.classList.toggle('fast-fade-in');
}

/**
* Disable buttons if the device is managed until the management
* disclaimer is loaded.
*/
private areButtonsDisabled_() {
return this.isDeviceManaged_ && this.managedDeviceDisclaimer_.length === 0;
}

// At the start of the signInPromo animation, the product logo should be at
// the same position as the splash view logo animation. To be able
// to do that, we had to translate the safeZone vertically up by the value
// calculated in the function below, after doing top:50%.
private setTranslationHeightToAlignLogoAndAnimation() {
private setTranslationHeightToAlignLogoAndAnimation_() {
const contentAreaHeight = this.$.contentArea.clientHeight;
const safeZoneHeight = this.$.safeZone.clientHeight;
const productLogoMarginTop = parseInt(
Expand All @@ -148,6 +177,17 @@ export class SignInPromoElement extends SignInPromoElementBase {
private onContinueWithoutAccountClick_() {
this.browserProxy_.continueWithoutAccount();
}

// To keep the layout stable during animations, for non-managed devices the
// disclaimer is omitted from the layout, and for managed devices it is
// invisible while we're fetching the text to display.
private getDisclaimerVisibilityClass_() {
if (!this.isDeviceManaged_) {
return 'hidden';
}
return this.managedDeviceDisclaimer_.length === 0 ? 'temporarily-hidden' :
'';
}
}

declare global {
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/ui/managed_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ std::u16string GetDeviceManagedUiWebUILabel() {
}
#endif

// TODO(crbug.com/1409028): Modify this function so it would not return
// absl::nullopt if the device is managed.
absl::optional<std::string> GetDeviceManagerIdentity() {
if (!policy::ManagementServiceFactory::GetForPlatform()->IsManaged())
return absl::nullopt;
Expand Down

0 comments on commit 1ec0885

Please sign in to comment.