OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/session/user_session_manager.h" | 5 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 41 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
42 #include "chrome/browser/chromeos/settings/cros_settings.h" | 42 #include "chrome/browser/chromeos/settings/cros_settings.h" |
43 #include "chrome/browser/first_run/first_run.h" | 43 #include "chrome/browser/first_run/first_run.h" |
44 #include "chrome/browser/google/google_brand_chromeos.h" | 44 #include "chrome/browser/google/google_brand_chromeos.h" |
45 #include "chrome/browser/lifetime/application_lifetime.h" | 45 #include "chrome/browser/lifetime/application_lifetime.h" |
46 #include "chrome/browser/net/crl_set_fetcher.h" | 46 #include "chrome/browser/net/crl_set_fetcher.h" |
47 #include "chrome/browser/net/nss_context.h" | 47 #include "chrome/browser/net/nss_context.h" |
48 #include "chrome/browser/profiles/profile.h" | 48 #include "chrome/browser/profiles/profile.h" |
49 #include "chrome/browser/profiles/profile_manager.h" | 49 #include "chrome/browser/profiles/profile_manager.h" |
50 #include "chrome/browser/rlz/rlz.h" | 50 #include "chrome/browser/rlz/rlz.h" |
| 51 #include "chrome/browser/signin/account_tracker_service_factory.h" |
51 #include "chrome/browser/signin/easy_unlock_service.h" | 52 #include "chrome/browser/signin/easy_unlock_service.h" |
52 #include "chrome/browser/signin/signin_manager_factory.h" | 53 #include "chrome/browser/signin/signin_manager_factory.h" |
53 #include "chrome/common/chrome_switches.h" | 54 #include "chrome/common/chrome_switches.h" |
54 #include "chrome/common/logging_chrome.h" | 55 #include "chrome/common/logging_chrome.h" |
55 #include "chrome/common/pref_names.h" | 56 #include "chrome/common/pref_names.h" |
56 #include "chromeos/cert_loader.h" | 57 #include "chromeos/cert_loader.h" |
57 #include "chromeos/chromeos_switches.h" | 58 #include "chromeos/chromeos_switches.h" |
58 #include "chromeos/cryptohome/cryptohome_util.h" | 59 #include "chromeos/cryptohome/cryptohome_util.h" |
59 #include "chromeos/dbus/cryptohome_client.h" | 60 #include "chromeos/dbus/cryptohome_client.h" |
60 #include "chromeos/dbus/dbus_thread_manager.h" | 61 #include "chromeos/dbus/dbus_thread_manager.h" |
61 #include "chromeos/dbus/session_manager_client.h" | 62 #include "chromeos/dbus/session_manager_client.h" |
62 #include "chromeos/ime/input_method_manager.h" | 63 #include "chromeos/ime/input_method_manager.h" |
63 #include "chromeos/login/user_names.h" | 64 #include "chromeos/login/user_names.h" |
64 #include "chromeos/network/portal_detector/network_portal_detector.h" | 65 #include "chromeos/network/portal_detector/network_portal_detector.h" |
65 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h" | 66 #include "chromeos/network/portal_detector/network_portal_detector_strategy.h" |
66 #include "chromeos/settings/cros_settings_names.h" | 67 #include "chromeos/settings/cros_settings_names.h" |
67 #include "components/component_updater/component_updater_service.h" | 68 #include "components/component_updater/component_updater_service.h" |
68 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 69 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
69 #include "components/session_manager/core/session_manager.h" | 70 #include "components/session_manager/core/session_manager.h" |
| 71 #include "components/signin/core/browser/account_tracker_service.h" |
70 #include "components/signin/core/browser/signin_manager_base.h" | 72 #include "components/signin/core/browser/signin_manager_base.h" |
71 #include "components/user_manager/user.h" | 73 #include "components/user_manager/user.h" |
72 #include "components/user_manager/user_manager.h" | 74 #include "components/user_manager/user_manager.h" |
73 #include "components/user_manager/user_type.h" | 75 #include "components/user_manager/user_type.h" |
74 #include "content/public/browser/browser_thread.h" | 76 #include "content/public/browser/browser_thread.h" |
75 #include "content/public/browser/notification_service.h" | 77 #include "content/public/browser/notification_service.h" |
76 #include "url/gurl.h" | 78 #include "url/gurl.h" |
77 | 79 |
78 namespace chromeos { | 80 namespace chromeos { |
79 | 81 |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 | 726 |
725 if (user_manager::UserManager::Get()->IsLoggedInAsSupervisedUser()) { | 727 if (user_manager::UserManager::Get()->IsLoggedInAsSupervisedUser()) { |
726 user_manager::User* active_user = | 728 user_manager::User* active_user = |
727 user_manager::UserManager::Get()->GetActiveUser(); | 729 user_manager::UserManager::Get()->GetActiveUser(); |
728 std::string supervised_user_sync_id = | 730 std::string supervised_user_sync_id = |
729 ChromeUserManager::Get()->GetSupervisedUserManager()->GetUserSyncId( | 731 ChromeUserManager::Get()->GetSupervisedUserManager()->GetUserSyncId( |
730 active_user->email()); | 732 active_user->email()); |
731 profile->GetPrefs()->SetString(prefs::kSupervisedUserId, | 733 profile->GetPrefs()->SetString(prefs::kSupervisedUserId, |
732 supervised_user_sync_id); | 734 supervised_user_sync_id); |
733 } else if (user_manager::UserManager::Get()->IsLoggedInAsRegularUser()) { | 735 } else if (user_manager::UserManager::Get()->IsLoggedInAsRegularUser()) { |
| 736 // Prime the account tracker with this combination of gaia id/display email. |
| 737 // Don't do this unless both email and gaia_id are valid. They may not |
| 738 // be when simply unlocking the profile. |
| 739 if (!user_context.GetGaiaID().empty() && |
| 740 !user_context.GetUserID().empty()) { |
| 741 AccountTrackerService* account_tracker = |
| 742 AccountTrackerServiceFactory::GetForProfile(profile); |
| 743 account_tracker->SeedAccountInfo(user_context.GetGaiaID(), |
| 744 user_context.GetUserID()); |
| 745 } |
| 746 |
734 // Make sure that the google service username is properly set (we do this | 747 // Make sure that the google service username is properly set (we do this |
735 // on every sign in, not just the first login, to deal with existing | 748 // on every sign in, not just the first login, to deal with existing |
736 // profiles that might not have it set yet). | 749 // profiles that might not have it set yet). |
737 SigninManagerBase* signin_manager = | 750 SigninManagerBase* signin_manager = |
738 SigninManagerFactory::GetForProfile(profile); | 751 SigninManagerFactory::GetForProfile(profile); |
739 signin_manager->SetAuthenticatedUsername(user_context.GetUserID()); | 752 signin_manager->SetAuthenticatedUsername(user_context.GetUserID()); |
740 } | 753 } |
741 } | 754 } |
742 | 755 |
743 void UserSessionManager::UserProfileInitialized(Profile* profile, | 756 void UserSessionManager::UserProfileInitialized(Profile* profile, |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 } | 1162 } |
1150 | 1163 |
1151 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { | 1164 EasyUnlockKeyManager* UserSessionManager::GetEasyUnlockKeyManager() { |
1152 if (!easy_unlock_key_manager_) | 1165 if (!easy_unlock_key_manager_) |
1153 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); | 1166 easy_unlock_key_manager_.reset(new EasyUnlockKeyManager); |
1154 | 1167 |
1155 return easy_unlock_key_manager_.get(); | 1168 return easy_unlock_key_manager_.get(); |
1156 } | 1169 } |
1157 | 1170 |
1158 } // namespace chromeos | 1171 } // namespace chromeos |
OLD | NEW |