diff options
19 files changed, 9 insertions, 88 deletions
diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc index 2d89253..f912011 100644 --- a/ash/shelf/shelf_widget.cc +++ b/ash/shelf/shelf_widget.cc @@ -714,9 +714,6 @@ bool ShelfWidget::IsShelfHiddenBehindBlackBar() const { // static bool ShelfWidget::ShelfAlignmentAllowed() { - if (Shell::GetInstance()->system_tray_delegate()->IsUserSupervised()) - return false; - user::LoginStatus login_status = Shell::GetInstance()->system_tray_delegate()->GetUserLoginStatus(); diff --git a/ash/system/chromeos/supervised/tray_supervised_user.cc b/ash/system/chromeos/supervised/tray_supervised_user.cc index 31ddb39..f85d0fe 100644 --- a/ash/system/chromeos/supervised/tray_supervised_user.cc +++ b/ash/system/chromeos/supervised/tray_supervised_user.cc @@ -29,8 +29,7 @@ const char TraySupervisedUser::kNotificationId[] = TraySupervisedUser::TraySupervisedUser(SystemTray* system_tray) : SystemTrayItem(system_tray), tray_view_(NULL), - status_(ash::user::LOGGED_IN_NONE), - is_user_supervised_(false) { + status_(ash::user::LOGGED_IN_NONE) { } TraySupervisedUser::~TraySupervisedUser() { @@ -49,8 +48,7 @@ void TraySupervisedUser::UpdateMessage() { views::View* TraySupervisedUser::CreateDefaultView( user::LoginStatus status) { CHECK(tray_view_ == NULL); - SystemTrayDelegate* delegate = Shell::GetInstance()->system_tray_delegate(); - if (!delegate->IsUserSupervised()) + if (status != ash::user::LOGGED_IN_SUPERVISED) return NULL; tray_view_ = new LabelTrayView(this, IDR_AURA_UBER_TRAY_SUPERVISED_USER); @@ -68,18 +66,14 @@ void TraySupervisedUser::OnViewClicked(views::View* sender) { void TraySupervisedUser::UpdateAfterLoginStatusChange( user::LoginStatus status) { - SystemTrayDelegate* delegate = Shell::GetInstance()->system_tray_delegate(); - - bool is_user_supervised = delegate->IsUserSupervised(); - if (status == status_ && is_user_supervised == is_user_supervised_) + if (status == status_) return; - - if (is_user_supervised && + if (status == ash::user::LOGGED_IN_SUPERVISED && status_ != ash::user::LOGGED_IN_LOCKED) { + SystemTrayDelegate* delegate = Shell::GetInstance()->system_tray_delegate(); CreateOrUpdateNotification(delegate->GetSupervisedUserMessage()); } status_ = status; - is_user_supervised_ = is_user_supervised; } void TraySupervisedUser::CreateOrUpdateNotification( diff --git a/ash/system/chromeos/supervised/tray_supervised_user.h b/ash/system/chromeos/supervised/tray_supervised_user.h index 5d07d25..dbad222 100644 --- a/ash/system/chromeos/supervised/tray_supervised_user.h +++ b/ash/system/chromeos/supervised/tray_supervised_user.h @@ -15,7 +15,7 @@ class LabelTrayView; class SystemTray; class ASH_EXPORT TraySupervisedUser : public SystemTrayItem, - public ViewClickListener { + public ViewClickListener { public: explicit TraySupervisedUser(SystemTray* system_tray); virtual ~TraySupervisedUser(); @@ -43,9 +43,6 @@ class ASH_EXPORT TraySupervisedUser : public SystemTrayItem, // Previous login status to avoid showing notification upon unlock. user::LoginStatus status_; - // Previous user supervised state to avoid showing notification upon unlock. - bool is_user_supervised_; - DISALLOW_COPY_AND_ASSIGN(TraySupervisedUser); }; diff --git a/ash/system/tray/default_system_tray_delegate.cc b/ash/system/tray/default_system_tray_delegate.cc index fde3f3d..e2aeae3 100644 --- a/ash/system/tray/default_system_tray_delegate.cc +++ b/ash/system/tray/default_system_tray_delegate.cc @@ -86,10 +86,6 @@ const base::string16 DefaultSystemTrayDelegate::GetSupervisedUserMessage() return base::string16(); } -bool DefaultSystemTrayDelegate::IsUserSupervised() const { - return false; -} - bool DefaultSystemTrayDelegate::SystemShouldUpgrade() const { return true; } diff --git a/ash/system/tray/default_system_tray_delegate.h b/ash/system/tray/default_system_tray_delegate.h index 5b88b01..0c7625b 100644 --- a/ash/system/tray/default_system_tray_delegate.h +++ b/ash/system/tray/default_system_tray_delegate.h @@ -29,7 +29,6 @@ class ASH_EXPORT DefaultSystemTrayDelegate : public SystemTrayDelegate { virtual const base::string16 GetSupervisedUserManagerName() const OVERRIDE; virtual const base::string16 GetSupervisedUserMessage() const OVERRIDE; - virtual bool IsUserSupervised() const OVERRIDE; virtual bool SystemShouldUpgrade() const OVERRIDE; virtual base::HourClockType GetHourClockType() const OVERRIDE; virtual void ShowSettings() OVERRIDE; diff --git a/ash/system/tray/system_tray_delegate.h b/ash/system/tray/system_tray_delegate.h index f235fb2..de86112 100644 --- a/ash/system/tray/system_tray_delegate.h +++ b/ash/system/tray/system_tray_delegate.h @@ -119,9 +119,6 @@ class ASH_EXPORT SystemTrayDelegate { // Returns the notification for supervised users. virtual const base::string16 GetSupervisedUserMessage() const = 0; - // Returns true if the current user is supervised. - virtual bool IsUserSupervised() const = 0; - // Returns whether a system upgrade is available. virtual bool SystemShouldUpgrade() const = 0; diff --git a/ash/system/user/tray_user.cc b/ash/system/user/tray_user.cc index dcac2a9..9851ba1 100644 --- a/ash/system/user/tray_user.cc +++ b/ash/system/user/tray_user.cc @@ -137,9 +137,6 @@ void TrayUser::UpdateAfterLoginStatusChange(user::LoginStatus status) { return; bool need_label = false; bool need_avatar = false; - SystemTrayDelegate* delegate = Shell::GetInstance()->system_tray_delegate(); - if (delegate->IsUserSupervised()) - need_label = true; switch (status) { case user::LOGGED_IN_LOCKED: case user::LOGGED_IN_USER: @@ -178,7 +175,7 @@ void TrayUser::UpdateAfterLoginStatusChange(user::LoginStatus status) { } } - if (delegate->IsUserSupervised()) { + if (status == user::LOGGED_IN_SUPERVISED) { label_->SetText( l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SUPERVISED_LABEL)); } else if (status == user::LOGGED_IN_GUEST) { diff --git a/ash/system/user/user_card_view.cc b/ash/system/user/user_card_view.cc index 5f46e2a..d0b77ab 100644 --- a/ash/system/user/user_card_view.cc +++ b/ash/system/user/user_card_view.cc @@ -394,10 +394,8 @@ void UserCardView::AddUserContent(user::LoginStatus login_status, views::Label* user_email = NULL; if (login_status != user::LOGGED_IN_GUEST && (multiprofile_index || !IsMultiAccountSupportedAndUserActive())) { - SystemTrayDelegate* tray_delegate = - Shell::GetInstance()->system_tray_delegate(); base::string16 user_email_string = - tray_delegate->IsUserSupervised() + login_status == user::LOGGED_IN_SUPERVISED ? l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SUPERVISED_LABEL) : base::UTF8ToUTF16( delegate->GetUserInfo(multiprofile_index)->GetEmail()); diff --git a/ash/test/test_system_tray_delegate.cc b/ash/test/test_system_tray_delegate.cc index 60fb4b3..c4a45b9 100644 --- a/ash/test/test_system_tray_delegate.cc +++ b/ash/test/test_system_tray_delegate.cc @@ -8,7 +8,6 @@ #include "ash/session/session_state_delegate.h" #include "ash/shell.h" -#include "ash/system/user/login_status.h" #include "base/message_loop/message_loop.h" #include "base/time/time.h" @@ -70,10 +69,6 @@ user::LoginStatus TestSystemTrayDelegate::GetUserLoginStatus() const { return login_status_; } -bool TestSystemTrayDelegate::IsUserSupervised() const { - return login_status_ == ash::user::LOGGED_IN_SUPERVISED; -} - bool TestSystemTrayDelegate::ShouldShowDisplayNotification() { return should_show_display_notification_; } diff --git a/ash/test/test_system_tray_delegate.h b/ash/test/test_system_tray_delegate.h index 1a64ac1..9b85d97 100644 --- a/ash/test/test_system_tray_delegate.h +++ b/ash/test/test_system_tray_delegate.h @@ -43,7 +43,6 @@ class TestSystemTrayDelegate : public DefaultSystemTrayDelegate { // Overridden from SystemTrayDelegate: virtual user::LoginStatus GetUserLoginStatus() const OVERRIDE; - virtual bool IsUserSupervised() const OVERRIDE; virtual bool ShouldShowDisplayNotification() OVERRIDE; virtual bool GetSessionStartTime( base::TimeTicks* session_start_time) OVERRIDE; diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc index 201ac8f..1696b14 100644 --- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc +++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc @@ -394,18 +394,13 @@ SystemTrayDelegateChromeOS::GetSupervisedUserManagerName() const { const base::string16 SystemTrayDelegateChromeOS::GetSupervisedUserMessage() const { - if (!IsUserSupervised()) + if (GetUserLoginStatus() != ash::user::LOGGED_IN_SUPERVISED) return base::string16(); return l10n_util::GetStringFUTF16( IDS_USER_IS_SUPERVISED_BY_NOTICE, base::UTF8ToUTF16(GetSupervisedUserManager())); } -bool SystemTrayDelegateChromeOS::IsUserSupervised() const { - user_manager::User* user = user_manager::UserManager::Get()->GetActiveUser(); - return user && user->IsSupervised(); -} - bool SystemTrayDelegateChromeOS::SystemShouldUpgrade() const { return UpgradeDetector::GetInstance()->notify_upgrade(); } diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.h b/chrome/browser/ui/ash/system_tray_delegate_chromeos.h index fa406fa..ad08f8b 100644 --- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.h +++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.h @@ -65,7 +65,6 @@ class SystemTrayDelegateChromeOS virtual const std::string GetSupervisedUserManager() const OVERRIDE; virtual const base::string16 GetSupervisedUserManagerName() const OVERRIDE; virtual const base::string16 GetSupervisedUserMessage() const OVERRIDE; - virtual bool IsUserSupervised() const OVERRIDE; virtual bool SystemShouldUpgrade() const OVERRIDE; virtual base::HourClockType GetHourClockType() const OVERRIDE; virtual void ShowSettings() OVERRIDE; diff --git a/chrome/browser/ui/ash/system_tray_delegate_linux.cc b/chrome/browser/ui/ash/system_tray_delegate_linux.cc index 6ce1ba39..8cd59e4 100644 --- a/chrome/browser/ui/ash/system_tray_delegate_linux.cc +++ b/chrome/browser/ui/ash/system_tray_delegate_linux.cc @@ -83,10 +83,6 @@ class SystemTrayDelegateLinux : public ash::SystemTrayDelegate, return base::string16(); } - virtual bool IsUserSupervised() const OVERRIDE { - return false; - } - virtual bool SystemShouldUpgrade() const OVERRIDE { return UpgradeDetector::GetInstance()->notify_upgrade(); } diff --git a/chrome/browser/ui/ash/system_tray_delegate_win.cc b/chrome/browser/ui/ash/system_tray_delegate_win.cc index 65e46c0..b3337ce 100644 --- a/chrome/browser/ui/ash/system_tray_delegate_win.cc +++ b/chrome/browser/ui/ash/system_tray_delegate_win.cc @@ -83,10 +83,6 @@ class SystemTrayDelegateWin : public ash::SystemTrayDelegate, return base::string16(); } - virtual bool IsUserSupervised() const OVERRIDE { - return false; - } - virtual bool SystemShouldUpgrade() const OVERRIDE { return UpgradeDetector::GetInstance()->notify_upgrade(); } diff --git a/components/user_manager/user.cc b/components/user_manager/user.cc index 6784940..575d07f5 100644 --- a/components/user_manager/user.cc +++ b/components/user_manager/user.cc @@ -28,14 +28,6 @@ std::string GetUserName(const std::string& email) { } // namespace -bool User::IsSupervised() const { - return false; -} - -void User::SetIsSupervised(bool is_supervised) { - VLOG(1) << "Ignoring SetIsSupervised call with param " << is_supervised; -} - class RegularUser : public User { public: explicit RegularUser(const std::string& email); @@ -44,17 +36,8 @@ class RegularUser : public User { // Overridden from User: virtual UserType GetType() const OVERRIDE; virtual bool CanSyncImage() const OVERRIDE; - virtual void SetIsSupervised(bool is_supervised) OVERRIDE { - VLOG(1) << "Setting user is supervised to " << is_supervised; - is_supervised_ = is_supervised; - } - virtual bool IsSupervised() const OVERRIDE { - return is_supervised_; - } private: - bool is_supervised_; - DISALLOW_COPY_AND_ASSIGN(RegularUser); }; @@ -89,7 +72,6 @@ class SupervisedUser : public User { // Overridden from User: virtual UserType GetType() const OVERRIDE; - virtual bool IsSupervised() const OVERRIDE; virtual std::string display_email() const OVERRIDE; private: @@ -296,10 +278,6 @@ std::string SupervisedUser::display_email() const { return base::UTF16ToUTF8(display_name()); } -bool SupervisedUser::IsSupervised() const { - return true; -} - RetailModeUser::RetailModeUser() : User(chromeos::login::kRetailModeUserName) { set_display_email(std::string()); } diff --git a/components/user_manager/user.h b/components/user_manager/user.h index 0c34bf0..5ff8a10 100644 --- a/components/user_manager/user.h +++ b/components/user_manager/user.h @@ -91,10 +91,6 @@ class USER_MANAGER_EXPORT User : public UserInfo { virtual const gfx::ImageSkia& GetImage() const OVERRIDE; virtual std::string GetUserID() const OVERRIDE; - // Is user supervised. - virtual bool IsSupervised() const; - virtual void SetIsSupervised(bool is_supervised); - // Returns the account name part of the email. Use the display form of the // email if available and use_display_name == true. Otherwise use canonical. std::string GetAccountName(bool use_display_email) const; diff --git a/components/user_manager/user_manager.h b/components/user_manager/user_manager.h index 14b5d4f..e775279 100644 --- a/components/user_manager/user_manager.h +++ b/components/user_manager/user_manager.h @@ -289,9 +289,6 @@ class USER_MANAGER_EXPORT UserManager { // Returns true if supervised users allowed. virtual bool AreSupervisedUsersAllowed() const = 0; - // Force update login state. - virtual void ForceUpdateState() {} - protected: // Sets UserManager instance. static void SetInstance(UserManager* user_manager); diff --git a/components/user_manager/user_manager_base.cc b/components/user_manager/user_manager_base.cc index 4bf1731..8ca4df5 100644 --- a/components/user_manager/user_manager_base.cc +++ b/components/user_manager/user_manager_base.cc @@ -634,10 +634,6 @@ void UserManagerBase::NotifyLocalStateChanged() { UserManager::Observer, observer_list_, LocalStateChanged(this)); } -void UserManagerBase::ForceUpdateState() { - UpdateLoginState(); -} - bool UserManagerBase::CanUserBeRemoved(const User* user) const { // Only regular and supervised users are allowed to be manually removed. if (!user || (user->GetType() != USER_TYPE_REGULAR && diff --git a/components/user_manager/user_manager_base.h b/components/user_manager/user_manager_base.h index b117687..a322afd 100644 --- a/components/user_manager/user_manager_base.h +++ b/components/user_manager/user_manager_base.h @@ -102,7 +102,6 @@ class USER_MANAGER_EXPORT UserManagerBase : public UserManager { virtual void RemoveSessionStateObserver( UserManager::UserSessionStateObserver* obs) OVERRIDE; virtual void NotifyLocalStateChanged() OVERRIDE; - virtual void ForceUpdateState() OVERRIDE; // Helper function that copies users from |users_list| to |users_vector| and // |users_set|. Duplicates and users already present in |existing_users| are |