diff --git a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc index 59e911bbb7f1d..5498a854fff67 100644 --- a/chrome/browser/ui/webui/interstitials/interstitial_ui.cc +++ b/chrome/browser/ui/webui/interstitials/interstitial_ui.cc @@ -617,10 +617,16 @@ std::string InterstitialHTMLSource::GetSupervisedUserInterstitialHTML( } } + bool show_banner = false; + std::string show_banner_string; + if (net::GetValueForKeyInQuery(url, "show_banner", &show_banner_string)) { + show_banner = show_banner_string == "1"; + } + return supervised_user::BuildErrorPageHtml( allow_access_requests, profile_image_url, profile_image_url2, custodian, custodian_email, second_custodian, second_custodian_email, reason, g_browser_process->GetApplicationLocale(), /*already_sent_request=*/false, - /*is_main_frame=*/true); + /*is_main_frame=*/true, show_banner); } #endif diff --git a/components/supervised_user/core/browser/resources/supervised_user_block_interstitial_v2.css b/components/supervised_user/core/browser/resources/supervised_user_block_interstitial_v2.css index 4160427df6429..6e686782a33db 100644 --- a/components/supervised_user/core/browser/resources/supervised_user_block_interstitial_v2.css +++ b/components/supervised_user/core/browser/resources/supervised_user_block_interstitial_v2.css @@ -5,6 +5,15 @@ /* This is the stylesheet for the interstitial when the "WebFilterInterstitialRefresh" flag is enabled. */ +.banner { + align-items: center; + box-shadow: 0 0 2px rgba(60, 64, 67, 0.12), 0 0 6px rgba(60, 64, 67, 0.15); + border-radius: 4px; + display: flex; + flex-direction: row; + padding: 16px; + } + body { --avatar-stroke-color: var(--google-gray-50); --custodian-name-color: #333333; @@ -14,7 +23,7 @@ body { --paragraph-color: var(--google-gray-700); --callout-text-color: var(--google-gray-900); --callout-bg-color: var(--google-gray-100); - font-family: "Roboto", sans-serif; + font-family: 'Roboto', sans-serif; padding: 24px 24px 20px 24px; } @@ -74,6 +83,23 @@ button:active { border-color: var(--focused-details-button-border); } +#family-link-kite { + height: 24px; + width: 24px; + padding: 16px; +} + +.banner-header { + color: var(--header-color); + line-height: 24px; + margin-top: 0; +} + +.banner-content { + line-height: 20px; + margin-top: 0; +} + h1, p, .custodian-contact { diff --git a/components/supervised_user/core/browser/resources/supervised_user_block_interstitial_v2.html b/components/supervised_user/core/browser/resources/supervised_user_block_interstitial_v2.html index 191e9851d5809..646bd646dad00 100644 --- a/components/supervised_user/core/browser/resources/supervised_user_block_interstitial_v2.html +++ b/components/supervised_user/core/browser/resources/supervised_user_block_interstitial_v2.html @@ -14,6 +14,14 @@
+ remote_web_approvals_manager() .AreApprovalRequestsEnabled(); + bool show_banner = + supervised_user_service->ShouldShowFirstTimeInterstitialBanner(); + return BuildErrorPageHtml( allow_access_requests, profile_image_url, profile_image_url2, custodian, custodian_email, second_custodian, second_custodian_email, reason, - application_locale, already_sent_request, is_main_frame); + application_locale, already_sent_request, is_main_frame, show_banner); } void SupervisedUserInterstitial::GoBack() { diff --git a/components/supervised_user/core/browser/supervised_user_service.cc b/components/supervised_user/core/browser/supervised_user_service.cc index 40b7d81b84759..f37b31b6f79c8 100644 --- a/components/supervised_user/core/browser/supervised_user_service.cc +++ b/components/supervised_user/core/browser/supervised_user_service.cc @@ -70,14 +70,16 @@ void SupervisedUserService::Init() { static_cast( user_prefs_->GetInteger(prefs::kFirstTimeInterstitialBannerState)); #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) - if (banner_state == - supervised_user::FirstTimeInterstitialBannerState::kUnknown && - can_show_first_time_interstitial_banner_) { - banner_state = - supervised_user::FirstTimeInterstitialBannerState::kNeedToShow; - } else { - banner_state = - supervised_user::FirstTimeInterstitialBannerState::kSetupComplete; + if (supervised_user::CanDisplayFirstTimeInterstitialBanner()) { + if (banner_state == + supervised_user::FirstTimeInterstitialBannerState::kUnknown && + can_show_first_time_interstitial_banner_) { + banner_state = + supervised_user::FirstTimeInterstitialBannerState::kNeedToShow; + } else { + banner_state = + supervised_user::FirstTimeInterstitialBannerState::kSetupComplete; + } } #else banner_state = @@ -414,12 +416,7 @@ void SupervisedUserService::OnSiteListUpdated() { } void SupervisedUserService::MarkFirstTimeInterstitialBannerShown() const { - supervised_user::FirstTimeInterstitialBannerState banner_state = - static_cast( - user_prefs_->GetInteger(prefs::kFirstTimeInterstitialBannerState)); - - if (banner_state == - supervised_user::FirstTimeInterstitialBannerState::kNeedToShow) { + if (ShouldShowFirstTimeInterstitialBanner()) { user_prefs_->SetInteger( prefs::kFirstTimeInterstitialBannerState, static_cast( @@ -427,4 +424,11 @@ void SupervisedUserService::MarkFirstTimeInterstitialBannerShown() const { } } +bool SupervisedUserService::ShouldShowFirstTimeInterstitialBanner() const { + supervised_user::FirstTimeInterstitialBannerState banner_state = + static_cast( + user_prefs_->GetInteger(prefs::kFirstTimeInterstitialBannerState)); + return banner_state == + supervised_user::FirstTimeInterstitialBannerState::kNeedToShow; +} } // namespace supervised_user diff --git a/components/supervised_user/core/browser/supervised_user_service.h b/components/supervised_user/core/browser/supervised_user_service.h index 502ba0e5d7e43..c0f8f229b63d0 100644 --- a/components/supervised_user/core/browser/supervised_user_service.h +++ b/components/supervised_user/core/browser/supervised_user_service.h @@ -145,6 +145,9 @@ class SupervisedUserService : public KeyedService, // who haven't yet seen the banner. void MarkFirstTimeInterstitialBannerShown() const; + // Returns true if the interstitial banner needs to be shown to user. + bool ShouldShowFirstTimeInterstitialBanner() const; + // Use |SupervisedUserServiceFactory::GetForProfile(..)| to get // an instance of this service. // Public to allow visibility to iOS factory. diff --git a/components/supervised_user/core/common/features.cc b/components/supervised_user/core/common/features.cc index bc7aa0777efac..9418e69746d76 100644 --- a/components/supervised_user/core/common/features.cc +++ b/components/supervised_user/core/common/features.cc @@ -147,6 +147,12 @@ BASE_FEATURE(kEnableExtensionsPermissionsForSupervisedUsersOnDesktop, BASE_FEATURE(kEnableManagedByParentUi, "EnableManagedByParentUi", base::FEATURE_DISABLED_BY_DEFAULT); + +bool CanDisplayFirstTimeInterstitialBanner() { + return base::FeatureList::IsEnabled(kEnableSupervisionOnDesktopAndIOS) && + base::FeatureList::IsEnabled( + kFilterWebsitesForSupervisedUsersOnDesktopAndIOS); +} // The URL which the "Managed by your parent" UI links to. This is defined as a // FeatureParam (but with the currently correct default) because: // * We expect to change this URL in the near-term, this allows us to gradually diff --git a/components/supervised_user/core/common/features.h b/components/supervised_user/core/common/features.h index f6c9b012c0d71..5bad65bafc51e 100644 --- a/components/supervised_user/core/common/features.h +++ b/components/supervised_user/core/common/features.h @@ -26,6 +26,10 @@ BASE_DECLARE_FEATURE(kEnableExtensionsPermissionsForSupervisedUsersOnDesktop); BASE_DECLARE_FEATURE(kEnableManagedByParentUi); extern const base::FeatureParam kManagedByParentUiMoreInfoUrl; +// Returns whether banner can be displayed to the user after website filtering +// is enabled +bool CanDisplayFirstTimeInterstitialBanner(); + BASE_DECLARE_FEATURE(kLocalExtensionApprovalsV2); BASE_DECLARE_FEATURE(kRetireStaticDenyList);