diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index e474f2c61ddaed..77b91073f70517 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -9694,6 +9694,12 @@ Check your passwords anytime in $1Google Separate your browsing? + + This new profile will be managed by your organization. <a href="$1" target="_blank">https://help.google.com/articleLinkLearn more</a> + + + This new profile will be managed by $1example.com. <a href="$2" target="_blank">https://help.google.com/articleLinkLearn more</a> + diff --git a/chrome/app/generated_resources_grd/IDS_SIGNIN_DICE_WEB_INTERCEPT_MANAGED_BY_DISCLAIMER.png.sha1 b/chrome/app/generated_resources_grd/IDS_SIGNIN_DICE_WEB_INTERCEPT_MANAGED_BY_DISCLAIMER.png.sha1 new file mode 100644 index 00000000000000..8f7b9a541ebccf --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_SIGNIN_DICE_WEB_INTERCEPT_MANAGED_BY_DISCLAIMER.png.sha1 @@ -0,0 +1 @@ +edd9cb07791a8a063ef8914f5e06a83fa80796f2 \ No newline at end of file diff --git a/chrome/app/generated_resources_grd/IDS_SIGNIN_DICE_WEB_INTERCEPT_MANAGED_DISCLAIMER.png.sha1 b/chrome/app/generated_resources_grd/IDS_SIGNIN_DICE_WEB_INTERCEPT_MANAGED_DISCLAIMER.png.sha1 new file mode 100644 index 00000000000000..d2459259da6151 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_SIGNIN_DICE_WEB_INTERCEPT_MANAGED_DISCLAIMER.png.sha1 @@ -0,0 +1 @@ +43b9ce91552d9404564792190561ddafa6c00956 \ No newline at end of file diff --git a/chrome/browser/resources/signin/dice_web_signin_intercept/dice_web_signin_intercept_app.html b/chrome/browser/resources/signin/dice_web_signin_intercept/dice_web_signin_intercept_app.html index 26d4210e3e1052..02ef4c24e6c31b 100644 --- a/chrome/browser/resources/signin/dice_web_signin_intercept/dice_web_signin_intercept_app.html +++ b/chrome/browser/resources/signin/dice_web_signin_intercept/dice_web_signin_intercept_app.html @@ -132,9 +132,34 @@ } #contents { + margin: 0 0 8px; overflow-wrap: break-word; /** For very long names and emails */ } + #managedDisclaimer { + align-items: center; + background: var(--google-grey-50); + border-radius: 8px; + color: var(--google-grey-700); + display: flex; + flex-direction: row; + font-size: 12px; + font-weight: 400; + justify-content: flex-start; + line-height: 16px; + margin: 0 0 16px; + padding: 10px 12px; + } + + #managedDisclaimerIcon { + margin-inline-end: 12px; + } + + #managedDisclaimerIcon > iron-icon { + height: 16px; + width: 16px; + } + #actionRow { display: flex; justify-content: flex-end; @@ -163,6 +188,11 @@ #interceptDialog [slot=footer] { background: rgb(50, 54, 57); /* Custom color from Namrata. */ } + + #managedDisclaimer { + background: var(--google-grey-800); + color: var(--google-grey-100); + } } .divider { @@ -222,6 +252,17 @@
[[interceptionParameters_.bodyTitle]]
[[interceptionParameters_.bodyText]]
+
diff --git a/chrome/browser/resources/signin/dice_web_signin_intercept/dice_web_signin_intercept_browser_proxy.ts b/chrome/browser/resources/signin/dice_web_signin_intercept/dice_web_signin_intercept_browser_proxy.ts index 374dfdba6bf069..cfa1943be0d544 100644 --- a/chrome/browser/resources/signin/dice_web_signin_intercept/dice_web_signin_intercept_browser_proxy.ts +++ b/chrome/browser/resources/signin/dice_web_signin_intercept/dice_web_signin_intercept_browser_proxy.ts @@ -20,6 +20,7 @@ export type InterceptionParameters = { bodyText: string, confirmButtonLabel: string, cancelButtonLabel: string, + managedDisclaimerText: string, headerTextColor: string, interceptedProfileColor: string, primaryProfileColor: string, @@ -27,6 +28,7 @@ export type InterceptionParameters = { primaryAccount: AccountInfo, showGuestOption: boolean, useV2Design: boolean, + showManagedDisclaimer: boolean, }; export interface DiceWebSigninInterceptBrowserProxy { diff --git a/chrome/browser/signin/dice_web_signin_interceptor.cc b/chrome/browser/signin/dice_web_signin_interceptor.cc index 1c87bfdad79aba..5c4d37553e0d87 100644 --- a/chrome/browser/signin/dice_web_signin_interceptor.cc +++ b/chrome/browser/signin/dice_web_signin_interceptor.cc @@ -17,6 +17,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/enterprise/browser_management/management_service_factory.h" #include "chrome/browser/enterprise/util/managed_browser_utils.h" #include "chrome/browser/net/system_network_context_manager.h" #include "chrome/browser/new_tab_page/chrome_colors/generated_colors_info.h" @@ -122,13 +123,15 @@ DiceWebSigninInterceptor::Delegate::BubbleParameters::BubbleParameters( AccountInfo primary_account, SkColor profile_highlight_color, bool show_guest_option, - bool show_link_data_option) + bool show_link_data_option, + bool show_managed_disclaimer) : interception_type(interception_type), intercepted_account(intercepted_account), primary_account(primary_account), profile_highlight_color(profile_highlight_color), show_guest_option(show_guest_option), - show_link_data_option(show_link_data_option) {} + show_link_data_option(show_link_data_option), + show_managed_disclaimer(show_managed_disclaimer) {} DiceWebSigninInterceptor::Delegate::BubbleParameters::BubbleParameters( const BubbleParameters& copy) = default; @@ -583,10 +586,17 @@ void DiceWebSigninInterceptor::OnInterceptionReadyToBeProcessed( return; } + bool show_managed_disclaimer = + *interception_type != SigninInterceptionType::kProfileSwitch && + base::FeatureList::IsEnabled(kSigninInterceptBubbleV2) && + (info.IsManaged() || + policy::ManagementServiceFactory::GetForPlatform()->IsManaged()); + Delegate::BubbleParameters bubble_parameters( *interception_type, info, GetPrimaryAccountInfo(identity_manager_), GetAutogeneratedThemeColors(profile_color).frame_color, - /*show_guest_option=*/false, show_link_data_option); + /*show_guest_option=*/false, show_link_data_option, + show_managed_disclaimer); base::OnceCallback callback; switch (*interception_type) { diff --git a/chrome/browser/signin/dice_web_signin_interceptor.h b/chrome/browser/signin/dice_web_signin_interceptor.h index 1ec71f3673332b..c35fd65f28dd03 100644 --- a/chrome/browser/signin/dice_web_signin_interceptor.h +++ b/chrome/browser/signin/dice_web_signin_interceptor.h @@ -171,7 +171,8 @@ class DiceWebSigninInterceptor : public KeyedService, AccountInfo primary_account, SkColor profile_highlight_color = SkColor(), bool show_guest_option = false, - bool show_link_data_option = false); + bool show_link_data_option = false, + bool show_managed_disclaimer = false); BubbleParameters(const BubbleParameters& copy); BubbleParameters& operator=(const BubbleParameters&); @@ -183,6 +184,7 @@ class DiceWebSigninInterceptor : public KeyedService, SkColor profile_highlight_color; bool show_guest_option; bool show_link_data_option; + bool show_managed_disclaimer; }; virtual ~Delegate() = default; diff --git a/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view.cc b/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view.cc index 16bafd2d543c00..f77050bc47d4f2 100644 --- a/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view.cc +++ b/chrome/browser/ui/views/profiles/dice_web_signin_interception_bubble_view.cc @@ -36,6 +36,7 @@ namespace { constexpr int kInterceptionBubbleWithoutGuestHeight = 326; constexpr int kInterceptionBubbleGuestFooterHeight = 36; +constexpr int kInterceptionBubbleManagedDisclaimerHeight = 52; constexpr int kInterceptionBubbleExtraTextHeight = 30; constexpr int kInterceptionBubbleWidth = 290; @@ -174,6 +175,11 @@ DiceWebSigninInterceptionBubbleView::DiceWebSigninInterceptionBubbleView( // TODO: Dynamically compute the right size based on the text length. height += kInterceptionBubbleExtraTextHeight; } + if (bubble_parameters.show_managed_disclaimer) { + // Increase the height to display an entreprise disclaimer for managed + // profile. + height += kInterceptionBubbleManagedDisclaimerHeight; + } web_view->SetPreferredSize(gfx::Size(kInterceptionBubbleWidth, height)); DiceWebSigninInterceptUI* web_ui = web_view->GetWebContents() ->GetWebUI() diff --git a/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc b/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc index 141fbe8b187bc9..5c7e1c04648280 100644 --- a/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc +++ b/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.cc @@ -4,6 +4,8 @@ #include "chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.h" +#include + #include "base/bind.h" #include "base/feature_list.h" #include "base/metrics/field_trial_params.h" @@ -17,10 +19,14 @@ #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/signin/signin_features.h" +#include "chrome/browser/ui/managed_ui.h" #include "chrome/browser/ui/signin/profile_colors_util.h" +#include "chrome/common/url_constants.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" +#include "components/google/core/common/google_util.h" #include "components/policy/core/common/management/management_service.h" +#include "components/signin/public/identity_manager/account_info.h" #include "content/public/browser/web_ui.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkColor.h" @@ -179,6 +185,7 @@ base::Value DiceWebSigninInterceptHandler::GetInterceptionParametersValue() { parameters.SetStringKey("bodyText", GetBodyText()); parameters.SetStringKey("confirmButtonLabel", GetConfirmButtonLabel()); parameters.SetStringKey("cancelButtonLabel", GetCancelButtonLabel()); + parameters.SetStringKey("managedDisclaimerText", GetManagedDisclaimerText()); parameters.SetBoolKey("showGuestOption", bubble_parameters_.show_guest_option); parameters.SetKey("interceptedAccount", @@ -192,6 +199,8 @@ base::Value DiceWebSigninInterceptHandler::GetInterceptionParametersValue() { color_utils::SkColorToRgbaString( GetProfileHighlightColor(Profile::FromWebUI(web_ui())))); parameters.SetBoolKey("useV2Design", GetShouldUseV2Design()); + parameters.SetBoolKey("showManagedDisclaimer", + bubble_parameters_.show_managed_disclaimer); parameters.SetStringKey( "headerTextColor", @@ -313,6 +322,29 @@ std::string DiceWebSigninInterceptHandler::GetCancelButtonLabel() { : IDS_SIGNIN_DICE_WEB_INTERCEPT_BUBBLE_CANCEL_BUTTON_LABEL); } +std::string DiceWebSigninInterceptHandler::GetManagedDisclaimerText() { + std::string learn_more_url = + google_util::AppendGoogleLocaleParam( + GURL(chrome::kSigninInterceptManagedDisclaimerLearnMoreURL), + g_browser_process->GetApplicationLocale()) + .spec(); + std::string manager_domain = intercepted_account().IsManaged() + ? intercepted_account().hosted_domain + : std::string(); + if (manager_domain.empty()) + manager_domain = chrome::GetDeviceManagerIdentity().value_or(std::string()); + + if (manager_domain.empty()) { + return l10n_util::GetStringFUTF8( + IDS_SIGNIN_DICE_WEB_INTERCEPT_MANAGED_DISCLAIMER, + base::ASCIIToUTF16(learn_more_url)); + } + + return l10n_util::GetStringFUTF8( + IDS_SIGNIN_DICE_WEB_INTERCEPT_MANAGED_BY_DISCLAIMER, + base::ASCIIToUTF16(manager_domain), base::ASCIIToUTF16(learn_more_url)); +} + bool DiceWebSigninInterceptHandler::GetShouldUseV2Design() { if (bubble_parameters_.interception_type == DiceWebSigninInterceptor::SigninInterceptionType::kProfileSwitch) diff --git a/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.h b/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.h index 45f1d5434a6a28..f9526a3ae031cf 100644 --- a/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.h +++ b/chrome/browser/ui/webui/signin/dice_web_signin_intercept_handler.h @@ -64,6 +64,7 @@ class DiceWebSigninInterceptHandler : public content::WebUIMessageHandler, std::string GetBodyText(); std::string GetConfirmButtonLabel(); std::string GetCancelButtonLabel(); + std::string GetManagedDisclaimerText(); bool GetShouldUseV2Design(); base::ScopedObservation