| Index: components/user_manager/user.cc
|
| diff --git a/components/user_manager/user.cc b/components/user_manager/user.cc
|
| index 664aa4ba5041bfb84ed780decfb0e281336b1137..795456836101e99f16dda748c60a3cacded453cf 100644
|
| --- a/components/user_manager/user.cc
|
| +++ b/components/user_manager/user.cc
|
| @@ -28,14 +28,32 @@ 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;
|
| + NOTREACHED() << "Calling SetIsSupervised for base User class.";
|
| +}
|
| +
|
| +// static
|
| +bool User::TypeIsRegular(UserType user_type) {
|
| + return user_type == USER_TYPE_REGULAR ||
|
| + user_type == USER_TYPE_REGULAR_SUPERVISED;
|
| +}
|
| +
|
| +// static
|
| +bool User::TypeIsSupervised(UserType user_type) {
|
| + return user_type == USER_TYPE_SUPERVISED ||
|
| + user_type == USER_TYPE_REGULAR_SUPERVISED;
|
| +}
|
| +
|
| +bool User::IsRegular() const {
|
| + return TypeIsRegular(GetType());
|
| }
|
|
|
| +bool User::IsSupervised() const {
|
| + return TypeIsSupervised(GetType());
|
| +}
|
| +
|
| +// Also used for regular supervised users.
|
| class RegularUser : public User {
|
| public:
|
| explicit RegularUser(const std::string& email);
|
| @@ -44,13 +62,7 @@ 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_;
|
| - }
|
| + virtual void SetIsSupervised(bool is_supervised) override;
|
|
|
| private:
|
| bool is_supervised_;
|
| @@ -89,7 +101,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:
|
| @@ -252,13 +263,19 @@ RegularUser::~RegularUser() {
|
| }
|
|
|
| UserType RegularUser::GetType() const {
|
| - return user_manager::USER_TYPE_REGULAR;
|
| + return is_supervised_ ? user_manager::USER_TYPE_REGULAR_SUPERVISED :
|
| + user_manager::USER_TYPE_REGULAR;
|
| }
|
|
|
| bool RegularUser::CanSyncImage() const {
|
| return true;
|
| }
|
|
|
| +void RegularUser::SetIsSupervised(bool is_supervised) {
|
| + VLOG(1) << "Setting user is supervised to " << is_supervised;
|
| + is_supervised_ = is_supervised;
|
| +}
|
| +
|
| GuestUser::GuestUser() : User(chromeos::login::kGuestUserName) {
|
| set_display_email(std::string());
|
| }
|
| @@ -297,10 +314,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());
|
| }
|
| @@ -323,9 +336,10 @@ UserType PublicAccountUser::GetType() const {
|
| }
|
|
|
| bool User::has_gaia_account() const {
|
| - COMPILE_ASSERT(user_manager::NUM_USER_TYPES == 6, num_user_types_unexpected);
|
| + COMPILE_ASSERT(user_manager::NUM_USER_TYPES == 7, num_user_types_unexpected);
|
| switch (GetType()) {
|
| case user_manager::USER_TYPE_REGULAR:
|
| + case user_manager::USER_TYPE_REGULAR_SUPERVISED:
|
| return true;
|
| case user_manager::USER_TYPE_GUEST:
|
| case user_manager::USER_TYPE_RETAIL_MODE:
|
|
|