| 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/user_adding_screen.h" | 14 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 15 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
| 16 #include "chrome/browser/chromeos/policy/consumer_management_service.h" | 15 #include "chrome/browser/chromeos/policy/consumer_management_service.h" |
| 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 16 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 18 #include "chrome/browser/chromeos/settings/cros_settings.h" | 17 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 19 #include "chrome/browser/io_thread.h" | 18 #include "chrome/browser/io_thread.h" |
| 20 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 19 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 21 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" | 20 #include "chrome/browser/ui/webui/signin/inline_login_ui.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 18 matching lines...) Expand all Loading... |
| 52 // Account creation depends on Guest sign-in (http://crosbug.com/24570). | 52 // Account creation depends on Guest sign-in (http://crosbug.com/24570). |
| 53 params->SetBoolean("createAccount", allow_new_user && allow_guest); | 53 params->SetBoolean("createAccount", allow_new_user && allow_guest); |
| 54 params->SetBoolean("guestSignin", allow_guest); | 54 params->SetBoolean("guestSignin", allow_guest); |
| 55 | 55 |
| 56 // Allow supervised user creation only if: | 56 // Allow supervised user creation only if: |
| 57 // 1. Enterprise managed device > is allowed by policy. | 57 // 1. Enterprise managed device > is allowed by policy. |
| 58 // 2. Consumer device > owner exists. | 58 // 2. Consumer device > owner exists. |
| 59 // 3. New users are allowed by owner. | 59 // 3. New users are allowed by owner. |
| 60 // 4. Supervised users are allowed by owner. | 60 // 4. Supervised users are allowed by owner. |
| 61 bool supervised_users_allowed = | 61 bool supervised_users_allowed = |
| 62 UserManager::Get()->AreSupervisedUsersAllowed(); | 62 user_manager::UserManager::Get()->AreSupervisedUsersAllowed(); |
| 63 bool supervised_users_can_create = true; | 63 bool supervised_users_can_create = true; |
| 64 int message_id = -1; | 64 int message_id = -1; |
| 65 if (!has_users) { | 65 if (!has_users) { |
| 66 supervised_users_can_create = false; | 66 supervised_users_can_create = false; |
| 67 message_id = IDS_CREATE_SUPERVISED_USER_NO_MANAGER_TEXT; | 67 message_id = IDS_CREATE_SUPERVISED_USER_NO_MANAGER_TEXT; |
| 68 } | 68 } |
| 69 if (!allow_new_user || !supervised_users_allowed) { | 69 if (!allow_new_user || !supervised_users_allowed) { |
| 70 supervised_users_can_create = false; | 70 supervised_users_can_create = false; |
| 71 message_id = IDS_CREATE_SUPERVISED_USER_CREATION_RESTRICTED_TEXT; | 71 message_id = IDS_CREATE_SUPERVISED_USER_CREATION_RESTRICTED_TEXT; |
| 72 } | 72 } |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 299 |
| 300 void GaiaScreenHandler::HandleCompleteLogin(const std::string& typed_email, | 300 void GaiaScreenHandler::HandleCompleteLogin(const std::string& typed_email, |
| 301 const std::string& password, | 301 const std::string& password, |
| 302 bool using_saml) { | 302 bool using_saml) { |
| 303 if (!is_enrolling_consumer_management_) { | 303 if (!is_enrolling_consumer_management_) { |
| 304 DoCompleteLogin(typed_email, password, using_saml); | 304 DoCompleteLogin(typed_email, password, using_saml); |
| 305 return; | 305 return; |
| 306 } | 306 } |
| 307 | 307 |
| 308 // Consumer management enrollment is in progress. | 308 // Consumer management enrollment is in progress. |
| 309 const std::string owner_email = UserManager::Get()->GetOwnerEmail(); | 309 const std::string owner_email = |
| 310 user_manager::UserManager::Get()->GetOwnerEmail(); |
| 310 if (typed_email != owner_email) { | 311 if (typed_email != owner_email) { |
| 311 // Show Gaia sign-in screen again, since we only allow the owner to sign | 312 // Show Gaia sign-in screen again, since we only allow the owner to sign |
| 312 // in. | 313 // in. |
| 313 populated_email_ = owner_email; | 314 populated_email_ = owner_email; |
| 314 ShowGaia(is_enrolling_consumer_management_); | 315 ShowGaia(is_enrolling_consumer_management_); |
| 315 return; | 316 return; |
| 316 } | 317 } |
| 317 | 318 |
| 318 CHECK(consumer_management_); | 319 CHECK(consumer_management_); |
| 319 consumer_management_->SetOwner(owner_email, | 320 consumer_management_->SetOwner(owner_email, |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 | 613 |
| 613 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { | 614 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { |
| 614 DCHECK(signin_screen_handler_); | 615 DCHECK(signin_screen_handler_); |
| 615 return signin_screen_handler_->delegate_; | 616 return signin_screen_handler_->delegate_; |
| 616 } | 617 } |
| 617 | 618 |
| 618 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { | 619 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { |
| 619 signin_screen_handler_ = handler; | 620 signin_screen_handler_ = handler; |
| 620 } | 621 } |
| 621 } // namespace chromeos | 622 } // namespace chromeos |
| OLD | NEW |