Chromium Code Reviews| 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 <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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 BootstrapManager* ChromeUserManagerImpl::GetBootstrapManager() { | 182 BootstrapManager* ChromeUserManagerImpl::GetBootstrapManager() { |
| 183 return bootstrap_manager_.get(); | 183 return bootstrap_manager_.get(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 MultiProfileUserController* | 186 MultiProfileUserController* |
| 187 ChromeUserManagerImpl::GetMultiProfileUserController() { | 187 ChromeUserManagerImpl::GetMultiProfileUserController() { |
| 188 return multi_profile_user_controller_.get(); | 188 return multi_profile_user_controller_.get(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 UserImageManager* ChromeUserManagerImpl::GetUserImageManager( | 191 UserImageManager* ChromeUserManagerImpl::GetUserImageManager( |
| 192 const std::string& user_id) { | 192 const user_manager::UserID& user_id) { |
| 193 UserImageManagerMap::iterator ui = user_image_managers_.find(user_id); | 193 UserImageManagerMap::iterator ui = user_image_managers_.find(user_id); |
| 194 if (ui != user_image_managers_.end()) | 194 if (ui != user_image_managers_.end()) |
| 195 return ui->second.get(); | 195 return ui->second.get(); |
| 196 linked_ptr<UserImageManagerImpl> mgr(new UserImageManagerImpl(user_id, this)); | 196 linked_ptr<UserImageManagerImpl> mgr(new UserImageManagerImpl(user_id, this)); |
| 197 user_image_managers_[user_id] = mgr; | 197 user_image_managers_[user_id] = mgr; |
| 198 return mgr.get(); | 198 return mgr.get(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 SupervisedUserManager* ChromeUserManagerImpl::GetSupervisedUserManager() { | 201 SupervisedUserManager* ChromeUserManagerImpl::GetSupervisedUserManager() { |
| 202 return supervised_user_manager_.get(); | 202 return supervised_user_manager_.get(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 user_manager::UserList ChromeUserManagerImpl::GetUsersAllowedForMultiProfile() | 205 user_manager::UserList ChromeUserManagerImpl::GetUsersAllowedForMultiProfile() |
| 206 const { | 206 const { |
| 207 // Supervised users are not allowed to use multi-profiles. | 207 // Supervised users are not allowed to use multi-profiles. |
| 208 if (GetLoggedInUsers().size() == 1 && | 208 if (GetLoggedInUsers().size() == 1 && |
| 209 GetPrimaryUser()->GetType() != user_manager::USER_TYPE_REGULAR) { | 209 GetPrimaryUser()->GetType() != user_manager::USER_TYPE_REGULAR) { |
| 210 return user_manager::UserList(); | 210 return user_manager::UserList(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 user_manager::UserList result; | 213 user_manager::UserList result; |
| 214 const user_manager::UserList& users = GetUsers(); | 214 const user_manager::UserList& users = GetUsers(); |
| 215 for (user_manager::UserList::const_iterator it = users.begin(); | 215 for (user_manager::UserList::const_iterator it = users.begin(); |
| 216 it != users.end(); | 216 it != users.end(); |
| 217 ++it) { | 217 ++it) { |
| 218 if ((*it)->GetType() == user_manager::USER_TYPE_REGULAR && | 218 if ((*it)->GetType() == user_manager::USER_TYPE_REGULAR && |
| 219 !(*it)->is_logged_in()) { | 219 !(*it)->is_logged_in()) { |
| 220 MultiProfileUserController::UserAllowedInSessionReason check; | 220 MultiProfileUserController::UserAllowedInSessionReason check; |
| 221 multi_profile_user_controller_->IsUserAllowedInSession((*it)->email(), | 221 multi_profile_user_controller_->IsUserAllowedInSession((*it)->GetUserID(), |
| 222 &check); | 222 &check); |
| 223 if (check == | 223 if (check == |
| 224 MultiProfileUserController::NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS) { | 224 MultiProfileUserController::NOT_ALLOWED_PRIMARY_USER_POLICY_FORBIDS) { |
| 225 return user_manager::UserList(); | 225 return user_manager::UserList(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 // Users with a policy that prevents them being added to a session will be | 228 // Users with a policy that prevents them being added to a session will be |
| 229 // shown in login UI but will be grayed out. | 229 // shown in login UI but will be grayed out. |
| 230 // Same applies to owner account (see http://crbug.com/385034). | 230 // Same applies to owner account (see http://crbug.com/385034). |
| 231 result.push_back(*it); | 231 result.push_back(*it); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 292 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 293 ChromeUserManager::SessionStarted(); | 293 ChromeUserManager::SessionStarted(); |
| 294 | 294 |
| 295 content::NotificationService::current()->Notify( | 295 content::NotificationService::current()->Notify( |
| 296 chrome::NOTIFICATION_SESSION_STARTED, | 296 chrome::NOTIFICATION_SESSION_STARTED, |
| 297 content::Source<UserManager>(this), | 297 content::Source<UserManager>(this), |
| 298 content::Details<const user_manager::User>(GetActiveUser())); | 298 content::Details<const user_manager::User>(GetActiveUser())); |
| 299 } | 299 } |
| 300 | 300 |
| 301 void ChromeUserManagerImpl::RemoveUserInternal( | 301 void ChromeUserManagerImpl::RemoveUserInternal( |
| 302 const std::string& user_email, | 302 const user_manager::UserID& user_id, |
| 303 user_manager::RemoveUserDelegate* delegate) { | 303 user_manager::RemoveUserDelegate* delegate) { |
| 304 CrosSettings* cros_settings = CrosSettings::Get(); | 304 CrosSettings* cros_settings = CrosSettings::Get(); |
| 305 | 305 |
| 306 const base::Closure& callback = | 306 const base::Closure& callback = |
| 307 base::Bind(&ChromeUserManagerImpl::RemoveUserInternal, | 307 base::Bind(&ChromeUserManagerImpl::RemoveUserInternal, |
| 308 weak_factory_.GetWeakPtr(), | 308 weak_factory_.GetWeakPtr(), |
| 309 user_email, | 309 user_id, |
| 310 delegate); | 310 delegate); |
| 311 | 311 |
| 312 // Ensure the value of owner email has been fetched. | 312 // Ensure the value of owner id has been fetched. |
| 313 if (CrosSettingsProvider::TRUSTED != | 313 if (CrosSettingsProvider::TRUSTED != |
| 314 cros_settings->PrepareTrustedValues(callback)) { | 314 cros_settings->PrepareTrustedValues(callback)) { |
| 315 // Value of owner email is not fetched yet. RemoveUserInternal will be | 315 // Value of owner id is not fetched yet. RemoveUserInternal will be |
| 316 // called again after fetch completion. | 316 // called again after fetch completion. |
| 317 return; | 317 return; |
| 318 } | 318 } |
| 319 std::string owner; | 319 std::string owner; |
| 320 cros_settings->GetString(kDeviceOwner, &owner); | 320 cros_settings->GetString(kDeviceOwner, &owner); |
| 321 if (user_email == owner) { | 321 if (user_id == user_manager::UserID::FromUserEmail(owner)) { |
| 322 // Owner is not allowed to be removed from the device. | 322 // Owner is not allowed to be removed from the device. |
| 323 return; | 323 return; |
| 324 } | 324 } |
| 325 RemoveNonOwnerUserInternal(user_email, delegate); | 325 RemoveNonOwnerUserInternal(user_id, delegate); |
| 326 } | 326 } |
| 327 | 327 |
| 328 void ChromeUserManagerImpl::SaveUserOAuthStatus( | 328 void ChromeUserManagerImpl::SaveUserOAuthStatus( |
| 329 const std::string& user_id, | 329 const user_manager::UserID& user_id, |
| 330 user_manager::User::OAuthTokenStatus oauth_token_status) { | 330 user_manager::User::OAuthTokenStatus oauth_token_status) { |
| 331 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 331 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 332 ChromeUserManager::SaveUserOAuthStatus(user_id, oauth_token_status); | 332 ChromeUserManager::SaveUserOAuthStatus(user_id, oauth_token_status); |
| 333 | 333 |
| 334 GetUserFlow(user_id)->HandleOAuthTokenStatusChange(oauth_token_status); | 334 GetUserFlow(user_id)->HandleOAuthTokenStatusChange(oauth_token_status); |
| 335 } | 335 } |
| 336 | 336 |
| 337 void ChromeUserManagerImpl::SaveUserDisplayName( | 337 void ChromeUserManagerImpl::SaveUserDisplayName( |
| 338 const std::string& user_id, | 338 const user_manager::UserID& user_id, |
| 339 const base::string16& display_name) { | 339 const base::string16& display_name) { |
| 340 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 340 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 341 ChromeUserManager::SaveUserDisplayName(user_id, display_name); | 341 ChromeUserManager::SaveUserDisplayName(user_id, display_name); |
| 342 | 342 |
| 343 // Do not update local state if data stored or cached outside the user's | 343 // Do not update local state if data stored or cached outside the user's |
| 344 // cryptohome is to be treated as ephemeral. | 344 // cryptohome is to be treated as ephemeral. |
| 345 if (!IsUserNonCryptohomeDataEphemeral(user_id)) | 345 if (!IsUserNonCryptohomeDataEphemeral(user_id)) |
| 346 supervised_user_manager_->UpdateManagerName(user_id, display_name); | 346 supervised_user_manager_->UpdateManagerName(user_id, display_name); |
| 347 } | 347 } |
| 348 | 348 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 388 break; | 388 break; |
| 389 } | 389 } |
| 390 case chrome::NOTIFICATION_PROFILE_CREATED: { | 390 case chrome::NOTIFICATION_PROFILE_CREATED: { |
| 391 Profile* profile = content::Source<Profile>(source).ptr(); | 391 Profile* profile = content::Source<Profile>(source).ptr(); |
| 392 user_manager::User* user = | 392 user_manager::User* user = |
| 393 ProfileHelper::Get()->GetUserByProfile(profile); | 393 ProfileHelper::Get()->GetUserByProfile(profile); |
| 394 if (user != NULL) { | 394 if (user != NULL) { |
| 395 user->set_profile_is_created(); | 395 user->set_profile_is_created(); |
| 396 | 396 |
| 397 if (user->HasGaiaAccount()) { | 397 if (user->HasGaiaAccount()) { |
| 398 UserImageManager* image_manager = GetUserImageManager(user->email()); | 398 UserImageManager* image_manager = GetUserImageManager(user->GetUserID( )); |
| 399 image_manager->UserProfileCreated(); | 399 image_manager->UserProfileCreated(); |
| 400 } | 400 } |
| 401 } | 401 } |
| 402 | 402 |
| 403 // If there is pending user switch, do it now. | 403 // If there is pending user switch, do it now. |
| 404 if (!GetPendingUserSwitchID().empty()) { | 404 if (!GetPendingUserSwitchID().empty()) { |
| 405 // Call SwitchActiveUser async because otherwise it may cause | 405 // Call SwitchActiveUser async because otherwise it may cause |
| 406 // ProfileManager::GetProfile before the profile gets registered | 406 // ProfileManager::GetProfile before the profile gets registered |
| 407 // in ProfileManager. It happens in case of sync profile load when | 407 // in ProfileManager. It happens in case of sync profile load when |
| 408 // NOTIFICATION_PROFILE_CREATED is called synchronously. | 408 // NOTIFICATION_PROFILE_CREATED is called synchronously. |
| 409 base::MessageLoop::current()->PostTask( | 409 base::MessageLoop::current()->PostTask( |
| 410 FROM_HERE, | 410 FROM_HERE, |
| 411 base::Bind(&ChromeUserManagerImpl::SwitchActiveUser, | 411 base::Bind(&ChromeUserManagerImpl::SwitchActiveUser, |
| 412 weak_factory_.GetWeakPtr(), | 412 weak_factory_.GetWeakPtr(), |
| 413 GetPendingUserSwitchID())); | 413 GetPendingUserSwitchID())); |
| 414 SetPendingUserSwitchID(std::string()); | 414 SetPendingUserSwitchID(user_manager::UserID(std::string(), std::string() )); |
|
Denis Kuznetsov (DE-MUC)
2015/06/10 16:50:46
EmptyGaiaID() ?
| |
| 415 } | 415 } |
| 416 break; | 416 break; |
| 417 } | 417 } |
| 418 default: | 418 default: |
| 419 NOTREACHED(); | 419 NOTREACHED(); |
| 420 } | 420 } |
| 421 } | 421 } |
| 422 | 422 |
| 423 void ChromeUserManagerImpl::OnExternalDataSet(const std::string& policy, | 423 void ChromeUserManagerImpl::OnExternalDataSet(const std::string& policy, |
| 424 const std::string& user_id) { | 424 const user_manager::UserID& user_i d) { |
| 425 if (policy == policy::key::kUserAvatarImage) | 425 if (policy == policy::key::kUserAvatarImage) |
| 426 GetUserImageManager(user_id)->OnExternalDataSet(policy); | 426 GetUserImageManager(user_id)->OnExternalDataSet(policy); |
| 427 else if (policy == policy::key::kWallpaperImage) | 427 else if (policy == policy::key::kWallpaperImage) |
| 428 WallpaperManager::Get()->OnPolicySet(policy, user_id); | 428 WallpaperManager::Get()->OnPolicySet(policy, user_id); |
| 429 else | 429 else |
| 430 NOTREACHED(); | 430 NOTREACHED(); |
| 431 } | 431 } |
| 432 | 432 |
| 433 void ChromeUserManagerImpl::OnExternalDataCleared(const std::string& policy, | 433 void ChromeUserManagerImpl::OnExternalDataCleared(const std::string& policy, |
| 434 const std::string& user_id) { | 434 const user_manager::UserID& us er_id) { |
| 435 if (policy == policy::key::kUserAvatarImage) | 435 if (policy == policy::key::kUserAvatarImage) |
| 436 GetUserImageManager(user_id)->OnExternalDataCleared(policy); | 436 GetUserImageManager(user_id)->OnExternalDataCleared(policy); |
| 437 else if (policy == policy::key::kWallpaperImage) | 437 else if (policy == policy::key::kWallpaperImage) |
| 438 WallpaperManager::Get()->OnPolicyCleared(policy, user_id); | 438 WallpaperManager::Get()->OnPolicyCleared(policy, user_id); |
| 439 else | 439 else |
| 440 NOTREACHED(); | 440 NOTREACHED(); |
| 441 } | 441 } |
| 442 | 442 |
| 443 void ChromeUserManagerImpl::OnExternalDataFetched( | 443 void ChromeUserManagerImpl::OnExternalDataFetched( |
| 444 const std::string& policy, | 444 const std::string& policy, |
| 445 const std::string& user_id, | 445 const user_manager::UserID& user_id, |
| 446 scoped_ptr<std::string> data) { | 446 scoped_ptr<std::string> data) { |
| 447 if (policy == policy::key::kUserAvatarImage) | 447 if (policy == policy::key::kUserAvatarImage) |
| 448 GetUserImageManager(user_id)->OnExternalDataFetched(policy, data.Pass()); | 448 GetUserImageManager(user_id)->OnExternalDataFetched(policy, data.Pass()); |
| 449 else if (policy == policy::key::kWallpaperImage) | 449 else if (policy == policy::key::kWallpaperImage) |
| 450 WallpaperManager::Get()->OnPolicyFetched(policy, user_id, data.Pass()); | 450 WallpaperManager::Get()->OnPolicyFetched(policy, user_id, data.Pass()); |
| 451 else | 451 else |
| 452 NOTREACHED(); | 452 NOTREACHED(); |
| 453 } | 453 } |
| 454 | 454 |
| 455 void ChromeUserManagerImpl::OnPolicyUpdated(const std::string& user_id) { | 455 void ChromeUserManagerImpl::OnPolicyUpdated(const user_manager::UserID& user_id) { |
| 456 const user_manager::User* user = FindUser(user_id); | 456 const user_manager::User* user = FindUser(user_id); |
| 457 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) | 457 if (!user || user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) |
| 458 return; | 458 return; |
| 459 UpdatePublicAccountDisplayName(user_id); | 459 UpdatePublicAccountDisplayName(user_id); |
| 460 } | 460 } |
| 461 | 461 |
| 462 void ChromeUserManagerImpl::OnDeviceLocalAccountsChanged() { | 462 void ChromeUserManagerImpl::OnDeviceLocalAccountsChanged() { |
| 463 // No action needed here, changes to the list of device-local accounts get | 463 // No action needed here, changes to the list of device-local accounts get |
| 464 // handled via the kAccountsPrefDeviceLocalAccounts device setting observer. | 464 // handled via the kAccountsPrefDeviceLocalAccounts device setting observer. |
| 465 } | 465 } |
| 466 | 466 |
| 467 bool ChromeUserManagerImpl::CanCurrentUserLock() const { | 467 bool ChromeUserManagerImpl::CanCurrentUserLock() const { |
| 468 return ChromeUserManager::CanCurrentUserLock() && | 468 return ChromeUserManager::CanCurrentUserLock() && |
| 469 GetCurrentUserFlow()->CanLockScreen(); | 469 GetCurrentUserFlow()->CanLockScreen(); |
| 470 } | 470 } |
| 471 | 471 |
| 472 bool ChromeUserManagerImpl::IsUserNonCryptohomeDataEphemeral( | 472 bool ChromeUserManagerImpl::IsUserNonCryptohomeDataEphemeral( |
| 473 const std::string& user_id) const { | 473 const user_manager::UserID& user_id) const { |
| 474 // Data belonging to the obsolete public accounts whose data has not been | 474 // Data belonging to the obsolete public accounts whose data has not been |
| 475 // removed yet is not ephemeral. | 475 // removed yet is not ephemeral. |
| 476 bool is_obsolete_public_account = IsPublicAccountMarkedForRemoval(user_id); | 476 bool is_obsolete_public_account = IsPublicAccountMarkedForRemoval(user_id); |
| 477 | 477 |
| 478 return !is_obsolete_public_account && | 478 return !is_obsolete_public_account && |
| 479 ChromeUserManager::IsUserNonCryptohomeDataEphemeral(user_id); | 479 ChromeUserManager::IsUserNonCryptohomeDataEphemeral(user_id); |
| 480 } | 480 } |
| 481 | 481 |
| 482 bool ChromeUserManagerImpl::AreEphemeralUsersEnabled() const { | 482 bool ChromeUserManagerImpl::AreEphemeralUsersEnabled() const { |
| 483 policy::BrowserPolicyConnectorChromeOS* connector = | 483 policy::BrowserPolicyConnectorChromeOS* connector = |
| 484 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 484 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 485 return GetEphemeralUsersEnabled() && | 485 return GetEphemeralUsersEnabled() && |
| 486 (connector->IsEnterpriseManaged() || !GetOwnerEmail().empty()); | 486 (connector->IsEnterpriseManaged() || !GetOwnerID().empty()); |
| 487 } | 487 } |
| 488 | 488 |
| 489 const std::string& ChromeUserManagerImpl::GetApplicationLocale() const { | 489 const std::string& ChromeUserManagerImpl::GetApplicationLocale() const { |
| 490 return g_browser_process->GetApplicationLocale(); | 490 return g_browser_process->GetApplicationLocale(); |
| 491 } | 491 } |
| 492 | 492 |
| 493 PrefService* ChromeUserManagerImpl::GetLocalState() const { | 493 PrefService* ChromeUserManagerImpl::GetLocalState() const { |
| 494 return g_browser_process ? g_browser_process->local_state() : NULL; | 494 return g_browser_process ? g_browser_process->local_state() : NULL; |
| 495 } | 495 } |
| 496 | 496 |
| 497 void ChromeUserManagerImpl::HandleUserOAuthTokenStatusChange( | 497 void ChromeUserManagerImpl::HandleUserOAuthTokenStatusChange( |
| 498 const std::string& user_id, | 498 const user_manager::UserID& user_id, |
| 499 user_manager::User::OAuthTokenStatus status) const { | 499 user_manager::User::OAuthTokenStatus status) const { |
| 500 GetUserFlow(user_id)->HandleOAuthTokenStatusChange(status); | 500 GetUserFlow(user_id)->HandleOAuthTokenStatusChange(status); |
| 501 } | 501 } |
| 502 | 502 |
| 503 bool ChromeUserManagerImpl::IsEnterpriseManaged() const { | 503 bool ChromeUserManagerImpl::IsEnterpriseManaged() const { |
| 504 policy::BrowserPolicyConnectorChromeOS* connector = | 504 policy::BrowserPolicyConnectorChromeOS* connector = |
| 505 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 505 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
| 506 return connector->IsEnterpriseManaged(); | 506 return connector->IsEnterpriseManaged(); |
| 507 } | 507 } |
| 508 | 508 |
| 509 void ChromeUserManagerImpl::LoadPublicAccounts( | 509 void ChromeUserManagerImpl::LoadPublicAccounts( |
| 510 std::set<std::string>* public_sessions_set) { | 510 std::set<std::string>* public_sessions_set) { |
| 511 const base::ListValue* prefs_public_sessions = | 511 const base::ListValue* prefs_public_sessions = |
| 512 GetLocalState()->GetList(kPublicAccounts); | 512 GetLocalState()->GetList(kPublicAccounts); |
| 513 std::vector<std::string> public_sessions; | 513 std::vector<std::string> public_sessions; |
| 514 ParseUserList(*prefs_public_sessions, | 514 ParseUserList(*prefs_public_sessions, |
| 515 std::set<std::string>(), | 515 std::set<std::string>(), |
| 516 &public_sessions, | 516 &public_sessions, |
| 517 public_sessions_set); | 517 public_sessions_set); |
| 518 for (std::vector<std::string>::const_iterator it = public_sessions.begin(); | 518 for (std::vector<std::string>::const_iterator it = public_sessions.begin(); |
| 519 it != public_sessions.end(); | 519 it != public_sessions.end(); |
| 520 ++it) { | 520 ++it) { |
| 521 users_.push_back(user_manager::User::CreatePublicAccountUser(*it)); | 521 const user_manager::UserID user_id(user_manager::UserID::FromUserEmail(*it)) ; |
|
Denis Kuznetsov (DE-MUC)
2015/06/10 16:50:47
auto user_id = ...?
| |
| 522 UpdatePublicAccountDisplayName(*it); | 522 users_.push_back(user_manager::User::CreatePublicAccountUser(user_id)); |
| 523 UpdatePublicAccountDisplayName(user_id); | |
| 523 } | 524 } |
| 524 } | 525 } |
| 525 | 526 |
| 526 void ChromeUserManagerImpl::PerformPreUserListLoadingActions() { | 527 void ChromeUserManagerImpl::PerformPreUserListLoadingActions() { |
| 527 // Clean up user list first. All code down the path should be synchronous, | 528 // Clean up user list first. All code down the path should be synchronous, |
| 528 // so that local state after transaction rollback is in consistent state. | 529 // so that local state after transaction rollback is in consistent state. |
| 529 // This process also should not trigger EnsureUsersLoaded again. | 530 // This process also should not trigger EnsureUsersLoaded again. |
| 530 if (supervised_user_manager_->HasFailedUserCreationTransaction()) | 531 if (supervised_user_manager_->HasFailedUserCreationTransaction()) |
| 531 supervised_user_manager_->RollbackUserCreationTransaction(); | 532 supervised_user_manager_->RollbackUserCreationTransaction(); |
| 532 | 533 |
| 533 // Abandon all unfinished bootstraps. | 534 // Abandon all unfinished bootstraps. |
| 534 bootstrap_manager_->RemoveAllPendingBootstrap(); | 535 bootstrap_manager_->RemoveAllPendingBootstrap(); |
| 535 } | 536 } |
| 536 | 537 |
| 537 void ChromeUserManagerImpl::PerformPostUserListLoadingActions() { | 538 void ChromeUserManagerImpl::PerformPostUserListLoadingActions() { |
| 538 for (user_manager::UserList::iterator ui = users_.begin(), ue = users_.end(); | 539 for (user_manager::UserList::iterator ui = users_.begin(), ue = users_.end(); |
| 539 ui != ue; | 540 ui != ue; |
| 540 ++ui) { | 541 ++ui) { |
| 541 GetUserImageManager((*ui)->email())->LoadUserImage(); | 542 GetUserImageManager((*ui)->GetUserID())->LoadUserImage(); |
| 542 } | 543 } |
| 543 } | 544 } |
| 544 | 545 |
| 545 void ChromeUserManagerImpl::PerformPostUserLoggedInActions( | 546 void ChromeUserManagerImpl::PerformPostUserLoggedInActions( |
| 546 bool browser_restart) { | 547 bool browser_restart) { |
| 547 // Initialize the session length limiter and start it only if | 548 // Initialize the session length limiter and start it only if |
| 548 // session limit is defined by the policy. | 549 // session limit is defined by the policy. |
| 549 session_length_limiter_.reset( | 550 session_length_limiter_.reset( |
| 550 new SessionLengthLimiter(NULL, browser_restart)); | 551 new SessionLengthLimiter(NULL, browser_restart)); |
| 551 } | 552 } |
| 552 | 553 |
| 553 bool ChromeUserManagerImpl::IsDemoApp(const std::string& user_id) const { | 554 bool ChromeUserManagerImpl::IsDemoApp(const user_manager::UserID& user_id) const { |
| 554 return DemoAppLauncher::IsDemoAppSession(user_id); | 555 return DemoAppLauncher::IsDemoAppSession(user_id); |
| 555 } | 556 } |
| 556 | 557 |
| 557 bool ChromeUserManagerImpl::IsKioskApp(const std::string& user_id) const { | 558 bool ChromeUserManagerImpl::IsKioskApp(const user_manager::UserID& user_id) cons t { |
| 558 policy::DeviceLocalAccount::Type device_local_account_type; | 559 policy::DeviceLocalAccount::Type device_local_account_type; |
| 559 return policy::IsDeviceLocalAccountUser(user_id, | 560 return policy::IsDeviceLocalAccountUser(user_id, |
| 560 &device_local_account_type) && | 561 &device_local_account_type) && |
| 561 device_local_account_type == | 562 device_local_account_type == |
| 562 policy::DeviceLocalAccount::TYPE_KIOSK_APP; | 563 policy::DeviceLocalAccount::TYPE_KIOSK_APP; |
| 563 } | 564 } |
| 564 | 565 |
| 565 bool ChromeUserManagerImpl::IsPublicAccountMarkedForRemoval( | 566 bool ChromeUserManagerImpl::IsPublicAccountMarkedForRemoval( |
| 566 const std::string& user_id) const { | 567 const user_manager::UserID& user_id) const { |
| 567 return user_id == | 568 return user_id.GetUserEmail() == |
| 568 GetLocalState()->GetString(kPublicAccountPendingDataRemoval); | 569 GetLocalState()->GetString(kPublicAccountPendingDataRemoval); |
| 569 } | 570 } |
| 570 | 571 |
| 571 void ChromeUserManagerImpl::RetrieveTrustedDevicePolicies() { | 572 void ChromeUserManagerImpl::RetrieveTrustedDevicePolicies() { |
| 572 // Local state may not be initialized in unit_tests. | 573 // Local state may not be initialized in unit_tests. |
| 573 if (!GetLocalState()) | 574 if (!GetLocalState()) |
| 574 return; | 575 return; |
| 575 | 576 |
| 576 SetEphemeralUsersEnabled(false); | 577 SetEphemeralUsersEnabled(false); |
| 577 SetOwnerEmail(std::string()); | 578 SetOwnerID(user_manager::UserID(std::string(), std::string())); |
|
Denis Kuznetsov (DE-MUC)
2015/06/10 16:50:47
EmptyGaiaID() ?
| |
| 578 | 579 |
| 579 // Schedule a callback if device policy has not yet been verified. | 580 // Schedule a callback if device policy has not yet been verified. |
| 580 if (CrosSettingsProvider::TRUSTED != | 581 if (CrosSettingsProvider::TRUSTED != |
| 581 cros_settings_->PrepareTrustedValues( | 582 cros_settings_->PrepareTrustedValues( |
| 582 base::Bind(&ChromeUserManagerImpl::RetrieveTrustedDevicePolicies, | 583 base::Bind(&ChromeUserManagerImpl::RetrieveTrustedDevicePolicies, |
| 583 weak_factory_.GetWeakPtr()))) { | 584 weak_factory_.GetWeakPtr()))) { |
| 584 return; | 585 return; |
| 585 } | 586 } |
| 586 | 587 |
| 587 bool ephemeral_users_enabled = false; | 588 bool ephemeral_users_enabled = false; |
| 588 cros_settings_->GetBoolean(kAccountsPrefEphemeralUsersEnabled, | 589 cros_settings_->GetBoolean(kAccountsPrefEphemeralUsersEnabled, |
| 589 &ephemeral_users_enabled); | 590 &ephemeral_users_enabled); |
| 590 SetEphemeralUsersEnabled(ephemeral_users_enabled); | 591 SetEphemeralUsersEnabled(ephemeral_users_enabled); |
| 591 | 592 |
| 592 std::string owner_email; | 593 std::string owner_email; |
| 593 cros_settings_->GetString(kDeviceOwner, &owner_email); | 594 cros_settings_->GetString(kDeviceOwner, &owner_email); |
| 594 SetOwnerEmail(owner_email); | 595 SetOwnerID(user_manager::UserID::FromUserEmail(owner_email)); |
| 595 | 596 |
| 596 EnsureUsersLoaded(); | 597 EnsureUsersLoaded(); |
| 597 | 598 |
| 598 bool changed = UpdateAndCleanUpPublicAccounts( | 599 bool changed = UpdateAndCleanUpPublicAccounts( |
| 599 policy::GetDeviceLocalAccounts(cros_settings_)); | 600 policy::GetDeviceLocalAccounts(cros_settings_)); |
| 600 | 601 |
| 601 // If ephemeral users are enabled and we are on the login screen, take this | 602 // If ephemeral users are enabled and we are on the login screen, take this |
| 602 // opportunity to clean up by removing all regular users except the owner. | 603 // opportunity to clean up by removing all regular users except the owner. |
| 603 if (GetEphemeralUsersEnabled() && !IsUserLoggedIn()) { | 604 if (GetEphemeralUsersEnabled() && !IsUserLoggedIn()) { |
| 604 ListPrefUpdate prefs_users_update(GetLocalState(), kRegularUsers); | 605 ListPrefUpdate prefs_users_update(GetLocalState(), kRegularUsers); |
| 605 prefs_users_update->Clear(); | 606 prefs_users_update->Clear(); |
| 606 for (user_manager::UserList::iterator it = users_.begin(); | 607 for (user_manager::UserList::iterator it = users_.begin(); |
| 607 it != users_.end();) { | 608 it != users_.end();) { |
| 608 const std::string user_email = (*it)->email(); | 609 const user_manager::UserID user_id = (*it)->GetUserID(); |
| 609 if ((*it)->HasGaiaAccount() && user_email != GetOwnerEmail()) { | 610 if ((*it)->HasGaiaAccount() && user_id != GetOwnerID()) { |
| 610 RemoveNonCryptohomeData(user_email); | 611 RemoveNonCryptohomeData(user_id); |
| 611 DeleteUser(*it); | 612 DeleteUser(*it); |
| 612 it = users_.erase(it); | 613 it = users_.erase(it); |
| 613 changed = true; | 614 changed = true; |
| 614 } else { | 615 } else { |
| 615 if ((*it)->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) | 616 if ((*it)->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT) |
| 616 prefs_users_update->Append(new base::StringValue(user_email)); | 617 prefs_users_update->Append(new base::StringValue(user_id.GetUserEmail( ))); |
| 617 ++it; | 618 ++it; |
| 618 } | 619 } |
| 619 } | 620 } |
| 620 } | 621 } |
| 621 | 622 |
| 622 if (changed) | 623 if (changed) |
| 623 NotifyUserListChanged(); | 624 NotifyUserListChanged(); |
| 624 } | 625 } |
| 625 | 626 |
| 626 void ChromeUserManagerImpl::GuestUserLoggedIn() { | 627 void ChromeUserManagerImpl::GuestUserLoggedIn() { |
| 627 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 628 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 628 ChromeUserManager::GuestUserLoggedIn(); | 629 ChromeUserManager::GuestUserLoggedIn(); |
| 629 | 630 |
| 630 // TODO(nkostylev): Add support for passing guest session cryptohome | 631 // TODO(nkostylev): Add support for passing guest session cryptohome |
| 631 // mount point. Legacy (--login-profile) value will be used for now. | 632 // mount point. Legacy (--login-profile) value will be used for now. |
| 632 // http://crosbug.com/230859 | 633 // http://crosbug.com/230859 |
| 633 active_user_->SetStubImage( | 634 active_user_->SetStubImage( |
| 634 user_manager::UserImage( | 635 user_manager::UserImage( |
| 635 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 636 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 636 IDR_PROFILE_PICTURE_LOADING)), | 637 IDR_PROFILE_PICTURE_LOADING)), |
| 637 user_manager::User::USER_IMAGE_INVALID, | 638 user_manager::User::USER_IMAGE_INVALID, |
| 638 false); | 639 false); |
| 639 | 640 |
| 640 // Initializes wallpaper after active_user_ is set. | 641 // Initializes wallpaper after active_user_ is set. |
| 641 WallpaperManager::Get()->SetUserWallpaperNow(chromeos::login::kGuestUserName); | 642 WallpaperManager::Get()->SetUserWallpaperNow(chromeos::login::GetGuestUserID() ); |
| 642 } | 643 } |
| 643 | 644 |
| 644 void ChromeUserManagerImpl::RegularUserLoggedIn(const std::string& user_id) { | 645 void ChromeUserManagerImpl::RegularUserLoggedIn(const user_manager::UserID& user _id) { |
| 645 ChromeUserManager::RegularUserLoggedIn(user_id); | 646 ChromeUserManager::RegularUserLoggedIn(user_id); |
| 646 | 647 |
| 647 if (IsCurrentUserNew()) | 648 if (IsCurrentUserNew()) |
| 648 WallpaperManager::Get()->SetUserWallpaperNow(user_id); | 649 WallpaperManager::Get()->SetUserWallpaperNow(user_id); |
| 649 | 650 |
| 650 GetUserImageManager(user_id)->UserLoggedIn(IsCurrentUserNew(), false); | 651 GetUserImageManager(user_id)->UserLoggedIn(IsCurrentUserNew(), false); |
| 651 | 652 |
| 652 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); | 653 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); |
| 653 | 654 |
| 654 // Make sure that new data is persisted to Local State. | 655 // Make sure that new data is persisted to Local State. |
| 655 GetLocalState()->CommitPendingWrite(); | 656 GetLocalState()->CommitPendingWrite(); |
| 656 } | 657 } |
| 657 | 658 |
| 658 void ChromeUserManagerImpl::RegularUserLoggedInAsEphemeral( | 659 void ChromeUserManagerImpl::RegularUserLoggedInAsEphemeral( |
| 659 const std::string& user_id) { | 660 const user_manager::UserID& user_id) { |
| 660 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 661 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 661 ChromeUserManager::RegularUserLoggedInAsEphemeral(user_id); | 662 ChromeUserManager::RegularUserLoggedInAsEphemeral(user_id); |
| 662 | 663 |
| 663 GetUserImageManager(user_id)->UserLoggedIn(IsCurrentUserNew(), false); | 664 GetUserImageManager(user_id)->UserLoggedIn(IsCurrentUserNew(), false); |
| 664 WallpaperManager::Get()->SetUserWallpaperNow(user_id); | 665 WallpaperManager::Get()->SetUserWallpaperNow(user_id); |
| 665 } | 666 } |
| 666 | 667 |
| 667 void ChromeUserManagerImpl::SupervisedUserLoggedIn(const std::string& user_id) { | 668 void ChromeUserManagerImpl::SupervisedUserLoggedIn(const user_manager::UserID& u ser_id) { |
| 668 // TODO(nkostylev): Refactor, share code with RegularUserLoggedIn(). | 669 // TODO(nkostylev): Refactor, share code with RegularUserLoggedIn(). |
| 669 | 670 |
| 670 // Remove the user from the user list. | 671 // Remove the user from the user list. |
| 671 active_user_ = RemoveRegularOrSupervisedUserFromList(user_id); | 672 active_user_ = RemoveRegularOrSupervisedUserFromList(user_id); |
| 672 | 673 |
| 673 // If the user was not found on the user list, create a new user. | 674 // If the user was not found on the user list, create a new user. |
| 674 if (!GetActiveUser()) { | 675 if (!GetActiveUser()) { |
| 675 SetIsCurrentUserNew(true); | 676 SetIsCurrentUserNew(true); |
| 676 active_user_ = user_manager::User::CreateSupervisedUser(user_id); | 677 active_user_ = user_manager::User::CreateSupervisedUser(user_id); |
| 677 // Leaving OAuth token status at the default state = unknown. | 678 // Leaving OAuth token status at the default state = unknown. |
| 678 WallpaperManager::Get()->SetUserWallpaperNow(user_id); | 679 WallpaperManager::Get()->SetUserWallpaperNow(user_id); |
| 679 } else { | 680 } else { |
| 680 if (supervised_user_manager_->CheckForFirstRun(user_id)) { | 681 if (supervised_user_manager_->CheckForFirstRun(user_id)) { |
| 681 SetIsCurrentUserNew(true); | 682 SetIsCurrentUserNew(true); |
| 682 WallpaperManager::Get()->SetUserWallpaperNow(user_id); | 683 WallpaperManager::Get()->SetUserWallpaperNow(user_id); |
| 683 } else { | 684 } else { |
| 684 SetIsCurrentUserNew(false); | 685 SetIsCurrentUserNew(false); |
| 685 } | 686 } |
| 686 } | 687 } |
| 687 | 688 |
| 688 // Add the user to the front of the user list. | 689 // Add the user to the front of the user list. |
| 689 ListPrefUpdate prefs_users_update(GetLocalState(), kRegularUsers); | 690 ListPrefUpdate prefs_users_update(GetLocalState(), kRegularUsers); |
| 690 prefs_users_update->Insert(0, new base::StringValue(user_id)); | 691 prefs_users_update->Insert(0, new base::StringValue(user_id.GetUserEmail())); |
| 691 users_.insert(users_.begin(), active_user_); | 692 users_.insert(users_.begin(), active_user_); |
| 692 | 693 |
| 693 // Now that user is in the list, save display name. | 694 // Now that user is in the list, save display name. |
| 694 if (IsCurrentUserNew()) { | 695 if (IsCurrentUserNew()) { |
| 695 SaveUserDisplayName(GetActiveUser()->email(), | 696 SaveUserDisplayName(GetActiveUser()->GetUserID(), |
| 696 GetActiveUser()->GetDisplayName()); | 697 GetActiveUser()->GetDisplayName()); |
| 697 } | 698 } |
| 698 | 699 |
| 699 GetUserImageManager(user_id)->UserLoggedIn(IsCurrentUserNew(), true); | 700 GetUserImageManager(user_id)->UserLoggedIn(IsCurrentUserNew(), true); |
| 700 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); | 701 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); |
| 701 | 702 |
| 702 // Make sure that new data is persisted to Local State. | 703 // Make sure that new data is persisted to Local State. |
| 703 GetLocalState()->CommitPendingWrite(); | 704 GetLocalState()->CommitPendingWrite(); |
| 704 } | 705 } |
| 705 | 706 |
| 706 bool ChromeUserManagerImpl::HasPendingBootstrap( | 707 bool ChromeUserManagerImpl::HasPendingBootstrap( |
| 707 const std::string& user_id) const { | 708 const user_manager::UserID& user_id) const { |
| 708 return bootstrap_manager_->HasPendingBootstrap(user_id); | 709 return bootstrap_manager_->HasPendingBootstrap(user_id); |
| 709 } | 710 } |
| 710 | 711 |
| 711 void ChromeUserManagerImpl::PublicAccountUserLoggedIn( | 712 void ChromeUserManagerImpl::PublicAccountUserLoggedIn( |
| 712 user_manager::User* user) { | 713 user_manager::User* user) { |
| 713 SetIsCurrentUserNew(true); | 714 SetIsCurrentUserNew(true); |
| 714 active_user_ = user; | 715 active_user_ = user; |
| 715 | 716 |
| 716 // The UserImageManager chooses a random avatar picture when a user logs in | 717 // The UserImageManager chooses a random avatar picture when a user logs in |
| 717 // for the first time. Tell the UserImageManager that this user is not new to | 718 // for the first time. Tell the UserImageManager that this user is not new to |
| 718 // prevent the avatar from getting changed. | 719 // prevent the avatar from getting changed. |
| 719 GetUserImageManager(user->email())->UserLoggedIn(false, true); | 720 GetUserImageManager(user->GetUserID())->UserLoggedIn(false, true); |
| 720 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); | 721 WallpaperManager::Get()->EnsureLoggedInUserWallpaperLoaded(); |
| 721 } | 722 } |
| 722 | 723 |
| 723 void ChromeUserManagerImpl::KioskAppLoggedIn(const std::string& app_id) { | 724 void ChromeUserManagerImpl::KioskAppLoggedIn(const std::string& app_id) { |
| 724 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 725 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 726 const user_manager::UserID app_user_id(user_manager::UserID::FromUserEmail(app _id)); | |
| 725 policy::DeviceLocalAccount::Type device_local_account_type; | 727 policy::DeviceLocalAccount::Type device_local_account_type; |
| 726 DCHECK(policy::IsDeviceLocalAccountUser(app_id, &device_local_account_type)); | 728 DCHECK(policy::IsDeviceLocalAccountUser(app_user_id, &device_local_account_typ e)); |
| 727 DCHECK_EQ(policy::DeviceLocalAccount::TYPE_KIOSK_APP, | 729 DCHECK_EQ(policy::DeviceLocalAccount::TYPE_KIOSK_APP, |
| 728 device_local_account_type); | 730 device_local_account_type); |
| 729 | 731 |
| 730 active_user_ = user_manager::User::CreateKioskAppUser(app_id); | 732 active_user_ = user_manager::User::CreateKioskAppUser(app_user_id); |
| 731 active_user_->SetStubImage( | 733 active_user_->SetStubImage( |
| 732 user_manager::UserImage( | 734 user_manager::UserImage( |
| 733 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 735 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 734 IDR_PROFILE_PICTURE_LOADING)), | 736 IDR_PROFILE_PICTURE_LOADING)), |
| 735 user_manager::User::USER_IMAGE_INVALID, | 737 user_manager::User::USER_IMAGE_INVALID, |
| 736 false); | 738 false); |
| 737 | 739 |
| 738 WallpaperManager::Get()->SetUserWallpaperNow(app_id); | 740 WallpaperManager::Get()->SetUserWallpaperNow(app_user_id); |
| 739 | 741 |
| 740 // TODO(bartfab): Add KioskAppUsers to the users_ list and keep metadata like | 742 // TODO(bartfab): Add KioskAppUsers to the users_ list and keep metadata like |
| 741 // the kiosk_app_id in these objects, removing the need to re-parse the | 743 // the kiosk_app_id in these objects, removing the need to re-parse the |
| 742 // device-local account list here to extract the kiosk_app_id. | 744 // device-local account list here to extract the kiosk_app_id. |
| 743 const std::vector<policy::DeviceLocalAccount> device_local_accounts = | 745 const std::vector<policy::DeviceLocalAccount> device_local_accounts = |
| 744 policy::GetDeviceLocalAccounts(cros_settings_); | 746 policy::GetDeviceLocalAccounts(cros_settings_); |
| 745 const policy::DeviceLocalAccount* account = NULL; | 747 const policy::DeviceLocalAccount* account = NULL; |
| 746 for (std::vector<policy::DeviceLocalAccount>::const_iterator it = | 748 for (std::vector<policy::DeviceLocalAccount>::const_iterator it = |
| 747 device_local_accounts.begin(); | 749 device_local_accounts.begin(); |
| 748 it != device_local_accounts.end(); | 750 it != device_local_accounts.end(); |
| 749 ++it) { | 751 ++it) { |
| 750 if (it->user_id == app_id) { | 752 if (it->user_id == app_user_id) { |
| 751 account = &*it; | 753 account = &*it; |
| 752 break; | 754 break; |
| 753 } | 755 } |
| 754 } | 756 } |
| 755 std::string kiosk_app_id; | 757 std::string kiosk_app_id; |
| 756 if (account) { | 758 if (account) { |
| 757 kiosk_app_id = account->kiosk_app_id; | 759 kiosk_app_id = account->kiosk_app_id; |
| 758 } else { | 760 } else { |
| 759 LOG(ERROR) << "Logged into nonexistent kiosk-app account: " << app_id; | 761 LOG(ERROR) << "Logged into nonexistent kiosk-app account: " << app_id; |
| 760 NOTREACHED(); | 762 NOTREACHED(); |
| 761 } | 763 } |
| 762 | 764 |
| 763 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 765 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 764 command_line->AppendSwitch(::switches::kForceAppMode); | 766 command_line->AppendSwitch(::switches::kForceAppMode); |
| 765 command_line->AppendSwitchASCII(::switches::kAppId, kiosk_app_id); | 767 command_line->AppendSwitchASCII(::switches::kAppId, kiosk_app_id); |
| 766 | 768 |
| 767 // Disable window animation since kiosk app runs in a single full screen | 769 // Disable window animation since kiosk app runs in a single full screen |
| 768 // window and window animation causes start-up janks. | 770 // window and window animation causes start-up janks. |
| 769 command_line->AppendSwitch(wm::switches::kWindowAnimationsDisabled); | 771 command_line->AppendSwitch(wm::switches::kWindowAnimationsDisabled); |
| 770 } | 772 } |
| 771 | 773 |
| 772 void ChromeUserManagerImpl::DemoAccountLoggedIn() { | 774 void ChromeUserManagerImpl::DemoAccountLoggedIn() { |
| 773 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 775 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 774 active_user_ = | 776 active_user_ = |
| 775 user_manager::User::CreateKioskAppUser(DemoAppLauncher::kDemoUserName); | 777 user_manager::User::CreateKioskAppUser(DemoAppLauncher::GetDemoUserID()); |
| 776 active_user_->SetStubImage( | 778 active_user_->SetStubImage( |
| 777 user_manager::UserImage( | 779 user_manager::UserImage( |
| 778 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 780 *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 779 IDR_PROFILE_PICTURE_LOADING)), | 781 IDR_PROFILE_PICTURE_LOADING)), |
| 780 user_manager::User::USER_IMAGE_INVALID, | 782 user_manager::User::USER_IMAGE_INVALID, |
| 781 false); | 783 false); |
| 782 WallpaperManager::Get()->SetUserWallpaperNow(DemoAppLauncher::kDemoUserName); | 784 WallpaperManager::Get()->SetUserWallpaperNow(DemoAppLauncher::GetDemoUserID()) ; |
| 783 | 785 |
| 784 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 786 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 785 command_line->AppendSwitch(::switches::kForceAppMode); | 787 command_line->AppendSwitch(::switches::kForceAppMode); |
| 786 command_line->AppendSwitchASCII(::switches::kAppId, | 788 command_line->AppendSwitchASCII(::switches::kAppId, |
| 787 DemoAppLauncher::kDemoAppId); | 789 DemoAppLauncher::kDemoAppId); |
| 788 | 790 |
| 789 // Disable window animation since the demo app runs in a single full screen | 791 // Disable window animation since the demo app runs in a single full screen |
| 790 // window and window animation causes start-up janks. | 792 // window and window animation causes start-up janks. |
| 791 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 793 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 792 wm::switches::kWindowAnimationsDisabled); | 794 wm::switches::kWindowAnimationsDisabled); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 811 } | 813 } |
| 812 | 814 |
| 813 void ChromeUserManagerImpl::UpdateOwnership() { | 815 void ChromeUserManagerImpl::UpdateOwnership() { |
| 814 bool is_owner = DeviceSettingsService::Get()->HasPrivateOwnerKey(); | 816 bool is_owner = DeviceSettingsService::Get()->HasPrivateOwnerKey(); |
| 815 VLOG(1) << "Current user " << (is_owner ? "is owner" : "is not owner"); | 817 VLOG(1) << "Current user " << (is_owner ? "is owner" : "is not owner"); |
| 816 | 818 |
| 817 SetCurrentUserIsOwner(is_owner); | 819 SetCurrentUserIsOwner(is_owner); |
| 818 } | 820 } |
| 819 | 821 |
| 820 void ChromeUserManagerImpl::RemoveNonCryptohomeData( | 822 void ChromeUserManagerImpl::RemoveNonCryptohomeData( |
| 821 const std::string& user_id) { | 823 const user_manager::UserID& user_id) { |
| 822 ChromeUserManager::RemoveNonCryptohomeData(user_id); | 824 ChromeUserManager::RemoveNonCryptohomeData(user_id); |
| 823 | 825 |
| 824 WallpaperManager::Get()->RemoveUserWallpaperInfo(user_id); | 826 WallpaperManager::Get()->RemoveUserWallpaperInfo(user_id); |
| 825 GetUserImageManager(user_id)->DeleteUserImage(); | 827 GetUserImageManager(user_id)->DeleteUserImage(); |
| 826 | 828 |
| 827 supervised_user_manager_->RemoveNonCryptohomeData(user_id); | 829 supervised_user_manager_->RemoveNonCryptohomeData(user_id); |
| 828 | 830 |
| 829 multi_profile_user_controller_->RemoveCachedValues(user_id); | 831 multi_profile_user_controller_->RemoveCachedValues(user_id); |
| 830 | 832 |
| 831 EasyUnlockService::ResetLocalStateForUser(user_id); | 833 EasyUnlockService::ResetLocalStateForUser(user_id); |
| 832 } | 834 } |
| 833 | 835 |
| 834 void | 836 void |
| 835 ChromeUserManagerImpl::CleanUpPublicAccountNonCryptohomeDataPendingRemoval() { | 837 ChromeUserManagerImpl::CleanUpPublicAccountNonCryptohomeDataPendingRemoval() { |
| 836 PrefService* local_state = GetLocalState(); | 838 PrefService* local_state = GetLocalState(); |
| 837 const std::string public_account_pending_data_removal = | 839 const user_manager::UserID public_account_pending_data_removal(user_manager::U serID::FromUserEmail( |
| 838 local_state->GetString(kPublicAccountPendingDataRemoval); | 840 local_state->GetString(kPublicAccountPendingDataRemoval))); |
| 839 if (public_account_pending_data_removal.empty() || | 841 if (public_account_pending_data_removal.empty() || |
| 840 (IsUserLoggedIn() && | 842 (IsUserLoggedIn() && |
| 841 public_account_pending_data_removal == GetActiveUser()->email())) { | 843 public_account_pending_data_removal == GetActiveUser()->GetUserID())) { |
| 842 return; | 844 return; |
| 843 } | 845 } |
| 844 | 846 |
| 845 RemoveNonCryptohomeData(public_account_pending_data_removal); | 847 RemoveNonCryptohomeData(public_account_pending_data_removal); |
| 846 local_state->ClearPref(kPublicAccountPendingDataRemoval); | 848 local_state->ClearPref(kPublicAccountPendingDataRemoval); |
| 847 } | 849 } |
| 848 | 850 |
| 849 void ChromeUserManagerImpl::CleanUpPublicAccountNonCryptohomeData( | 851 void ChromeUserManagerImpl::CleanUpPublicAccountNonCryptohomeData( |
| 850 const std::vector<std::string>& old_public_accounts) { | 852 const std::vector<user_manager::UserID>& old_public_accounts) { |
| 851 std::set<std::string> users; | 853 std::set<user_manager::UserID> users; |
| 852 for (user_manager::UserList::const_iterator it = users_.begin(); | 854 for (user_manager::UserList::const_iterator it = users_.begin(); |
| 853 it != users_.end(); | 855 it != users_.end(); |
| 854 ++it) | 856 ++it) |
| 855 users.insert((*it)->email()); | 857 users.insert((*it)->GetUserID()); |
| 856 | 858 |
| 857 // If the user is logged into a public account that has been removed from the | 859 // If the user is logged into a public account that has been removed from the |
| 858 // user list, mark the account's data as pending removal after logout. | 860 // user list, mark the account's data as pending removal after logout. |
| 859 if (IsLoggedInAsPublicAccount()) { | 861 if (IsLoggedInAsPublicAccount()) { |
| 860 const std::string active_user_id = GetActiveUser()->email(); | 862 const user_manager::UserID& active_user_id = GetActiveUser()->GetUserID(); |
| 861 if (users.find(active_user_id) == users.end()) { | 863 if (users.find(active_user_id) == users.end()) { |
| 862 GetLocalState()->SetString(kPublicAccountPendingDataRemoval, | 864 GetLocalState()->SetString(kPublicAccountPendingDataRemoval, |
| 863 active_user_id); | 865 active_user_id.GetUserEmail()); |
| 864 users.insert(active_user_id); | 866 users.insert(active_user_id); |
| 865 } | 867 } |
| 866 } | 868 } |
| 867 | 869 |
| 868 // Remove the data belonging to any other public accounts that are no longer | 870 // Remove the data belonging to any other public accounts that are no longer |
| 869 // found on the user list. | 871 // found on the user list. |
| 870 for (std::vector<std::string>::const_iterator it = | 872 for (std::vector<user_manager::UserID>::const_iterator it = |
| 871 old_public_accounts.begin(); | 873 old_public_accounts.begin(); |
| 872 it != old_public_accounts.end(); | 874 it != old_public_accounts.end(); |
| 873 ++it) { | 875 ++it) { |
| 874 if (users.find(*it) == users.end()) | 876 if (users.find(*it) == users.end()) |
| 875 RemoveNonCryptohomeData(*it); | 877 RemoveNonCryptohomeData(*it); |
| 876 } | 878 } |
| 877 } | 879 } |
| 878 | 880 |
| 879 bool ChromeUserManagerImpl::UpdateAndCleanUpPublicAccounts( | 881 bool ChromeUserManagerImpl::UpdateAndCleanUpPublicAccounts( |
| 880 const std::vector<policy::DeviceLocalAccount>& device_local_accounts) { | 882 const std::vector<policy::DeviceLocalAccount>& device_local_accounts) { |
| 881 // Try to remove any public account data marked as pending removal. | 883 // Try to remove any public account data marked as pending removal. |
| 882 CleanUpPublicAccountNonCryptohomeDataPendingRemoval(); | 884 CleanUpPublicAccountNonCryptohomeDataPendingRemoval(); |
| 883 | 885 |
| 884 // Get the current list of public accounts. | 886 // Get the current list of public accounts. |
| 885 std::vector<std::string> old_public_accounts; | 887 std::vector<user_manager::UserID> old_public_accounts; |
| 886 for (user_manager::UserList::const_iterator it = users_.begin(); | 888 for (user_manager::UserList::const_iterator it = users_.begin(); |
| 887 it != users_.end(); | 889 it != users_.end(); |
| 888 ++it) { | 890 ++it) { |
| 889 if ((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) | 891 if ((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) |
| 890 old_public_accounts.push_back((*it)->email()); | 892 old_public_accounts.push_back((*it)->GetUserID()); |
| 891 } | 893 } |
| 892 | 894 |
| 893 // Get the new list of public accounts from policy. | 895 // Get the new list of public accounts from policy. |
| 894 std::vector<std::string> new_public_accounts; | 896 std::vector<user_manager::UserID> new_public_accounts; |
| 895 for (std::vector<policy::DeviceLocalAccount>::const_iterator it = | 897 for (std::vector<policy::DeviceLocalAccount>::const_iterator it = |
| 896 device_local_accounts.begin(); | 898 device_local_accounts.begin(); |
| 897 it != device_local_accounts.end(); | 899 it != device_local_accounts.end(); |
| 898 ++it) { | 900 ++it) { |
| 899 // TODO(mnissler, nkostylev, bartfab): Process Kiosk Apps within the | 901 // TODO(mnissler, nkostylev, bartfab): Process Kiosk Apps within the |
| 900 // standard login framework: http://crbug.com/234694 | 902 // standard login framework: http://crbug.com/234694 |
| 901 if (it->type == policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION) | 903 if (it->type == policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION) |
| 902 new_public_accounts.push_back(it->user_id); | 904 new_public_accounts.push_back(it->user_id); |
| 903 } | 905 } |
| 904 | 906 |
| 905 // If the list of public accounts has not changed, return. | 907 // If the list of public accounts has not changed, return. |
| 906 if (new_public_accounts.size() == old_public_accounts.size()) { | 908 if (new_public_accounts.size() == old_public_accounts.size()) { |
| 907 bool changed = false; | 909 bool changed = false; |
| 908 for (size_t i = 0; i < new_public_accounts.size(); ++i) { | 910 for (size_t i = 0; i < new_public_accounts.size(); ++i) { |
| 909 if (new_public_accounts[i] != old_public_accounts[i]) { | 911 if (new_public_accounts[i] != old_public_accounts[i]) { |
| 910 changed = true; | 912 changed = true; |
| 911 break; | 913 break; |
| 912 } | 914 } |
| 913 } | 915 } |
| 914 if (!changed) | 916 if (!changed) |
| 915 return false; | 917 return false; |
| 916 } | 918 } |
| 917 | 919 |
| 918 // Persist the new list of public accounts in a pref. | 920 // Persist the new list of public accounts in a pref. |
| 919 ListPrefUpdate prefs_public_accounts_update(GetLocalState(), kPublicAccounts); | 921 ListPrefUpdate prefs_public_accounts_update(GetLocalState(), kPublicAccounts); |
| 920 prefs_public_accounts_update->Clear(); | 922 prefs_public_accounts_update->Clear(); |
| 921 for (std::vector<std::string>::const_iterator it = | 923 for (std::vector<user_manager::UserID>::const_iterator it = |
| 922 new_public_accounts.begin(); | 924 new_public_accounts.begin(); |
| 923 it != new_public_accounts.end(); | 925 it != new_public_accounts.end(); |
| 924 ++it) { | 926 ++it) { |
| 925 prefs_public_accounts_update->AppendString(*it); | 927 prefs_public_accounts_update->AppendString(it->GetUserEmail()); |
| 926 } | 928 } |
| 927 | 929 |
| 928 // Remove the old public accounts from the user list. | 930 // Remove the old public accounts from the user list. |
| 929 for (user_manager::UserList::iterator it = users_.begin(); | 931 for (user_manager::UserList::iterator it = users_.begin(); |
| 930 it != users_.end();) { | 932 it != users_.end();) { |
| 931 if ((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) { | 933 if ((*it)->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT) { |
| 932 if (*it != GetLoggedInUser()) | 934 if (*it != GetLoggedInUser()) |
| 933 DeleteUser(*it); | 935 DeleteUser(*it); |
| 934 it = users_.erase(it); | 936 it = users_.erase(it); |
| 935 } else { | 937 } else { |
| 936 ++it; | 938 ++it; |
| 937 } | 939 } |
| 938 } | 940 } |
| 939 | 941 |
| 940 // Add the new public accounts to the front of the user list. | 942 // Add the new public accounts to the front of the user list. |
| 941 for (std::vector<std::string>::const_reverse_iterator it = | 943 for (std::vector<user_manager::UserID>::const_reverse_iterator it = |
| 942 new_public_accounts.rbegin(); | 944 new_public_accounts.rbegin(); |
| 943 it != new_public_accounts.rend(); | 945 it != new_public_accounts.rend(); |
| 944 ++it) { | 946 ++it) { |
| 945 if (IsLoggedInAsPublicAccount() && *it == GetActiveUser()->email()) | 947 if (IsLoggedInAsPublicAccount() && *it == GetActiveUser()->GetUserID()) |
| 946 users_.insert(users_.begin(), GetLoggedInUser()); | 948 users_.insert(users_.begin(), GetLoggedInUser()); |
| 947 else | 949 else |
| 948 users_.insert(users_.begin(), | 950 users_.insert(users_.begin(), |
| 949 user_manager::User::CreatePublicAccountUser(*it)); | 951 user_manager::User::CreatePublicAccountUser(*it)); |
| 950 UpdatePublicAccountDisplayName(*it); | 952 UpdatePublicAccountDisplayName(*it); |
| 951 } | 953 } |
| 952 | 954 |
| 953 for (user_manager::UserList::iterator | 955 for (user_manager::UserList::iterator |
| 954 ui = users_.begin(), | 956 ui = users_.begin(), |
| 955 ue = users_.begin() + new_public_accounts.size(); | 957 ue = users_.begin() + new_public_accounts.size(); |
| 956 ui != ue; | 958 ui != ue; |
| 957 ++ui) { | 959 ++ui) { |
| 958 GetUserImageManager((*ui)->email())->LoadUserImage(); | 960 GetUserImageManager((*ui)->GetUserID())->LoadUserImage(); |
| 959 } | 961 } |
| 960 | 962 |
| 961 // Remove data belonging to public accounts that are no longer found on the | 963 // Remove data belonging to public accounts that are no longer found on the |
| 962 // user list. | 964 // user list. |
| 963 CleanUpPublicAccountNonCryptohomeData(old_public_accounts); | 965 CleanUpPublicAccountNonCryptohomeData(old_public_accounts); |
| 964 | 966 |
| 965 return true; | 967 return true; |
| 966 } | 968 } |
| 967 | 969 |
| 968 void ChromeUserManagerImpl::UpdatePublicAccountDisplayName( | 970 void ChromeUserManagerImpl::UpdatePublicAccountDisplayName( |
| 969 const std::string& user_id) { | 971 const user_manager::UserID& user_id) { |
| 970 std::string display_name; | 972 std::string display_name; |
| 971 | 973 |
| 972 if (device_local_account_policy_service_) { | 974 if (device_local_account_policy_service_) { |
| 973 policy::DeviceLocalAccountPolicyBroker* broker = | 975 policy::DeviceLocalAccountPolicyBroker* broker = |
| 974 device_local_account_policy_service_->GetBrokerForUser(user_id); | 976 device_local_account_policy_service_->GetBrokerForUser(user_id); |
| 975 if (broker) | 977 if (broker) |
| 976 display_name = broker->GetDisplayName(); | 978 display_name = broker->GetDisplayName(); |
| 977 } | 979 } |
| 978 | 980 |
| 979 // Set or clear the display name. | 981 // Set or clear the display name. |
| 980 SaveUserDisplayName(user_id, base::UTF8ToUTF16(display_name)); | 982 SaveUserDisplayName(user_id, base::UTF8ToUTF16(display_name)); |
| 981 } | 983 } |
| 982 | 984 |
| 983 UserFlow* ChromeUserManagerImpl::GetCurrentUserFlow() const { | 985 UserFlow* ChromeUserManagerImpl::GetCurrentUserFlow() const { |
| 984 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 986 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 985 if (!IsUserLoggedIn()) | 987 if (!IsUserLoggedIn()) |
| 986 return GetDefaultUserFlow(); | 988 return GetDefaultUserFlow(); |
| 987 return GetUserFlow(GetLoggedInUser()->email()); | 989 return GetUserFlow(GetLoggedInUser()->GetUserID()); |
| 988 } | 990 } |
| 989 | 991 |
| 990 UserFlow* ChromeUserManagerImpl::GetUserFlow(const std::string& user_id) const { | 992 UserFlow* ChromeUserManagerImpl::GetUserFlow(const user_manager::UserID& user_id ) const { |
| 991 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 993 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 992 FlowMap::const_iterator it = specific_flows_.find(user_id); | 994 FlowMap::const_iterator it = specific_flows_.find(user_id); |
| 993 if (it != specific_flows_.end()) | 995 if (it != specific_flows_.end()) |
| 994 return it->second; | 996 return it->second; |
| 995 return GetDefaultUserFlow(); | 997 return GetDefaultUserFlow(); |
| 996 } | 998 } |
| 997 | 999 |
| 998 void ChromeUserManagerImpl::SetUserFlow(const std::string& user_id, | 1000 void ChromeUserManagerImpl::SetUserFlow(const user_manager::UserID& user_id, |
| 999 UserFlow* flow) { | 1001 UserFlow* flow) { |
| 1000 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1002 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1001 ResetUserFlow(user_id); | 1003 ResetUserFlow(user_id); |
| 1002 specific_flows_[user_id] = flow; | 1004 specific_flows_[user_id] = flow; |
| 1003 } | 1005 } |
| 1004 | 1006 |
| 1005 void ChromeUserManagerImpl::ResetUserFlow(const std::string& user_id) { | 1007 void ChromeUserManagerImpl::ResetUserFlow(const user_manager::UserID& user_id) { |
| 1006 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1008 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1007 FlowMap::iterator it = specific_flows_.find(user_id); | 1009 FlowMap::iterator it = specific_flows_.find(user_id); |
| 1008 if (it != specific_flows_.end()) { | 1010 if (it != specific_flows_.end()) { |
| 1009 delete it->second; | 1011 delete it->second; |
| 1010 specific_flows_.erase(it); | 1012 specific_flows_.erase(it); |
| 1011 } | 1013 } |
| 1012 } | 1014 } |
| 1013 | 1015 |
| 1014 bool ChromeUserManagerImpl::AreSupervisedUsersAllowed() const { | 1016 bool ChromeUserManagerImpl::AreSupervisedUsersAllowed() const { |
| 1015 bool supervised_users_allowed = false; | 1017 bool supervised_users_allowed = false; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1034 | 1036 |
| 1035 void ChromeUserManagerImpl::NotifyUserAddedToSession( | 1037 void ChromeUserManagerImpl::NotifyUserAddedToSession( |
| 1036 const user_manager::User* added_user, | 1038 const user_manager::User* added_user, |
| 1037 bool user_switch_pending) { | 1039 bool user_switch_pending) { |
| 1038 // Special case for user session restoration after browser crash. | 1040 // Special case for user session restoration after browser crash. |
| 1039 // We don't switch to each user session that has been restored as once all | 1041 // We don't switch to each user session that has been restored as once all |
| 1040 // session will be restored we'll switch to the session that has been used | 1042 // session will be restored we'll switch to the session that has been used |
| 1041 // before the crash. | 1043 // before the crash. |
| 1042 if (user_switch_pending && | 1044 if (user_switch_pending && |
| 1043 !UserSessionManager::GetInstance()->UserSessionsRestoreInProgress()) { | 1045 !UserSessionManager::GetInstance()->UserSessionsRestoreInProgress()) { |
| 1044 SetPendingUserSwitchID(added_user->email()); | 1046 SetPendingUserSwitchID(added_user->GetUserID()); |
| 1045 } | 1047 } |
| 1046 | 1048 |
| 1047 UpdateNumberOfUsers(); | 1049 UpdateNumberOfUsers(); |
| 1048 ChromeUserManager::NotifyUserAddedToSession(added_user, user_switch_pending); | 1050 ChromeUserManager::NotifyUserAddedToSession(added_user, user_switch_pending); |
| 1049 } | 1051 } |
| 1050 | 1052 |
| 1051 void ChromeUserManagerImpl::OnUserNotAllowed(const std::string& user_email) { | 1053 void ChromeUserManagerImpl::OnUserNotAllowed(const user_manager::UserID& user_id ) { |
| 1052 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " | 1054 LOG(ERROR) << "Shutdown session because a user is not allowed to be in the " |
| 1053 "current session"; | 1055 "current session"; |
| 1054 chromeos::ShowMultiprofilesSessionAbortedDialog(user_email); | 1056 chromeos::ShowMultiprofilesSessionAbortedDialog(user_id); |
| 1055 } | 1057 } |
| 1056 | 1058 |
| 1057 void ChromeUserManagerImpl::RemovePendingBootstrapUser( | 1059 void ChromeUserManagerImpl::RemovePendingBootstrapUser( |
| 1058 const std::string& user_id) { | 1060 const user_manager::UserID& user_id) { |
| 1059 DCHECK(HasPendingBootstrap(user_id)); | 1061 DCHECK(HasPendingBootstrap(user_id)); |
| 1060 RemoveNonOwnerUserInternal(user_id, NULL); | 1062 RemoveNonOwnerUserInternal(user_id, NULL); |
| 1061 } | 1063 } |
| 1062 | 1064 |
| 1063 void ChromeUserManagerImpl::UpdateNumberOfUsers() { | 1065 void ChromeUserManagerImpl::UpdateNumberOfUsers() { |
| 1064 size_t users = GetLoggedInUsers().size(); | 1066 size_t users = GetLoggedInUsers().size(); |
| 1065 if (users) { | 1067 if (users) { |
| 1066 // Write the user number as UMA stat when a multi user session is possible. | 1068 // Write the user number as UMA stat when a multi user session is possible. |
| 1067 if ((users + GetUsersAllowedForMultiProfile().size()) > 1) | 1069 if ((users + GetUsersAllowedForMultiProfile().size()) > 1) |
| 1068 ash::MultiProfileUMA::RecordUserCount(users); | 1070 ash::MultiProfileUMA::RecordUserCount(users); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1101 | 1103 |
| 1102 if (profile->GetPrefs()->GetBoolean(prefs::kResolveTimezoneByGeolocation) && | 1104 if (profile->GetPrefs()->GetBoolean(prefs::kResolveTimezoneByGeolocation) && |
| 1103 !system::HasSystemTimezonePolicy()) { | 1105 !system::HasSystemTimezonePolicy()) { |
| 1104 g_browser_process->platform_part()->GetTimezoneResolver()->Start(); | 1106 g_browser_process->platform_part()->GetTimezoneResolver()->Start(); |
| 1105 } else { | 1107 } else { |
| 1106 g_browser_process->platform_part()->GetTimezoneResolver()->Stop(); | 1108 g_browser_process->platform_part()->GetTimezoneResolver()->Stop(); |
| 1107 } | 1109 } |
| 1108 } | 1110 } |
| 1109 | 1111 |
| 1110 } // namespace chromeos | 1112 } // namespace chromeos |
| OLD | NEW |