Commit a936349e authored by Danan S's avatar Danan S Committed by Commit Bot

Add Supervised User deprecation messages

This change adds a message bubble to the login screen and
generates a system notification on login for Supervised
Users, both of which indicate that the Supervised User
feature is to be deprecated.

Bug: 899017
Change-Id: I05b684f183a47b6275442caf8e7a4820bda0374e
Reviewed-on: https://chromium-review.googlesource.com/c/1324310
Commit-Queue: Danan S <danan@chromium.org>
Reviewed-by: default avatarJacob Dufault <jdufault@chromium.org>
Reviewed-by: default avatarRahul Chaturvedi <rkc@chromium.org>
Reviewed-by: default avatarMichael Giuffrida <michaelpg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607373}
parent 8e7d961a
...@@ -1449,6 +1449,9 @@ This file contains the strings for ash. ...@@ -1449,6 +1449,9 @@ This file contains the strings for ash.
<message name="IDS_ASH_LOGIN_POD_MENU_REMOVE_ITEM_ACCESSIBLE_NAME" desc="Text to be spoken when 'Remove user' item is selected on the pod menu."> <message name="IDS_ASH_LOGIN_POD_MENU_REMOVE_ITEM_ACCESSIBLE_NAME" desc="Text to be spoken when 'Remove user' item is selected on the pod menu.">
Remove this user Remove this user
</message> </message>
<message name="IDS_ASH_LOGIN_POD_LEGACY_SUPERVISED_EXPIRATION_WARNING" desc="Text shown as a warning that supervised users will be deprecated.">
Your supervised user account is expiring soon.
</message>
<message name="IDS_ASH_LOGIN_POD_LEGACY_SUPERVISED_USER_REMOVE_WARNING" desc="Text shown as a warning when attempting to remove legacy supervised user."> <message name="IDS_ASH_LOGIN_POD_LEGACY_SUPERVISED_USER_REMOVE_WARNING" desc="Text shown as a warning when attempting to remove legacy supervised user.">
All files and local data associated with the supervised user will be permanently deleted once this supervised user is removed. Visited websites and settings for this supervised user may still be visible by the manager at <ph name="MANAGEMENT_URL">$1<ex>www.example.com</ex></ph>. All files and local data associated with the supervised user will be permanently deleted once this supervised user is removed. Visited websites and settings for this supervised user may still be visible by the manager at <ph name="MANAGEMENT_URL">$1<ex>www.example.com</ex></ph>.
</message> </message>
......
09c28d1841db0b6658f032506e3f42b4a63c6c40
\ No newline at end of file
...@@ -102,7 +102,7 @@ void SetPreferredWidthForView(views::View* view, int width) { ...@@ -102,7 +102,7 @@ void SetPreferredWidthForView(views::View* view, int width) {
class AuthErrorLearnMoreButton : public views::Button, class AuthErrorLearnMoreButton : public views::Button,
public views::ButtonListener { public views::ButtonListener {
public: public:
AuthErrorLearnMoreButton(LoginBubble* parent_bubble) explicit AuthErrorLearnMoreButton(LoginBubble* parent_bubble)
: views::Button(this), parent_bubble_(parent_bubble) { : views::Button(this), parent_bubble_(parent_bubble) {
SetLayoutManager(std::make_unique<views::FillLayout>()); SetLayoutManager(std::make_unique<views::FillLayout>());
auto* label = auto* label =
...@@ -309,6 +309,11 @@ LoginBubble* LockContentsView::TestApi::warning_banner_bubble() const { ...@@ -309,6 +309,11 @@ LoginBubble* LockContentsView::TestApi::warning_banner_bubble() const {
return view_->warning_banner_bubble_.get(); return view_->warning_banner_bubble_.get();
} }
LoginBubble* LockContentsView::TestApi::supervised_user_deprecation_bubble()
const {
return view_->supervised_user_deprecation_bubble_.get();
}
views::View* LockContentsView::TestApi::system_info() const { views::View* LockContentsView::TestApi::system_info() const {
return view_->system_info_; return view_->system_info_;
} }
...@@ -351,6 +356,7 @@ LockContentsView::LockContentsView( ...@@ -351,6 +356,7 @@ LockContentsView::LockContentsView(
Shell::Get()->system_tray_notifier()->AddSystemTrayFocusObserver(this); Shell::Get()->system_tray_notifier()->AddSystemTrayFocusObserver(this);
keyboard::KeyboardController::Get()->AddObserver(this); keyboard::KeyboardController::Get()->AddObserver(this);
auth_error_bubble_ = std::make_unique<LoginBubble>(); auth_error_bubble_ = std::make_unique<LoginBubble>();
supervised_user_deprecation_bubble_ = std::make_unique<LoginBubble>();
detachable_base_error_bubble_ = std::make_unique<LoginBubble>(); detachable_base_error_bubble_ = std::make_unique<LoginBubble>();
tooltip_bubble_ = std::make_unique<LoginBubble>(); tooltip_bubble_ = std::make_unique<LoginBubble>();
warning_banner_bubble_ = std::make_unique<LoginBubble>(); warning_banner_bubble_ = std::make_unique<LoginBubble>();
...@@ -1447,13 +1453,14 @@ void LockContentsView::RemoveUser(bool is_primary) { ...@@ -1447,13 +1453,14 @@ void LockContentsView::RemoveUser(bool is_primary) {
} }
void LockContentsView::OnBigUserChanged() { void LockContentsView::OnBigUserChanged() {
const AccountId new_big_user = const mojom::LoginUserInfoPtr& big_user =
CurrentBigUserView()->GetCurrentUser()->basic_user_info->account_id; CurrentBigUserView()->GetCurrentUser();
const AccountId big_user_account_id = big_user->basic_user_info->account_id;
CurrentBigUserView()->RequestFocus(); CurrentBigUserView()->RequestFocus();
Shell::Get()->login_screen_controller()->OnFocusPod(new_big_user); Shell::Get()->login_screen_controller()->OnFocusPod(big_user_account_id);
UpdateEasyUnlockIconForUser(new_big_user); UpdateEasyUnlockIconForUser(big_user_account_id);
if (unlock_attempt_ > 0) { if (unlock_attempt_ > 0) {
// Times a password was incorrectly entered until user gives up (change // Times a password was incorrectly entered until user gives up (change
...@@ -1465,6 +1472,24 @@ void LockContentsView::OnBigUserChanged() { ...@@ -1465,6 +1472,24 @@ void LockContentsView::OnBigUserChanged() {
unlock_attempt_ = 0; unlock_attempt_ = 0;
} }
// http://crbug/866790: After Supervised Users are deprecated, remove this.
if (big_user->basic_user_info->type == user_manager::USER_TYPE_SUPERVISED) {
base::string16 message = l10n_util::GetStringUTF16(
IDS_ASH_LOGIN_POD_LEGACY_SUPERVISED_EXPIRATION_WARNING);
// Shows supervised user deprecation message as a persistent error bubble.
views::Label* label =
new views::Label(message, views::style::CONTEXT_MESSAGE_BOX_BODY_TEXT,
views::style::STYLE_PRIMARY);
label->SetMultiLine(true);
label->SetAutoColorReadabilityEnabled(false);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetEnabledColor(SK_ColorWHITE);
supervised_user_deprecation_bubble_->ShowErrorBubble(
label,
CurrentBigUserView()->auth_user()->password_view() /*anchor_view*/,
LoginBubble::kFlagPersistent);
}
// The new auth user might have different last used detachable base - make // The new auth user might have different last used detachable base - make
// sure the detachable base pairing error is updated if needed. // sure the detachable base pairing error is updated if needed.
OnDetachableBasePairingStatusChanged( OnDetachableBasePairingStatusChanged(
......
...@@ -84,6 +84,7 @@ class ASH_EXPORT LockContentsView ...@@ -84,6 +84,7 @@ class ASH_EXPORT LockContentsView
LoginBubble* auth_error_bubble() const; LoginBubble* auth_error_bubble() const;
LoginBubble* detachable_base_error_bubble() const; LoginBubble* detachable_base_error_bubble() const;
LoginBubble* warning_banner_bubble() const; LoginBubble* warning_banner_bubble() const;
LoginBubble* supervised_user_deprecation_bubble() const;
views::View* system_info() const; views::View* system_info() const;
LoginExpandedPublicAccountView* expanded_view() const; LoginExpandedPublicAccountView* expanded_view() const;
views::View* main_view() const; views::View* main_view() const;
...@@ -384,6 +385,9 @@ class ASH_EXPORT LockContentsView ...@@ -384,6 +385,9 @@ class ASH_EXPORT LockContentsView
// Bubble for displaying warning banner message. // Bubble for displaying warning banner message.
std::unique_ptr<LoginBubble> warning_banner_bubble_; std::unique_ptr<LoginBubble> warning_banner_bubble_;
// Bubble for displaying supervised user deprecation message.
std::unique_ptr<LoginBubble> supervised_user_deprecation_bubble_;
int unlock_attempt_ = 0; int unlock_attempt_ = 0;
// Whether a lock screen app is currently active (i.e. lock screen note action // Whether a lock screen app is currently active (i.e. lock screen note action
......
...@@ -1155,6 +1155,16 @@ ...@@ -1155,6 +1155,16 @@
<message name="IDS_SUPERVISED_USER_IMPORT_BUBBLE_TEXT" desc="Text shown in notification bubble when user enters name of user that can be imported."> <message name="IDS_SUPERVISED_USER_IMPORT_BUBBLE_TEXT" desc="Text shown in notification bubble when user enters name of user that can be imported.">
Looks like you're already managing a user by that name. Did you want to <ph name="LINK_START">$1<ex>&gt;a&lt;</ex></ph>import <ph name="USER_DISPLAY_NAME">$2<ex>John</ex></ph> to this device<ph name="LINK_END">$3<ex>&gt;/a&lt;</ex></ph>? Looks like you're already managing a user by that name. Did you want to <ph name="LINK_START">$1<ex>&gt;a&lt;</ex></ph>import <ph name="USER_DISPLAY_NAME">$2<ex>John</ex></ph> to this device<ph name="LINK_END">$3<ex>&gt;/a&lt;</ex></ph>?
</message> </message>
<!-- Supervised users deprecation notification -->
<message name="IDS_SUPERVISED_USER_EXPIRING_NOTIFICATION_TITLE" desc="Title of notification displayed on supervised user login indicating that the feature is expiring soon.">
Your supervised user account is expiring soon.
</message>
<message name="IDS_SUPERVISED_USER_EXPIRING_NOTIFICATION_BODY" desc="Body of notification displayed on supervised user login indicating that the feature is expiring soon.">
Please save your local files and set up a new account.
</message>
<message name="IDS_SUPERVISED_USER_EXPIRING_NOTIFICATION_LEARN_MORE" desc="Learn more text for button on Supervised User expiration notification.">
Learn more
</message>
<message name="IDS_MULTI_PROFILES_RESTRICTED_POLICY_TITLE" desc="Text that is shown on the title of the bubble shown for user pod which is not allowed in multi-profiles session."> <message name="IDS_MULTI_PROFILES_RESTRICTED_POLICY_TITLE" desc="Text that is shown on the title of the bubble shown for user pod which is not allowed in multi-profiles session.">
Can't set up multiple sign-in Can't set up multiple sign-in
</message> </message>
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "ash/public/cpp/notification_utils.h"
#include "ash/public/cpp/vector_icons/vector_icons.h"
#include "base/base_paths.h" #include "base/base_paths.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/callback_helpers.h" #include "base/callback_helpers.h"
...@@ -81,6 +83,7 @@ ...@@ -81,6 +83,7 @@
#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/lifetime/browser_shutdown.h" #include "chrome/browser/lifetime/browser_shutdown.h"
#include "chrome/browser/net/nss_context.h" #include "chrome/browser/net/nss_context.h"
#include "chrome/browser/notifications/notification_display_service.h"
#include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/password_manager/password_store_factory.h"
#include "chrome/browser/prefs/session_startup_pref.h" #include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
...@@ -91,6 +94,8 @@ ...@@ -91,6 +94,8 @@
#include "chrome/browser/supervised_user/child_accounts/child_account_service.h" #include "chrome/browser/supervised_user/child_accounts/child_account_service.h"
#include "chrome/browser/supervised_user/child_accounts/child_account_service_factory.h" #include "chrome/browser/supervised_user/child_accounts/child_account_service_factory.h"
#include "chrome/browser/ui/app_list/app_list_client_impl.h" #include "chrome/browser/ui/app_list/app_list_client_impl.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h"
#include "chrome/browser/ui/startup/startup_browser_creator.h" #include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/browser/ui/webui/chromeos/login/discover/discover_manager.h" #include "chrome/browser/ui/webui/chromeos/login/discover/discover_manager.h"
#include "chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_pin_setup.h" #include "chrome/browser/ui/webui/chromeos/login/discover/modules/discover_module_pin_setup.h"
...@@ -98,6 +103,7 @@ ...@@ -98,6 +103,7 @@
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/logging_chrome.h" #include "chrome/common/logging_chrome.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/assistant/buildflags.h" #include "chromeos/assistant/buildflags.h"
#include "chromeos/chromeos_switches.h" #include "chromeos/chromeos_switches.h"
#include "chromeos/cryptohome/cryptohome_parameters.h" #include "chromeos/cryptohome/cryptohome_parameters.h"
...@@ -143,6 +149,9 @@ ...@@ -143,6 +149,9 @@
#include "ui/base/ime/chromeos/input_method_descriptor.h" #include "ui/base/ime/chromeos/input_method_descriptor.h"
#include "ui/base/ime/chromeos/input_method_manager.h" #include "ui/base/ime/chromeos/input_method_manager.h"
#include "ui/base/ime/chromeos/input_method_util.h" #include "ui/base/ime/chromeos/input_method_util.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/message_center/public/cpp/notification.h"
#include "ui/message_center/public/cpp/notifier_id.h"
#include "url/gurl.h" #include "url/gurl.h"
#if BUILDFLAG(ENABLE_RLZ) #if BUILDFLAG(ENABLE_RLZ)
...@@ -158,6 +167,10 @@ namespace chromeos { ...@@ -158,6 +167,10 @@ namespace chromeos {
namespace { namespace {
// http://crbug/866790: After Supervised Users are deprecated, remove this.
const char kUserSessionManagerNotifier[] = "chrome://settings/people";
const char kSupervisedUserDeprecated[] = "supervised_user_deprecated";
// Milliseconds until we timeout our attempt to fetch flags from the child // Milliseconds until we timeout our attempt to fetch flags from the child
// account service. // account service.
static const int kFlagsFetchingLoginTimeoutMs = 1000; static const int kFlagsFetchingLoginTimeoutMs = 1000;
...@@ -1178,6 +1191,52 @@ void UserSessionManager::OnProfileCreated(const UserContext& user_context, ...@@ -1178,6 +1191,52 @@ void UserSessionManager::OnProfileCreated(const UserContext& user_context,
} }
} }
// http://crbug/866790: After Supervised Users are deprecated, remove this.
void ShowSupervisedUserDeprecationNotification(Profile* profile) {
base::string16 title = l10n_util::GetStringUTF16(
IDS_SUPERVISED_USER_EXPIRING_NOTIFICATION_TITLE);
base::string16 message =
l10n_util::GetStringUTF16(IDS_SUPERVISED_USER_EXPIRING_NOTIFICATION_BODY);
auto delegate =
base::MakeRefCounted<message_center::HandleNotificationClickDelegate>(
base::BindRepeating([](base::Optional<int> button_index) {
if (button_index) {
user_manager::UserManager* user_manager =
user_manager::UserManager::Get();
Profile* profile = ProfileHelper::Get()->GetProfileByUser(
user_manager->GetPrimaryUser());
NavigateParams params(profile,
GURL("https://support.google.com/chrome/"
"?p=ui_supervised_user"),
ui::PAGE_TRANSITION_AUTO_TOPLEVEL);
params.disposition = WindowOpenDisposition::SINGLETON_TAB;
Navigate(&params);
}
}));
message_center::RichNotificationData rich_notification_data;
rich_notification_data.buttons.push_back(
message_center::ButtonInfo(l10n_util::GetStringUTF16(
IDS_SUPERVISED_USER_EXPIRING_NOTIFICATION_LEARN_MORE)));
std::unique_ptr<message_center::Notification> notification =
ash::CreateSystemNotification(
message_center::NOTIFICATION_TYPE_SIMPLE, kSupervisedUserDeprecated,
title, message, base::string16(), GURL(),
message_center::NotifierId(
message_center::NotifierType::SYSTEM_COMPONENT,
kUserSessionManagerNotifier),
rich_notification_data, std::move(delegate),
ash::kNotificationWarningIcon,
message_center::SystemNotificationWarningLevel::NORMAL);
notification->set_priority(message_center::SYSTEM_PRIORITY);
NotificationDisplayService::GetForProfile(profile)->Display(
NotificationHandler::Type::TRANSIENT, *notification);
}
void UserSessionManager::InitProfilePreferences( void UserSessionManager::InitProfilePreferences(
Profile* profile, Profile* profile,
const UserContext& user_context) { const UserContext& user_context) {
...@@ -1282,6 +1341,10 @@ void UserSessionManager::InitProfilePreferences( ...@@ -1282,6 +1341,10 @@ void UserSessionManager::InitProfilePreferences(
void UserSessionManager::UserProfileInitialized(Profile* profile, void UserSessionManager::UserProfileInitialized(Profile* profile,
bool is_incognito_profile, bool is_incognito_profile,
const AccountId& account_id) { const AccountId& account_id) {
// http://crbug/866790: After Supervised Users are deprecated, remove this.
if (user_manager::UserManager::Get()->IsLoggedInAsSupervisedUser())
ShowSupervisedUserDeprecationNotification(profile);
// Demo user signed in. // Demo user signed in.
if (is_incognito_profile) { if (is_incognito_profile) {
profile->OnLogin(); profile->OnLogin();
......
627bae6792ae9963364d63bb269d9bb088d367fe
\ No newline at end of file
627bae6792ae9963364d63bb269d9bb088d367fe
\ No newline at end of file
627bae6792ae9963364d63bb269d9bb088d367fe
\ No newline at end of file
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