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

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

Issue 1534173003: ChromeOS user_manager: move all KnownUser code to separate file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/FindUsingSAML/IsUsingSAML/ Created 5 years 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "chrome/common/chrome_switches.h" 49 #include "chrome/common/chrome_switches.h"
50 #include "chrome/common/crash_keys.h" 50 #include "chrome/common/crash_keys.h"
51 #include "chrome/common/pref_names.h" 51 #include "chrome/common/pref_names.h"
52 #include "chrome/grit/theme_resources.h" 52 #include "chrome/grit/theme_resources.h"
53 #include "chromeos/chromeos_switches.h" 53 #include "chromeos/chromeos_switches.h"
54 #include "chromeos/login/user_names.h" 54 #include "chromeos/login/user_names.h"
55 #include "chromeos/settings/cros_settings_names.h" 55 #include "chromeos/settings/cros_settings_names.h"
56 #include "chromeos/timezone/timezone_resolver.h" 56 #include "chromeos/timezone/timezone_resolver.h"
57 #include "components/session_manager/core/session_manager.h" 57 #include "components/session_manager/core/session_manager.h"
58 #include "components/signin/core/account_id/account_id.h" 58 #include "components/signin/core/account_id/account_id.h"
59 #include "components/user_manager/known_user.h"
59 #include "components/user_manager/remove_user_delegate.h" 60 #include "components/user_manager/remove_user_delegate.h"
60 #include "components/user_manager/user_image/user_image.h" 61 #include "components/user_manager/user_image/user_image.h"
61 #include "components/user_manager/user_type.h" 62 #include "components/user_manager/user_type.h"
62 #include "content/public/browser/browser_thread.h" 63 #include "content/public/browser/browser_thread.h"
63 #include "content/public/browser/notification_service.h" 64 #include "content/public/browser/notification_service.h"
64 #include "policy/policy_constants.h" 65 #include "policy/policy_constants.h"
65 #include "ui/base/resource/resource_bundle.h" 66 #include "ui/base/resource/resource_bundle.h"
66 #include "ui/wm/core/wm_core_switches.h" 67 #include "ui/wm/core/wm_core_switches.h"
67 68
68 using content::BrowserThread; 69 using content::BrowserThread;
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 break; 433 break;
433 } 434 }
434 default: 435 default:
435 NOTREACHED(); 436 NOTREACHED();
436 } 437 }
437 } 438 }
438 439
439 void ChromeUserManagerImpl::OnExternalDataSet(const std::string& policy, 440 void ChromeUserManagerImpl::OnExternalDataSet(const std::string& policy,
440 const std::string& user_id) { 441 const std::string& user_id) {
441 const AccountId account_id = 442 const AccountId account_id =
442 user_manager::UserManager::Get()->GetKnownUserAccountId(user_id, 443 user_manager::known_user::GetAccountId(user_id, std::string());
443 std::string());
444 if (policy == policy::key::kUserAvatarImage) 444 if (policy == policy::key::kUserAvatarImage)
445 GetUserImageManager(account_id)->OnExternalDataSet(policy); 445 GetUserImageManager(account_id)->OnExternalDataSet(policy);
446 else if (policy == policy::key::kWallpaperImage) 446 else if (policy == policy::key::kWallpaperImage)
447 WallpaperManager::Get()->OnPolicySet(policy, account_id); 447 WallpaperManager::Get()->OnPolicySet(policy, account_id);
448 else 448 else
449 NOTREACHED(); 449 NOTREACHED();
450 } 450 }
451 451
452 void ChromeUserManagerImpl::OnExternalDataCleared(const std::string& policy, 452 void ChromeUserManagerImpl::OnExternalDataCleared(const std::string& policy,
453 const std::string& user_id) { 453 const std::string& user_id) {
454 const AccountId account_id = 454 const AccountId account_id =
455 user_manager::UserManager::Get()->GetKnownUserAccountId(user_id, 455 user_manager::known_user::GetAccountId(user_id, std::string());
456 std::string());
457 if (policy == policy::key::kUserAvatarImage) 456 if (policy == policy::key::kUserAvatarImage)
458 GetUserImageManager(account_id)->OnExternalDataCleared(policy); 457 GetUserImageManager(account_id)->OnExternalDataCleared(policy);
459 else if (policy == policy::key::kWallpaperImage) 458 else if (policy == policy::key::kWallpaperImage)
460 WallpaperManager::Get()->OnPolicyCleared(policy, account_id); 459 WallpaperManager::Get()->OnPolicyCleared(policy, account_id);
461 else 460 else
462 NOTREACHED(); 461 NOTREACHED();
463 } 462 }
464 463
465 void ChromeUserManagerImpl::OnExternalDataFetched( 464 void ChromeUserManagerImpl::OnExternalDataFetched(
466 const std::string& policy, 465 const std::string& policy,
467 const std::string& user_id, 466 const std::string& user_id,
468 scoped_ptr<std::string> data) { 467 scoped_ptr<std::string> data) {
469 const AccountId account_id = 468 const AccountId account_id =
470 user_manager::UserManager::Get()->GetKnownUserAccountId(user_id, 469 user_manager::known_user::GetAccountId(user_id, std::string());
471 std::string());
472 if (policy == policy::key::kUserAvatarImage) 470 if (policy == policy::key::kUserAvatarImage)
473 GetUserImageManager(account_id)->OnExternalDataFetched(policy, data.Pass()); 471 GetUserImageManager(account_id)->OnExternalDataFetched(policy, data.Pass());
474 else if (policy == policy::key::kWallpaperImage) 472 else if (policy == policy::key::kWallpaperImage)
475 WallpaperManager::Get()->OnPolicyFetched(policy, account_id, data.Pass()); 473 WallpaperManager::Get()->OnPolicyFetched(policy, account_id, data.Pass());
476 else 474 else
477 NOTREACHED(); 475 NOTREACHED();
478 } 476 }
479 477
480 void ChromeUserManagerImpl::OnPolicyUpdated(const std::string& user_id) { 478 void ChromeUserManagerImpl::OnPolicyUpdated(const std::string& user_id) {
481 const AccountId account_id = 479 const AccountId account_id =
482 user_manager::UserManager::Get()->GetKnownUserAccountId(user_id, 480 user_manager::known_user::GetAccountId(user_id, std::string());
483 std::string());
484 const user_manager::User* user = FindUser(account_id); 481 const user_manager::User* user = FindUser(account_id);
485 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) 482 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT)
486 return; 483 return;
487 UpdatePublicAccountDisplayName(user_id); 484 UpdatePublicAccountDisplayName(user_id);
488 } 485 }
489 486
490 void ChromeUserManagerImpl::OnDeviceLocalAccountsChanged() { 487 void ChromeUserManagerImpl::OnDeviceLocalAccountsChanged() {
491 // No action needed here, changes to the list of device-local accounts get 488 // No action needed here, changes to the list of device-local accounts get
492 // handled via the kAccountsPrefDeviceLocalAccounts device setting observer. 489 // handled via the kAccountsPrefDeviceLocalAccounts device setting observer.
493 } 490 }
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 g_browser_process->platform_part()->GetTimezoneResolver()->Start(); 1146 g_browser_process->platform_part()->GetTimezoneResolver()->Start();
1150 } else { 1147 } else {
1151 g_browser_process->platform_part()->GetTimezoneResolver()->Stop(); 1148 g_browser_process->platform_part()->GetTimezoneResolver()->Stop();
1152 } 1149 }
1153 } 1150 }
1154 1151
1155 void ChromeUserManagerImpl::SetUserAffiliation( 1152 void ChromeUserManagerImpl::SetUserAffiliation(
1156 const std::string& user_email, 1153 const std::string& user_email,
1157 const AffiliationIDSet& user_affiliation_ids) { 1154 const AffiliationIDSet& user_affiliation_ids) {
1158 const AccountId& account_id = 1155 const AccountId& account_id =
1159 user_manager::UserManager::GetKnownUserAccountId(user_email, 1156 user_manager::known_user::GetAccountId(user_email, std::string());
1160 std::string());
1161 user_manager::User* user = FindUserAndModify(account_id); 1157 user_manager::User* user = FindUserAndModify(account_id);
1162 1158
1163 if (user) { 1159 if (user) {
1164 policy::BrowserPolicyConnectorChromeOS const* const connector = 1160 policy::BrowserPolicyConnectorChromeOS const* const connector =
1165 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 1161 g_browser_process->platform_part()->browser_policy_connector_chromeos();
1166 const bool is_affiliated = chromeos::IsUserAffiliated( 1162 const bool is_affiliated = chromeos::IsUserAffiliated(
1167 user_affiliation_ids, connector->GetDeviceAffiliationIDs(), 1163 user_affiliation_ids, connector->GetDeviceAffiliationIDs(),
1168 account_id.GetUserEmail(), connector->GetEnterpriseDomain()); 1164 account_id.GetUserEmail(), connector->GetEnterpriseDomain());
1169 user->set_affiliation(is_affiliated); 1165 user->set_affiliation(is_affiliated);
1170 1166
(...skipping 20 matching lines...) Expand all
1191 new base::StringValue(account_id.GetUserEmail())); 1187 new base::StringValue(account_id.GetUserEmail()));
1192 } 1188 }
1193 1189
1194 void ChromeUserManagerImpl::RemoveReportingUser(const AccountId& account_id) { 1190 void ChromeUserManagerImpl::RemoveReportingUser(const AccountId& account_id) {
1195 ListPrefUpdate users_update(GetLocalState(), kReportingUsers); 1191 ListPrefUpdate users_update(GetLocalState(), kReportingUsers);
1196 users_update->Remove( 1192 users_update->Remove(
1197 base::StringValue(FullyCanonicalize(account_id.GetUserEmail())), NULL); 1193 base::StringValue(FullyCanonicalize(account_id.GetUserEmail())), NULL);
1198 } 1194 }
1199 1195
1200 } // namespace chromeos 1196 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698