OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/chromeos/login/user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/user_manager_impl.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "ash/multi_profile_uma.h" | 10 #include "ash/multi_profile_uma.h" |
(...skipping 18 matching lines...) Expand all Loading... | |
29 #include "chrome/browser/app_mode/app_mode_utils.h" | 29 #include "chrome/browser/app_mode/app_mode_utils.h" |
30 #include "chrome/browser/browser_process.h" | 30 #include "chrome/browser/browser_process.h" |
31 #include "chrome/browser/chrome_notification_types.h" | 31 #include "chrome/browser/chrome_notification_types.h" |
32 #include "chrome/browser/chromeos/base/locale_util.h" | 32 #include "chrome/browser/chromeos/base/locale_util.h" |
33 #include "chrome/browser/chromeos/login/auth_sync_observer.h" | 33 #include "chrome/browser/chromeos/login/auth_sync_observer.h" |
34 #include "chrome/browser/chromeos/login/auth_sync_observer_factory.h" | 34 #include "chrome/browser/chromeos/login/auth_sync_observer_factory.h" |
35 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | 35 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
36 #include "chrome/browser/chromeos/login/login_display.h" | 36 #include "chrome/browser/chromeos/login/login_display.h" |
37 #include "chrome/browser/chromeos/login/login_utils.h" | 37 #include "chrome/browser/chromeos/login/login_utils.h" |
38 #include "chrome/browser/chromeos/login/multi_profile_user_controller.h" | 38 #include "chrome/browser/chromeos/login/multi_profile_user_controller.h" |
39 #include "chrome/browser/chromeos/login/owner_key_reloader_service.h" | |
40 #include "chrome/browser/chromeos/login/owner_key_reloader_service_factory.h" | |
39 #include "chrome/browser/chromeos/login/remove_user_delegate.h" | 41 #include "chrome/browser/chromeos/login/remove_user_delegate.h" |
40 #include "chrome/browser/chromeos/login/supervised_user_manager_impl.h" | 42 #include "chrome/browser/chromeos/login/supervised_user_manager_impl.h" |
41 #include "chrome/browser/chromeos/login/user_image_manager_impl.h" | 43 #include "chrome/browser/chromeos/login/user_image_manager_impl.h" |
42 #include "chrome/browser/chromeos/login/wizard_controller.h" | 44 #include "chrome/browser/chromeos/login/wizard_controller.h" |
43 #include "chrome/browser/chromeos/net/network_portal_detector.h" | 45 #include "chrome/browser/chromeos/net/network_portal_detector.h" |
44 #include "chrome/browser/chromeos/net/network_portal_detector_strategy.h" | 46 #include "chrome/browser/chromeos/net/network_portal_detector_strategy.h" |
45 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 47 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
46 #include "chrome/browser/chromeos/policy/device_local_account.h" | 48 #include "chrome/browser/chromeos/policy/device_local_account.h" |
47 #include "chrome/browser/chromeos/profiles/multiprofiles_session_aborted_dialog. h" | 49 #include "chrome/browser/chromeos/profiles/multiprofiles_session_aborted_dialog. h" |
48 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 50 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
972 // Call SwitchActiveUser async because otherwise it may cause | 974 // Call SwitchActiveUser async because otherwise it may cause |
973 // ProfileManager::GetProfile before the profile gets registered | 975 // ProfileManager::GetProfile before the profile gets registered |
974 // in ProfileManager. It happens in case of sync profile load when | 976 // in ProfileManager. It happens in case of sync profile load when |
975 // NOTIFICATION_PROFILE_CREATED is called synchronously. | 977 // NOTIFICATION_PROFILE_CREATED is called synchronously. |
976 base::MessageLoop::current()->PostTask(FROM_HERE, | 978 base::MessageLoop::current()->PostTask(FROM_HERE, |
977 base::Bind(&UserManagerImpl::SwitchActiveUser, | 979 base::Bind(&UserManagerImpl::SwitchActiveUser, |
978 base::Unretained(this), | 980 base::Unretained(this), |
979 pending_user_switch_)); | 981 pending_user_switch_)); |
980 pending_user_switch_.clear(); | 982 pending_user_switch_.clear(); |
981 } | 983 } |
984 if (profile && !ProfileHelper::IsSigninProfile(profile) && | |
Mattias Nissler (ping if slow)
2014/05/14 12:18:10
Why isn't this just handled by the factory or ctor
ygorshenin1
2014/05/14 15:30:07
Done.
| |
985 !profile->IsGuestSession()) { | |
986 OwnerKeyReloaderService* reloader = | |
987 OwnerKeyReloaderServiceFactory::GetInstance()->GetForProfile( | |
988 profile); | |
989 if (reloader) | |
990 reloader->ReloadOwnerKey(); | |
991 } | |
982 break; | 992 break; |
983 } | 993 } |
984 default: | 994 default: |
985 NOTREACHED(); | 995 NOTREACHED(); |
986 } | 996 } |
987 } | 997 } |
988 | 998 |
989 void UserManagerImpl::OnExternalDataSet(const std::string& policy, | 999 void UserManagerImpl::OnExternalDataSet(const std::string& policy, |
990 const std::string& user_id) { | 1000 const std::string& user_id) { |
991 if (policy == policy::key::kUserAvatarImage) | 1001 if (policy == policy::key::kUserAvatarImage) |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1556 // TODO(nkostylev): Deprecate this notification in favor of | 1566 // TODO(nkostylev): Deprecate this notification in favor of |
1557 // ActiveUserChanged() observer call. | 1567 // ActiveUserChanged() observer call. |
1558 content::NotificationService::current()->Notify( | 1568 content::NotificationService::current()->Notify( |
1559 chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 1569 chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
1560 content::Source<UserManager>(this), | 1570 content::Source<UserManager>(this), |
1561 content::Details<const User>(active_user_)); | 1571 content::Details<const User>(active_user_)); |
1562 | 1572 |
1563 // Owner must be first user in session. DeviceSettingsService can't deal with | 1573 // Owner must be first user in session. DeviceSettingsService can't deal with |
1564 // multiple user and will mix up ownership, crbug.com/230018. | 1574 // multiple user and will mix up ownership, crbug.com/230018. |
1565 if (GetLoggedInUsers().size() == 1) { | 1575 if (GetLoggedInUsers().size() == 1) { |
1566 // Indicate to DeviceSettingsService that the owner key may have become | 1576 // Try to load owner key for the active user. |
1567 // available. | 1577 OwnerKeyReloaderService::SetUsername(active_user_->email()); |
1568 DeviceSettingsService::Get()->SetUsername(active_user_->email()); | |
1569 | 1578 |
1570 if (NetworkPortalDetector::IsInitialized()) { | 1579 if (NetworkPortalDetector::IsInitialized()) { |
1571 NetworkPortalDetector::Get()->SetStrategy( | 1580 NetworkPortalDetector::Get()->SetStrategy( |
1572 PortalDetectorStrategy::STRATEGY_ID_SESSION); | 1581 PortalDetectorStrategy::STRATEGY_ID_SESSION); |
1573 } | 1582 } |
1574 } | 1583 } |
1575 } | 1584 } |
1576 | 1585 |
1577 User::OAuthTokenStatus UserManagerImpl::LoadUserOAuthStatus( | 1586 User::OAuthTokenStatus UserManagerImpl::LoadUserOAuthStatus( |
1578 const std::string& user_id) const { | 1587 const std::string& user_id) const { |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2097 } | 2106 } |
2098 | 2107 |
2099 void UserManagerImpl::DeleteUser(User* user) { | 2108 void UserManagerImpl::DeleteUser(User* user) { |
2100 const bool is_active_user = (user == active_user_); | 2109 const bool is_active_user = (user == active_user_); |
2101 delete user; | 2110 delete user; |
2102 if (is_active_user) | 2111 if (is_active_user) |
2103 active_user_ = NULL; | 2112 active_user_ = NULL; |
2104 } | 2113 } |
2105 | 2114 |
2106 } // namespace chromeos | 2115 } // namespace chromeos |
OLD | NEW |