| 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/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/browser_shutdown.h" | 13 #include "chrome/browser/browser_shutdown.h" |
| 14 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 14 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 15 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 15 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 16 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 17 #include "chrome/browser/chromeos/policy/consumer_management_service.h" | 16 #include "chrome/browser/chromeos/policy/consumer_management_service.h" |
| 18 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 19 #include "chrome/browser/chromeos/settings/cros_settings.h" | 18 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 20 #include "chrome/browser/io_thread.h" | 19 #include "chrome/browser/io_thread.h" |
| 21 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 20 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 22 #include "chromeos/chromeos_switches.h" | 21 #include "chromeos/chromeos_switches.h" |
| 23 #include "chromeos/settings/cros_settings_names.h" | 22 #include "chromeos/settings/cros_settings_names.h" |
| 23 #include "components/user_manager/user_manager.h" |
| 24 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 25 #include "content/public/browser/render_frame_host.h" | 25 #include "content/public/browser/render_frame_host.h" |
| 26 #include "google_apis/gaia/gaia_auth_util.h" | 26 #include "google_apis/gaia/gaia_auth_util.h" |
| 27 #include "google_apis/gaia/gaia_switches.h" | 27 #include "google_apis/gaia/gaia_switches.h" |
| 28 #include "google_apis/gaia/gaia_urls.h" | 28 #include "google_apis/gaia/gaia_urls.h" |
| 29 #include "grit/chromium_strings.h" | 29 #include "grit/chromium_strings.h" |
| 30 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
| 31 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
| 32 | 32 |
| 33 using content::BrowserThread; | 33 using content::BrowserThread; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 49 // Account creation depends on Guest sign-in (http://crosbug.com/24570). | 49 // Account creation depends on Guest sign-in (http://crosbug.com/24570). |
| 50 params->SetBoolean("createAccount", allow_new_user && allow_guest); | 50 params->SetBoolean("createAccount", allow_new_user && allow_guest); |
| 51 params->SetBoolean("guestSignin", allow_guest); | 51 params->SetBoolean("guestSignin", allow_guest); |
| 52 | 52 |
| 53 // Allow supervised user creation only if: | 53 // Allow supervised user creation only if: |
| 54 // 1. Enterprise managed device > is allowed by policy. | 54 // 1. Enterprise managed device > is allowed by policy. |
| 55 // 2. Consumer device > owner exists. | 55 // 2. Consumer device > owner exists. |
| 56 // 3. New users are allowed by owner. | 56 // 3. New users are allowed by owner. |
| 57 // 4. Supervised users are allowed by owner. | 57 // 4. Supervised users are allowed by owner. |
| 58 bool supervised_users_allowed = | 58 bool supervised_users_allowed = |
| 59 UserManager::Get()->AreSupervisedUsersAllowed(); | 59 user_manager::UserManager::Get()->AreSupervisedUsersAllowed(); |
| 60 bool supervised_users_can_create = true; | 60 bool supervised_users_can_create = true; |
| 61 int message_id = -1; | 61 int message_id = -1; |
| 62 if (!has_users) { | 62 if (!has_users) { |
| 63 supervised_users_can_create = false; | 63 supervised_users_can_create = false; |
| 64 message_id = IDS_CREATE_SUPERVISED_USER_NO_MANAGER_TEXT; | 64 message_id = IDS_CREATE_SUPERVISED_USER_NO_MANAGER_TEXT; |
| 65 } | 65 } |
| 66 if (!allow_new_user || !supervised_users_allowed) { | 66 if (!allow_new_user || !supervised_users_allowed) { |
| 67 supervised_users_can_create = false; | 67 supervised_users_can_create = false; |
| 68 message_id = IDS_CREATE_SUPERVISED_USER_CREATION_RESTRICTED_TEXT; | 68 message_id = IDS_CREATE_SUPERVISED_USER_CREATION_RESTRICTED_TEXT; |
| 69 } | 69 } |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 296 |
| 297 void GaiaScreenHandler::HandleCompleteLogin(const std::string& typed_email, | 297 void GaiaScreenHandler::HandleCompleteLogin(const std::string& typed_email, |
| 298 const std::string& password, | 298 const std::string& password, |
| 299 bool using_saml) { | 299 bool using_saml) { |
| 300 if (!is_enrolling_consumer_management_) { | 300 if (!is_enrolling_consumer_management_) { |
| 301 DoCompleteLogin(typed_email, password, using_saml); | 301 DoCompleteLogin(typed_email, password, using_saml); |
| 302 return; | 302 return; |
| 303 } | 303 } |
| 304 | 304 |
| 305 // Consumer management enrollment is in progress. | 305 // Consumer management enrollment is in progress. |
| 306 const std::string owner_email = UserManager::Get()->GetOwnerEmail(); | 306 const std::string owner_email = |
| 307 user_manager::UserManager::Get()->GetOwnerEmail(); |
| 307 if (typed_email != owner_email) { | 308 if (typed_email != owner_email) { |
| 308 // Show Gaia sign-in screen again, since we only allow the owner to sign | 309 // Show Gaia sign-in screen again, since we only allow the owner to sign |
| 309 // in. | 310 // in. |
| 310 populated_email_ = owner_email; | 311 populated_email_ = owner_email; |
| 311 ShowGaia(is_enrolling_consumer_management_); | 312 ShowGaia(is_enrolling_consumer_management_); |
| 312 return; | 313 return; |
| 313 } | 314 } |
| 314 | 315 |
| 315 CHECK(consumer_management_); | 316 CHECK(consumer_management_); |
| 316 consumer_management_->SetOwner(owner_email, | 317 consumer_management_->SetOwner(owner_email, |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 | 604 |
| 604 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { | 605 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { |
| 605 DCHECK(signin_screen_handler_); | 606 DCHECK(signin_screen_handler_); |
| 606 return signin_screen_handler_->delegate_; | 607 return signin_screen_handler_->delegate_; |
| 607 } | 608 } |
| 608 | 609 |
| 609 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { | 610 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { |
| 610 signin_screen_handler_ = handler; | 611 signin_screen_handler_ = handler; |
| 611 } | 612 } |
| 612 } // namespace chromeos | 613 } // namespace chromeos |
| OLD | NEW |