| 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/users/chrome_user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 } | 493 } |
| 494 break; | 494 break; |
| 495 } | 495 } |
| 496 default: | 496 default: |
| 497 NOTREACHED(); | 497 NOTREACHED(); |
| 498 } | 498 } |
| 499 } | 499 } |
| 500 | 500 |
| 501 void ChromeUserManagerImpl::OnExternalDataSet(const std::string& policy, | 501 void ChromeUserManagerImpl::OnExternalDataSet(const std::string& policy, |
| 502 const std::string& user_id) { | 502 const std::string& user_id) { |
| 503 const AccountId account_id = | 503 const AccountId account_id = user_manager::known_user::GetAccountId( |
| 504 user_manager::known_user::GetAccountId(user_id, std::string()); | 504 user_id, std::string() /* id */, AccountType::UNKNOWN); |
| 505 if (policy == policy::key::kUserAvatarImage) | 505 if (policy == policy::key::kUserAvatarImage) |
| 506 GetUserImageManager(account_id)->OnExternalDataSet(policy); | 506 GetUserImageManager(account_id)->OnExternalDataSet(policy); |
| 507 else if (policy == policy::key::kWallpaperImage) | 507 else if (policy == policy::key::kWallpaperImage) |
| 508 WallpaperManager::Get()->OnPolicySet(policy, account_id); | 508 WallpaperManager::Get()->OnPolicySet(policy, account_id); |
| 509 else | 509 else |
| 510 NOTREACHED(); | 510 NOTREACHED(); |
| 511 } | 511 } |
| 512 | 512 |
| 513 void ChromeUserManagerImpl::OnExternalDataCleared(const std::string& policy, | 513 void ChromeUserManagerImpl::OnExternalDataCleared(const std::string& policy, |
| 514 const std::string& user_id) { | 514 const std::string& user_id) { |
| 515 const AccountId account_id = | 515 const AccountId account_id = user_manager::known_user::GetAccountId( |
| 516 user_manager::known_user::GetAccountId(user_id, std::string()); | 516 user_id, std::string() /* id */, AccountType::UNKNOWN); |
| 517 if (policy == policy::key::kUserAvatarImage) | 517 if (policy == policy::key::kUserAvatarImage) |
| 518 GetUserImageManager(account_id)->OnExternalDataCleared(policy); | 518 GetUserImageManager(account_id)->OnExternalDataCleared(policy); |
| 519 else if (policy == policy::key::kWallpaperImage) | 519 else if (policy == policy::key::kWallpaperImage) |
| 520 WallpaperManager::Get()->OnPolicyCleared(policy, account_id); | 520 WallpaperManager::Get()->OnPolicyCleared(policy, account_id); |
| 521 else | 521 else |
| 522 NOTREACHED(); | 522 NOTREACHED(); |
| 523 } | 523 } |
| 524 | 524 |
| 525 void ChromeUserManagerImpl::OnExternalDataFetched( | 525 void ChromeUserManagerImpl::OnExternalDataFetched( |
| 526 const std::string& policy, | 526 const std::string& policy, |
| 527 const std::string& user_id, | 527 const std::string& user_id, |
| 528 std::unique_ptr<std::string> data) { | 528 std::unique_ptr<std::string> data) { |
| 529 const AccountId account_id = | 529 const AccountId account_id = user_manager::known_user::GetAccountId( |
| 530 user_manager::known_user::GetAccountId(user_id, std::string()); | 530 user_id, std::string() /* id */, AccountType::UNKNOWN); |
| 531 if (policy == policy::key::kUserAvatarImage) | 531 if (policy == policy::key::kUserAvatarImage) |
| 532 GetUserImageManager(account_id) | 532 GetUserImageManager(account_id) |
| 533 ->OnExternalDataFetched(policy, std::move(data)); | 533 ->OnExternalDataFetched(policy, std::move(data)); |
| 534 else if (policy == policy::key::kWallpaperImage) | 534 else if (policy == policy::key::kWallpaperImage) |
| 535 WallpaperManager::Get()->OnPolicyFetched(policy, account_id, | 535 WallpaperManager::Get()->OnPolicyFetched(policy, account_id, |
| 536 std::move(data)); | 536 std::move(data)); |
| 537 else | 537 else |
| 538 NOTREACHED(); | 538 NOTREACHED(); |
| 539 } | 539 } |
| 540 | 540 |
| 541 void ChromeUserManagerImpl::OnPolicyUpdated(const std::string& user_id) { | 541 void ChromeUserManagerImpl::OnPolicyUpdated(const std::string& user_id) { |
| 542 const AccountId account_id = | 542 const AccountId account_id = user_manager::known_user::GetAccountId( |
| 543 user_manager::known_user::GetAccountId(user_id, std::string()); | 543 user_id, std::string() /* id */, AccountType::UNKNOWN); |
| 544 const user_manager::User* user = FindUser(account_id); | 544 const user_manager::User* user = FindUser(account_id); |
| 545 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) | 545 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) |
| 546 return; | 546 return; |
| 547 UpdatePublicAccountDisplayName(user_id); | 547 UpdatePublicAccountDisplayName(user_id); |
| 548 } | 548 } |
| 549 | 549 |
| 550 void ChromeUserManagerImpl::OnDeviceLocalAccountsChanged() { | 550 void ChromeUserManagerImpl::OnDeviceLocalAccountsChanged() { |
| 551 // No action needed here, changes to the list of device-local accounts get | 551 // No action needed here, changes to the list of device-local accounts get |
| 552 // handled via the kAccountsPrefDeviceLocalAccounts device setting observer. | 552 // handled via the kAccountsPrefDeviceLocalAccounts device setting observer. |
| 553 } | 553 } |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 return; | 1209 return; |
| 1210 } | 1210 } |
| 1211 g_browser_process->platform_part() | 1211 g_browser_process->platform_part() |
| 1212 ->GetTimezoneResolverManager() | 1212 ->GetTimezoneResolverManager() |
| 1213 ->UpdateTimezoneResolver(); | 1213 ->UpdateTimezoneResolver(); |
| 1214 } | 1214 } |
| 1215 | 1215 |
| 1216 void ChromeUserManagerImpl::SetUserAffiliation( | 1216 void ChromeUserManagerImpl::SetUserAffiliation( |
| 1217 const std::string& user_email, | 1217 const std::string& user_email, |
| 1218 const AffiliationIDSet& user_affiliation_ids) { | 1218 const AffiliationIDSet& user_affiliation_ids) { |
| 1219 const AccountId& account_id = | 1219 const AccountId& account_id = user_manager::known_user::GetAccountId( |
| 1220 user_manager::known_user::GetAccountId(user_email, std::string()); | 1220 user_email, std::string() /* id */, AccountType::UNKNOWN); |
| 1221 user_manager::User* user = FindUserAndModify(account_id); | 1221 user_manager::User* user = FindUserAndModify(account_id); |
| 1222 | 1222 |
| 1223 if (user) { | 1223 if (user) { |
| 1224 policy::BrowserPolicyConnectorChromeOS const* const connector = | 1224 policy::BrowserPolicyConnectorChromeOS const* const connector = |
| 1225 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 1225 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 1226 const bool is_affiliated = chromeos::IsUserAffiliated( | 1226 const bool is_affiliated = chromeos::IsUserAffiliated( |
| 1227 user_affiliation_ids, connector->GetDeviceAffiliationIDs(), | 1227 user_affiliation_ids, connector->GetDeviceAffiliationIDs(), |
| 1228 account_id.GetUserEmail()); | 1228 account_id.GetUserEmail()); |
| 1229 user->SetAffiliation(is_affiliated); | 1229 user->SetAffiliation(is_affiliated); |
| 1230 | 1230 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 break; | 1357 break; |
| 1358 default: | 1358 default: |
| 1359 NOTREACHED(); | 1359 NOTREACHED(); |
| 1360 break; | 1360 break; |
| 1361 } | 1361 } |
| 1362 | 1362 |
| 1363 return user; | 1363 return user; |
| 1364 } | 1364 } |
| 1365 | 1365 |
| 1366 } // namespace chromeos | 1366 } // namespace chromeos |
| OLD | NEW |