Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc

Issue 1266563002: Added affiliation IDs for the new affiliation determination. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/users/chrome_user_manager_impl.h" 5 #include "chrome/browser/chromeos/login/users/chrome_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 11 matching lines...) Expand all
22 #include "base/strings/stringprintf.h" 22 #include "base/strings/stringprintf.h"
23 #include "base/strings/utf_string_conversions.h" 23 #include "base/strings/utf_string_conversions.h"
24 #include "base/thread_task_runner_handle.h" 24 #include "base/thread_task_runner_handle.h"
25 #include "base/values.h" 25 #include "base/values.h"
26 #include "chrome/browser/browser_process.h" 26 #include "chrome/browser/browser_process.h"
27 #include "chrome/browser/chrome_notification_types.h" 27 #include "chrome/browser/chrome_notification_types.h"
28 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" 28 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h"
29 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 29 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
30 #include "chrome/browser/chromeos/login/signin/auth_sync_observer.h" 30 #include "chrome/browser/chromeos/login/signin/auth_sync_observer.h"
31 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h" 31 #include "chrome/browser/chromeos/login/signin/auth_sync_observer_factory.h"
32 #include "chrome/browser/chromeos/login/users/affiliation.h"
32 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h" 33 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.h"
33 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" 34 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
34 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h" 35 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h"
35 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 36 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
36 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 37 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
37 #include "chrome/browser/chromeos/policy/device_local_account.h" 38 #include "chrome/browser/chromeos/policy/device_local_account.h"
38 #include "chrome/browser/chromeos/profiles/multiprofiles_session_aborted_dialog. h" 39 #include "chrome/browser/chromeos/profiles/multiprofiles_session_aborted_dialog. h"
39 #include "chrome/browser/chromeos/profiles/profile_helper.h" 40 #include "chrome/browser/chromeos/profiles/profile_helper.h"
40 #include "chrome/browser/chromeos/session_length_limiter.h" 41 #include "chrome/browser/chromeos/session_length_limiter.h"
41 #include "chrome/browser/chromeos/settings/cros_settings.h" 42 #include "chrome/browser/chromeos/settings/cros_settings.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 88 }
88 89
89 } // namespace 90 } // namespace
90 91
91 // static 92 // static
92 void ChromeUserManagerImpl::RegisterPrefs(PrefRegistrySimple* registry) { 93 void ChromeUserManagerImpl::RegisterPrefs(PrefRegistrySimple* registry) {
93 ChromeUserManager::RegisterPrefs(registry); 94 ChromeUserManager::RegisterPrefs(registry);
94 95
95 registry->RegisterListPref(kPublicAccounts); 96 registry->RegisterListPref(kPublicAccounts);
96 registry->RegisterStringPref(kPublicAccountPendingDataRemoval, std::string()); 97 registry->RegisterStringPref(kPublicAccountPendingDataRemoval, std::string());
98
97 SupervisedUserManager::RegisterPrefs(registry); 99 SupervisedUserManager::RegisterPrefs(registry);
98 SessionLengthLimiter::RegisterPrefs(registry); 100 SessionLengthLimiter::RegisterPrefs(registry);
99 BootstrapManager::RegisterPrefs(registry); 101 BootstrapManager::RegisterPrefs(registry);
100 } 102 }
101 103
102 // static 104 // static
103 scoped_ptr<ChromeUserManager> ChromeUserManagerImpl::CreateChromeUserManager() { 105 scoped_ptr<ChromeUserManager> ChromeUserManagerImpl::CreateChromeUserManager() {
104 return scoped_ptr<ChromeUserManager>(new ChromeUserManagerImpl()); 106 return scoped_ptr<ChromeUserManager>(new ChromeUserManagerImpl());
105 } 107 }
106 108
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 716
715 // Make sure that new data is persisted to Local State. 717 // Make sure that new data is persisted to Local State.
716 GetLocalState()->CommitPendingWrite(); 718 GetLocalState()->CommitPendingWrite();
717 } 719 }
718 720
719 bool ChromeUserManagerImpl::HasPendingBootstrap( 721 bool ChromeUserManagerImpl::HasPendingBootstrap(
720 const std::string& user_id) const { 722 const std::string& user_id) const {
721 return bootstrap_manager_->HasPendingBootstrap(user_id); 723 return bootstrap_manager_->HasPendingBootstrap(user_id);
722 } 724 }
723 725
726 std::set<std::string> ChromeUserManagerImpl::GetDeviceAffiliationIDs() const {
Mattias Nissler (ping if slow) 2015/07/29 20:08:13 Any good reason to have this as a separate functio
peletskyi 2015/07/30 11:02:27 Done.
727 return g_browser_process->platform_part()
728 ->browser_policy_connector_chromeos()
729 ->GetDeviceAffiliationIDs();
730 }
731
732 std::string ChromeUserManagerImpl::GetEnterpriseDomain() const {
Mattias Nissler (ping if slow) 2015/07/29 20:08:13 ditto, can't this simply be inlined in IsUserAffil
peletskyi 2015/07/30 11:02:27 Done.
733 return g_browser_process->platform_part()
734 ->browser_policy_connector_chromeos()
735 ->GetEnterpriseDomain();
736 }
737
738 bool ChromeUserManagerImpl::IsUserAffiliated(
739 const std::set<std::string>& user_affiliation_ids,
740 const std::string& user_email) const {
741 return chromeos::IsUserAffiliated(user_affiliation_ids,
742 GetDeviceAffiliationIDs(), user_email,
743 GetEnterpriseDomain());
744 }
745
724 void ChromeUserManagerImpl::PublicAccountUserLoggedIn( 746 void ChromeUserManagerImpl::PublicAccountUserLoggedIn(
725 user_manager::User* user) { 747 user_manager::User* user) {
726 SetIsCurrentUserNew(true); 748 SetIsCurrentUserNew(true);
727 active_user_ = user; 749 active_user_ = user;
728 750
729 // The UserImageManager chooses a random avatar picture when a user logs in 751 // The UserImageManager chooses a random avatar picture when a user logs in
730 // for the first time. Tell the UserImageManager that this user is not new to 752 // for the first time. Tell the UserImageManager that this user is not new to
731 // prevent the avatar from getting changed. 753 // prevent the avatar from getting changed.
732 GetUserImageManager(user->email())->UserLoggedIn(false, true); 754 GetUserImageManager(user->email())->UserLoggedIn(false, true);
733 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); 755 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded();
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 } 1136 }
1115 1137
1116 if (profile->GetPrefs()->GetBoolean(prefs::kResolveTimezoneByGeolocation) && 1138 if (profile->GetPrefs()->GetBoolean(prefs::kResolveTimezoneByGeolocation) &&
1117 !system::HasSystemTimezonePolicy()) { 1139 !system::HasSystemTimezonePolicy()) {
1118 g_browser_process->platform_part()->GetTimezoneResolver()->Start(); 1140 g_browser_process->platform_part()->GetTimezoneResolver()->Start();
1119 } else { 1141 } else {
1120 g_browser_process->platform_part()->GetTimezoneResolver()->Stop(); 1142 g_browser_process->platform_part()->GetTimezoneResolver()->Stop();
1121 } 1143 }
1122 } 1144 }
1123 1145
1146 void ChromeUserManagerImpl::SetUserAffiliation(
1147 const std::string& user_id,
1148 const std::set<std::string>& user_affiliation_ids) {
1149 LOG(ERROR) << "SetUserAffiliation is not implemented yet. Called for user: "
1150 << user_id;
1151 if (user_manager::User* user = FindUserAndModify(user_id)) {
1152 LOG(ERROR) << "Affiliation to set: "
1153 << IsUserAffiliated(user_affiliation_ids, user->GetEmail());
Mattias Nissler (ping if slow) 2015/07/29 20:08:13 If you really just need to set the affiliation fie
peletskyi 2015/07/30 11:02:27 Many features are not updated when affiliation is
Mattias Nissler (ping if slow) 2015/07/30 12:10:57 OK, fair.
1154 }
1155 }
1156
1124 } // namespace chromeos 1157 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698