OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/signin_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/chromeos/chromeos_version.h" | 8 #include "base/chromeos/chromeos_version.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
449 builder->Add("cancelUserAdding", IDS_CANCEL_USER_ADDING); | 449 builder->Add("cancelUserAdding", IDS_CANCEL_USER_ADDING); |
450 builder->Add("browseAsGuest", IDS_GO_INCOGNITO_BUTTON); | 450 builder->Add("browseAsGuest", IDS_GO_INCOGNITO_BUTTON); |
451 builder->Add("cancel", IDS_CANCEL); | 451 builder->Add("cancel", IDS_CANCEL); |
452 builder->Add("signOutUser", IDS_SCREEN_LOCK_SIGN_OUT); | 452 builder->Add("signOutUser", IDS_SCREEN_LOCK_SIGN_OUT); |
453 builder->Add("createAccount", IDS_CREATE_ACCOUNT_HTML); | 453 builder->Add("createAccount", IDS_CREATE_ACCOUNT_HTML); |
454 builder->Add("guestSignin", IDS_BROWSE_WITHOUT_SIGNING_IN_HTML); | 454 builder->Add("guestSignin", IDS_BROWSE_WITHOUT_SIGNING_IN_HTML); |
455 builder->Add("createLocallyManagedUser", | 455 builder->Add("createLocallyManagedUser", |
456 IDS_CREATE_LOCALLY_MANAGED_USER_HTML); | 456 IDS_CREATE_LOCALLY_MANAGED_USER_HTML); |
457 builder->Add("createManagedUserFeatureName", | 457 builder->Add("createManagedUserFeatureName", |
458 IDS_CREATE_LOCALLY_MANAGED_USER_FEATURE_NAME); | 458 IDS_CREATE_LOCALLY_MANAGED_USER_FEATURE_NAME); |
459 builder->Add("createManagedUserNoManagerText", | |
460 IDS_CREATE_LOCALLY_MANAGED_USER_NO_MANAGER_TEXT); | |
461 builder->Add("offlineLogin", IDS_OFFLINE_LOGIN_HTML); | 459 builder->Add("offlineLogin", IDS_OFFLINE_LOGIN_HTML); |
462 builder->Add("ownerUserPattern", IDS_LOGIN_POD_OWNER_USER); | 460 builder->Add("ownerUserPattern", IDS_LOGIN_POD_OWNER_USER); |
463 builder->Add("removeUser", IDS_LOGIN_POD_REMOVE_USER); | 461 builder->Add("removeUser", IDS_LOGIN_POD_REMOVE_USER); |
464 builder->Add("errorTpmFailureTitle", IDS_LOGIN_ERROR_TPM_FAILURE_TITLE); | 462 builder->Add("errorTpmFailureTitle", IDS_LOGIN_ERROR_TPM_FAILURE_TITLE); |
465 builder->Add("errorTpmFailureReboot", IDS_LOGIN_ERROR_TPM_FAILURE_REBOOT); | 463 builder->Add("errorTpmFailureReboot", IDS_LOGIN_ERROR_TPM_FAILURE_REBOOT); |
466 builder->Add("errorTpmFailureRebootButton", | 464 builder->Add("errorTpmFailureRebootButton", |
467 IDS_LOGIN_ERROR_TPM_FAILURE_REBOOT_BUTTON); | 465 IDS_LOGIN_ERROR_TPM_FAILURE_REBOOT_BUTTON); |
468 builder->Add( | 466 builder->Add( |
469 "disabledAddUserTooltip", | 467 "disabledAddUserTooltip", |
470 g_browser_process->browser_policy_connector()->IsEnterpriseManaged() ? | 468 g_browser_process->browser_policy_connector()->IsEnterpriseManaged() ? |
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1091 // 1. Enterprise managed device > is allowed by policy. | 1089 // 1. Enterprise managed device > is allowed by policy. |
1092 // 2. Consumer device > owner exists. | 1090 // 2. Consumer device > owner exists. |
1093 // 3. New users are allowed by owner. | 1091 // 3. New users are allowed by owner. |
1094 | 1092 |
1095 CrosSettings* cros_settings = CrosSettings::Get(); | 1093 CrosSettings* cros_settings = CrosSettings::Get(); |
1096 bool allow_new_user = false; | 1094 bool allow_new_user = false; |
1097 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 1095 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
1098 | 1096 |
1099 bool managed_users_allowed = | 1097 bool managed_users_allowed = |
1100 UserManager::Get()->AreLocallyManagedUsersAllowed(); | 1098 UserManager::Get()->AreLocallyManagedUsersAllowed(); |
1101 bool managed_users_can_create = false; | 1099 bool managed_users_can_create = true; |
1102 if (managed_users_allowed) { | 1100 LOG(ERROR) << "Allow new users " << managed_users_allowed; |
Nikita (slow)
2013/08/12 15:20:42
nit: Remove debug logging.
| |
1103 managed_users_can_create = | 1101 int message_id = -1; |
1104 (delegate_->GetUsers().size() > 0) && allow_new_user; | 1102 if (delegate_->GetUsers().size() == 0) { |
1103 managed_users_can_create = false; | |
1104 message_id = IDS_CREATE_LOCALLY_MANAGED_USER_NO_MANAGER_TEXT; | |
1105 } | 1105 } |
1106 if (!allow_new_user) { | |
1107 managed_users_can_create = false; | |
1108 message_id = IDS_CREATE_LOCALLY_MANAGED_USER_CREATION_RESTRICTED_TEXT; | |
1109 } | |
1110 | |
1106 params->SetBoolean("managedUsersEnabled", managed_users_allowed); | 1111 params->SetBoolean("managedUsersEnabled", managed_users_allowed); |
1107 params->SetBoolean("managedUsersCanCreate", managed_users_can_create); | 1112 params->SetBoolean("managedUsersCanCreate", managed_users_can_create); |
1113 if (!managed_users_can_create) { | |
1114 params->SetString("managedUsersRestrictionReason", | |
1115 l10n_util::GetStringUTF16(message_id)); | |
1116 } | |
1108 } | 1117 } |
1109 | 1118 |
1110 void SigninScreenHandler::LoadAuthExtension( | 1119 void SigninScreenHandler::LoadAuthExtension( |
1111 bool force, bool silent_load, bool offline) { | 1120 bool force, bool silent_load, bool offline) { |
1112 DictionaryValue params; | 1121 DictionaryValue params; |
1113 | 1122 |
1114 params.SetBoolean("forceReload", force); | 1123 params.SetBoolean("forceReload", force); |
1115 params.SetBoolean("silentLoad", silent_load); | 1124 params.SetBoolean("silentLoad", silent_load); |
1116 params.SetBoolean("isLocal", offline); | 1125 params.SetBoolean("isLocal", offline); |
1117 params.SetBoolean("passwordChanged", | 1126 params.SetBoolean("passwordChanged", |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1734 rvh->ExecuteJavascriptInWebFrame( | 1743 rvh->ExecuteJavascriptInWebFrame( |
1735 ASCIIToUTF16("//iframe[@id='signin-frame']\n//iframe"), | 1744 ASCIIToUTF16("//iframe[@id='signin-frame']\n//iframe"), |
1736 ASCIIToUTF16(code)); | 1745 ASCIIToUTF16(code)); |
1737 | 1746 |
1738 // Test properties are cleared in HandleCompleteLogin because the form | 1747 // Test properties are cleared in HandleCompleteLogin because the form |
1739 // submission might fail and login will not be attempted after reloading | 1748 // submission might fail and login will not be attempted after reloading |
1740 // if they are cleared here. | 1749 // if they are cleared here. |
1741 } | 1750 } |
1742 | 1751 |
1743 } // namespace chromeos | 1752 } // namespace chromeos |
OLD | NEW |