| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/login/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 #include "chrome/browser/first_run/first_run.h" | 49 #include "chrome/browser/first_run/first_run.h" |
| 50 #include "chrome/browser/net/chrome_url_request_context.h" | 50 #include "chrome/browser/net/chrome_url_request_context.h" |
| 51 #include "chrome/browser/net/preconnect.h" | 51 #include "chrome/browser/net/preconnect.h" |
| 52 #include "chrome/browser/policy/browser_policy_connector.h" | 52 #include "chrome/browser/policy/browser_policy_connector.h" |
| 53 #include "chrome/browser/policy/cloud_policy_client.h" | 53 #include "chrome/browser/policy/cloud_policy_client.h" |
| 54 #include "chrome/browser/policy/cloud_policy_service.h" | 54 #include "chrome/browser/policy/cloud_policy_service.h" |
| 55 #include "chrome/browser/policy/user_cloud_policy_manager.h" | 55 #include "chrome/browser/policy/user_cloud_policy_manager.h" |
| 56 #include "chrome/browser/prefs/pref_service.h" | 56 #include "chrome/browser/prefs/pref_service.h" |
| 57 #include "chrome/browser/profiles/profile.h" | 57 #include "chrome/browser/profiles/profile.h" |
| 58 #include "chrome/browser/profiles/profile_manager.h" | 58 #include "chrome/browser/profiles/profile_manager.h" |
| 59 #include "chrome/browser/rlz/rlz.h" |
| 59 #include "chrome/browser/signin/signin_manager.h" | 60 #include "chrome/browser/signin/signin_manager.h" |
| 60 #include "chrome/browser/signin/signin_manager_factory.h" | 61 #include "chrome/browser/signin/signin_manager_factory.h" |
| 61 #include "chrome/browser/signin/token_service.h" | 62 #include "chrome/browser/signin/token_service.h" |
| 62 #include "chrome/browser/signin/token_service_factory.h" | 63 #include "chrome/browser/signin/token_service_factory.h" |
| 63 #include "chrome/browser/sync/profile_sync_service.h" | 64 #include "chrome/browser/sync/profile_sync_service.h" |
| 64 #include "chrome/browser/sync/profile_sync_service_factory.h" | 65 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 65 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 66 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 66 #include "chrome/common/chrome_notification_types.h" | 67 #include "chrome/common/chrome_notification_types.h" |
| 67 #include "chrome/common/chrome_paths.h" | 68 #include "chrome/common/chrome_paths.h" |
| 68 #include "chrome/common/chrome_switches.h" | 69 #include "chrome/common/chrome_switches.h" |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 | 634 |
| 634 user_profile->OnLogin(); | 635 user_profile->OnLogin(); |
| 635 | 636 |
| 636 // Send the notification before creating the browser so additional objects | 637 // Send the notification before creating the browser so additional objects |
| 637 // that need the profile (e.g. the launcher) can be created first. | 638 // that need the profile (e.g. the launcher) can be created first. |
| 638 content::NotificationService::current()->Notify( | 639 content::NotificationService::current()->Notify( |
| 639 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 640 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 640 content::NotificationService::AllSources(), | 641 content::NotificationService::AllSources(), |
| 641 content::Details<Profile>(user_profile)); | 642 content::Details<Profile>(user_profile)); |
| 642 | 643 |
| 644 #if defined(ENABLE_RLZ) |
| 645 // Init the RLZ library. |
| 646 int ping_delay = user_profile->GetPrefs()->GetInteger( |
| 647 first_run::GetPingDelayPrefName().c_str()); |
| 648 RLZTracker::InitRlzFromProfileDelayed( |
| 649 user_profile, UserManager::Get()->IsCurrentUserNew(), ping_delay); |
| 650 #endif |
| 651 |
| 643 // TODO(altimofeev): This pointer should probably never be NULL, but it looks | 652 // TODO(altimofeev): This pointer should probably never be NULL, but it looks |
| 644 // like LoginUtilsImpl::OnProfileCreated() may be getting called before | 653 // like LoginUtilsImpl::OnProfileCreated() may be getting called before |
| 645 // LoginUtilsImpl::PrepareProfile() has set |delegate_| when Chrome is killed | 654 // LoginUtilsImpl::PrepareProfile() has set |delegate_| when Chrome is killed |
| 646 // during shutdown in tests -- see http://crosbug.com/18269. Replace this | 655 // during shutdown in tests -- see http://crosbug.com/18269. Replace this |
| 647 // 'if' statement with a CHECK(delegate_) once the underlying issue is | 656 // 'if' statement with a CHECK(delegate_) once the underlying issue is |
| 648 // resolved. | 657 // resolved. |
| 649 if (delegate_) | 658 if (delegate_) |
| 650 delegate_->OnProfilePrepared(user_profile); | 659 delegate_->OnProfilePrepared(user_profile); |
| 651 } | 660 } |
| 652 | 661 |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 bool LoginUtils::IsWhitelisted(const std::string& username) { | 1250 bool LoginUtils::IsWhitelisted(const std::string& username) { |
| 1242 CrosSettings* cros_settings = CrosSettings::Get(); | 1251 CrosSettings* cros_settings = CrosSettings::Get(); |
| 1243 bool allow_new_user = false; | 1252 bool allow_new_user = false; |
| 1244 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 1253 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
| 1245 if (allow_new_user) | 1254 if (allow_new_user) |
| 1246 return true; | 1255 return true; |
| 1247 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); | 1256 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); |
| 1248 } | 1257 } |
| 1249 | 1258 |
| 1250 } // namespace chromeos | 1259 } // namespace chromeos |
| OLD | NEW |