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/network_configuration_updater.h" | 55 #include "chrome/browser/policy/network_configuration_updater.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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 | 628 |
628 user_profile->OnLogin(); | 629 user_profile->OnLogin(); |
629 | 630 |
630 // Send the notification before creating the browser so additional objects | 631 // Send the notification before creating the browser so additional objects |
631 // that need the profile (e.g. the launcher) can be created first. | 632 // that need the profile (e.g. the launcher) can be created first. |
632 content::NotificationService::current()->Notify( | 633 content::NotificationService::current()->Notify( |
633 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 634 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
634 content::NotificationService::AllSources(), | 635 content::NotificationService::AllSources(), |
635 content::Details<Profile>(user_profile)); | 636 content::Details<Profile>(user_profile)); |
636 | 637 |
| 638 #if defined(ENABLE_RLZ) |
| 639 // Init the RLZ library. |
| 640 int ping_delay = user_profile->GetPrefs()->GetInteger( |
| 641 first_run::GetPingDelayPrefName().c_str()); |
| 642 RLZTracker::InitRlzFromProfileDelayed( |
| 643 user_profile, UserManager::Get()->IsCurrentUserNew(), ping_delay); |
| 644 #endif |
| 645 |
637 // TODO(altimofeev): This pointer should probably never be NULL, but it looks | 646 // TODO(altimofeev): This pointer should probably never be NULL, but it looks |
638 // like LoginUtilsImpl::OnProfileCreated() may be getting called before | 647 // like LoginUtilsImpl::OnProfileCreated() may be getting called before |
639 // LoginUtilsImpl::PrepareProfile() has set |delegate_| when Chrome is killed | 648 // LoginUtilsImpl::PrepareProfile() has set |delegate_| when Chrome is killed |
640 // during shutdown in tests -- see http://crosbug.com/18269. Replace this | 649 // during shutdown in tests -- see http://crosbug.com/18269. Replace this |
641 // 'if' statement with a CHECK(delegate_) once the underlying issue is | 650 // 'if' statement with a CHECK(delegate_) once the underlying issue is |
642 // resolved. | 651 // resolved. |
643 if (delegate_) | 652 if (delegate_) |
644 delegate_->OnProfilePrepared(user_profile); | 653 delegate_->OnProfilePrepared(user_profile); |
645 } | 654 } |
646 | 655 |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 bool LoginUtils::IsWhitelisted(const std::string& username) { | 1245 bool LoginUtils::IsWhitelisted(const std::string& username) { |
1237 CrosSettings* cros_settings = CrosSettings::Get(); | 1246 CrosSettings* cros_settings = CrosSettings::Get(); |
1238 bool allow_new_user = false; | 1247 bool allow_new_user = false; |
1239 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 1248 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
1240 if (allow_new_user) | 1249 if (allow_new_user) |
1241 return true; | 1250 return true; |
1242 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); | 1251 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); |
1243 } | 1252 } |
1244 | 1253 |
1245 } // namespace chromeos | 1254 } // namespace chromeos |
OLD | NEW |