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

Side by Side Diff: chrome/browser/chromeos/login/user_manager_impl.cc

Issue 11308068: Remove the old wallpaper picker code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/shell.h" 7 #include "ash/shell.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/chromeos/chromeos_version.h" 9 #include "base/chromeos/chromeos_version.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 username, 399 username,
400 base::Value::CreateStringValue(display_email)); 400 base::Value::CreateStringValue(display_email));
401 } 401 }
402 402
403 std::string UserManagerImpl::GetUserDisplayEmail( 403 std::string UserManagerImpl::GetUserDisplayEmail(
404 const std::string& username) const { 404 const std::string& username) const {
405 const User* user = FindUser(username); 405 const User* user = FindUser(username);
406 return user ? user->display_email() : username; 406 return user ? user->display_email() : username;
407 } 407 }
408 408
409 void UserManagerImpl::SetLoggedInUserCustomWallpaperLayout(
410 ash::WallpaperLayout layout) {
411 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
412
413 // TODO(bshe): We current disabled the customized wallpaper feature for
414 // Ephemeral user. As we dont want to keep a copy of customized wallpaper in
415 // memory. Need a smarter way to solve this.
416 if (IsCurrentUserEphemeral())
417 return;
418 std::string username = logged_in_user_->email();
419 DCHECK(!username.empty());
420
421 std::string file_path = WallpaperManager::Get()->
422 GetWallpaperPathForUser(username, false).value();
423 SaveWallpaperToLocalState(username, file_path, layout, User::CUSTOMIZED);
424 // Load wallpaper from file.
425 WallpaperManager::Get()->SetUserWallpaper(username);
426 }
427
428 void UserManagerImpl::Observe(int type, 409 void UserManagerImpl::Observe(int type,
429 const content::NotificationSource& source, 410 const content::NotificationSource& source,
430 const content::NotificationDetails& details) { 411 const content::NotificationDetails& details) {
431 switch (type) { 412 switch (type) {
432 case chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED: 413 case chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED:
433 CheckOwnership(); 414 CheckOwnership();
434 RetrieveTrustedDevicePolicies(); 415 RetrieveTrustedDevicePolicies();
435 break; 416 break;
436 case chrome::NOTIFICATION_PROFILE_ADDED: 417 case chrome::NOTIFICATION_PROFILE_ADDED:
437 if (IsUserLoggedIn() && !IsLoggedInAsGuest()) { 418 if (IsUserLoggedIn() && !IsLoggedInAsGuest()) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 std::string display_email; 578 std::string display_email;
598 if (prefs_display_emails && 579 if (prefs_display_emails &&
599 prefs_display_emails->GetStringWithoutPathExpansion( 580 prefs_display_emails->GetStringWithoutPathExpansion(
600 email, &display_email)) { 581 email, &display_email)) {
601 user->set_display_email(display_email); 582 user->set_display_email(display_email);
602 } 583 }
603 } 584 }
604 } 585 }
605 586
606 user_image_manager_->LoadUserImages(users_); 587 user_image_manager_->LoadUserImages(users_);
607 WallpaperManager::Get()->MigrateWallpaperData(users_);
608 } 588 }
609 589
610 void UserManagerImpl::RetrieveTrustedDevicePolicies() { 590 void UserManagerImpl::RetrieveTrustedDevicePolicies() {
611 ephemeral_users_enabled_ = false; 591 ephemeral_users_enabled_ = false;
612 owner_email_ = ""; 592 owner_email_ = "";
613 593
614 CrosSettings* cros_settings = CrosSettings::Get(); 594 CrosSettings* cros_settings = CrosSettings::Get();
615 // Schedule a callback if device policy has not yet been verified. 595 // Schedule a callback if device policy has not yet been verified.
616 if (CrosSettingsProvider::TRUSTED != cros_settings->PrepareTrustedValues( 596 if (CrosSettingsProvider::TRUSTED != cros_settings->PrepareTrustedValues(
617 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies, 597 base::Bind(&UserManagerImpl::RetrieveTrustedDevicePolicies,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 content::Source<UserManager>(this), 651 content::Source<UserManager>(this),
672 content::Details<const User>(logged_in_user_)); 652 content::Details<const User>(logged_in_user_));
673 653
674 CrosLibrary::Get()->GetCertLibrary()->LoadKeyStore(); 654 CrosLibrary::Get()->GetCertLibrary()->LoadKeyStore();
675 655
676 // Indicate to DeviceSettingsService that the owner key may have become 656 // Indicate to DeviceSettingsService that the owner key may have become
677 // available. 657 // available.
678 DeviceSettingsService::Get()->SetUsername(logged_in_user_->email()); 658 DeviceSettingsService::Get()->SetUsername(logged_in_user_->email());
679 } 659 }
680 660
681 void UserManagerImpl::SaveLoggedInUserWallpaperProperties(
682 User::WallpaperType type, int index) {
683 // Ephemeral users can not save data to local state.
684 // We just cache the index in memory for them.
685 bool is_persistent = !IsCurrentUserEphemeral();
686 WallpaperManager::Get()->SetUserWallpaperProperties(
687 logged_in_user_->email(), type, index, is_persistent);
688 }
689
690 void UserManagerImpl::SaveWallpaperToLocalState(const std::string& username,
691 const std::string& wallpaper_path,
692 ash::WallpaperLayout layout,
693 User::WallpaperType type) {
694 // TODO(bshe): We probably need to save wallpaper_path instead of index.
695 WallpaperManager::Get()->SetUserWallpaperProperties(
696 username, type, layout, true);
697 }
698
699 void UserManagerImpl::UpdateOwnership( 661 void UserManagerImpl::UpdateOwnership(
700 DeviceSettingsService::OwnershipStatus status, 662 DeviceSettingsService::OwnershipStatus status,
701 bool is_owner) { 663 bool is_owner) {
702 VLOG(1) << "Current user " << (is_owner ? "is owner" : "is not owner"); 664 VLOG(1) << "Current user " << (is_owner ? "is owner" : "is not owner");
703 665
704 SetCurrentUserIsOwner(is_owner); 666 SetCurrentUserIsOwner(is_owner);
705 } 667 }
706 668
707 void UserManagerImpl::CheckOwnership() { 669 void UserManagerImpl::CheckOwnership() {
708 DeviceSettingsService::Get()->GetOwnershipStatusAsync( 670 DeviceSettingsService::Get()->GetOwnershipStatusAsync(
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 DictionaryPrefUpdate prefs_display_email_update(prefs, kUserDisplayEmail); 709 DictionaryPrefUpdate prefs_display_email_update(prefs, kUserDisplayEmail);
748 prefs_display_email_update->RemoveWithoutPathExpansion(email, NULL); 710 prefs_display_email_update->RemoveWithoutPathExpansion(email, NULL);
749 711
750 if (user_to_remove != users_.end()) { 712 if (user_to_remove != users_.end()) {
751 delete *user_to_remove; 713 delete *user_to_remove;
752 users_.erase(user_to_remove); 714 users_.erase(user_to_remove);
753 } 715 }
754 } 716 }
755 717
756 } // namespace chromeos 718 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698