OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 bool supervised_users_can_create = true; | 68 bool supervised_users_can_create = true; |
69 int message_id = -1; | 69 int message_id = -1; |
70 if (!has_users) { | 70 if (!has_users) { |
71 supervised_users_can_create = false; | 71 supervised_users_can_create = false; |
72 message_id = IDS_CREATE_SUPERVISED_USER_NO_MANAGER_TEXT; | 72 message_id = IDS_CREATE_SUPERVISED_USER_NO_MANAGER_TEXT; |
73 } | 73 } |
74 if (!allow_new_user || !supervised_users_allowed) { | 74 if (!allow_new_user || !supervised_users_allowed) { |
75 supervised_users_can_create = false; | 75 supervised_users_can_create = false; |
76 message_id = IDS_CREATE_SUPERVISED_USER_CREATION_RESTRICTED_TEXT; | 76 message_id = IDS_CREATE_SUPERVISED_USER_CREATION_RESTRICTED_TEXT; |
77 } | 77 } |
| 78 if (supervised_users_can_create && |
| 79 user_manager::UserManager::Get()-> |
| 80 GetUsersAllowedForSupervisedUsersCreation().empty()) { |
| 81 supervised_users_can_create = false; |
| 82 message_id = IDS_CREATE_SUPERVISED_USER_NO_MANAGER_EXCEPT_SUPERVISED_TEXT; |
| 83 } |
78 | 84 |
79 params->SetBoolean("supervisedUsersEnabled", supervised_users_allowed); | 85 params->SetBoolean("supervisedUsersEnabled", supervised_users_allowed); |
80 params->SetBoolean("supervisedUsersCanCreate", supervised_users_can_create); | 86 params->SetBoolean("supervisedUsersCanCreate", supervised_users_can_create); |
81 if (!supervised_users_can_create) { | 87 if (!supervised_users_can_create) { |
82 params->SetString("supervisedUsersRestrictionReason", | 88 params->SetString("supervisedUsersRestrictionReason", |
83 l10n_util::GetStringUTF16(message_id)); | 89 l10n_util::GetStringUTF16(message_id)); |
84 } | 90 } |
85 | 91 |
86 // Now check whether we're in multi-profiles user adding scenario and | 92 // Now check whether we're in multi-profiles user adding scenario and |
87 // disable GAIA right panel features if that's the case. | 93 // disable GAIA right panel features if that's the case. |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 | 718 |
713 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { | 719 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { |
714 DCHECK(signin_screen_handler_); | 720 DCHECK(signin_screen_handler_); |
715 return signin_screen_handler_->delegate_; | 721 return signin_screen_handler_->delegate_; |
716 } | 722 } |
717 | 723 |
718 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { | 724 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { |
719 signin_screen_handler_ = handler; | 725 signin_screen_handler_ = handler; |
720 } | 726 } |
721 } // namespace chromeos | 727 } // namespace chromeos |
OLD | NEW |