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

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

Issue 138913011: Code refactor(rename email to user_id in wallpaper_manager.h/cc) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: format nits Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/login/wallpaper_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/wallpaper_manager.h" 5 #include "chrome/browser/chromeos/login/wallpaper_manager.h"
6 6
7 #include <numeric> 7 #include <numeric>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 // Returns custom wallpaper directory by appending corresponding |sub_dir|. 96 // Returns custom wallpaper directory by appending corresponding |sub_dir|.
97 base::FilePath GetCustomWallpaperDir(const char* sub_dir) { 97 base::FilePath GetCustomWallpaperDir(const char* sub_dir) {
98 base::FilePath custom_wallpaper_dir; 98 base::FilePath custom_wallpaper_dir;
99 CHECK(PathService::Get(chrome::DIR_CHROMEOS_CUSTOM_WALLPAPERS, 99 CHECK(PathService::Get(chrome::DIR_CHROMEOS_CUSTOM_WALLPAPERS,
100 &custom_wallpaper_dir)); 100 &custom_wallpaper_dir));
101 return custom_wallpaper_dir.Append(sub_dir); 101 return custom_wallpaper_dir.Append(sub_dir);
102 } 102 }
103 103
104 bool MoveCustomWallpaperDirectory(const char* sub_dir, 104 bool MoveCustomWallpaperDirectory(const char* sub_dir,
105 const std::string& email, 105 const std::string& user_id,
106 const std::string& user_id_hash) { 106 const std::string& user_id_hash) {
107 base::FilePath base_path = GetCustomWallpaperDir(sub_dir); 107 base::FilePath base_path = GetCustomWallpaperDir(sub_dir);
108 base::FilePath to_path = base_path.Append(user_id_hash); 108 base::FilePath to_path = base_path.Append(user_id_hash);
109 base::FilePath from_path = base_path.Append(email); 109 base::FilePath from_path = base_path.Append(user_id);
110 if (base::PathExists(from_path)) 110 if (base::PathExists(from_path))
111 return base::Move(from_path, to_path); 111 return base::Move(from_path, to_path);
112 return false; 112 return false;
113 } 113 }
114 114
115 } // namespace 115 } // namespace
116 116
117 namespace chromeos { 117 namespace chromeos {
118 118
119 const char kWallpaperSequenceTokenName[] = "wallpaper-sequence"; 119 const char kWallpaperSequenceTokenName[] = "wallpaper-sequence";
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 base::TimeDelta::FromMilliseconds(kCacheWallpaperDelayMs)); 498 base::TimeDelta::FromMilliseconds(kCacheWallpaperDelayMs));
499 should_cache_wallpaper_ = false; 499 should_cache_wallpaper_ = false;
500 } 500 }
501 break; 501 break;
502 } 502 }
503 default: 503 default:
504 NOTREACHED() << "Unexpected notification " << type; 504 NOTREACHED() << "Unexpected notification " << type;
505 } 505 }
506 } 506 }
507 507
508 void WallpaperManager::RemoveUserWallpaperInfo(const std::string& email) { 508 void WallpaperManager::RemoveUserWallpaperInfo(const std::string& user_id) {
509 WallpaperInfo info; 509 WallpaperInfo info;
510 GetUserWallpaperInfo(email, &info); 510 GetUserWallpaperInfo(user_id, &info);
511 PrefService* prefs = g_browser_process->local_state(); 511 PrefService* prefs = g_browser_process->local_state();
512 DictionaryPrefUpdate prefs_wallpapers_info_update(prefs, 512 DictionaryPrefUpdate prefs_wallpapers_info_update(prefs,
513 prefs::kUsersWallpaperInfo); 513 prefs::kUsersWallpaperInfo);
514 prefs_wallpapers_info_update->RemoveWithoutPathExpansion(email, NULL); 514 prefs_wallpapers_info_update->RemoveWithoutPathExpansion(user_id, NULL);
515 DeleteUserWallpapers(email, info.file); 515 DeleteUserWallpapers(user_id, info.file);
516 } 516 }
517 517
518 bool WallpaperManager::ResizeWallpaper( 518 bool WallpaperManager::ResizeWallpaper(
519 const UserImage& wallpaper, 519 const UserImage& wallpaper,
520 ash::WallpaperLayout layout, 520 ash::WallpaperLayout layout,
521 int preferred_width, 521 int preferred_width,
522 int preferred_height, 522 int preferred_height,
523 scoped_refptr<base::RefCountedBytes>* output) { 523 scoped_refptr<base::RefCountedBytes>* output) {
524 DCHECK(BrowserThread::GetBlockingPool()-> 524 DCHECK(BrowserThread::GetBlockingPool()->
525 IsRunningSequenceOnCurrentThread(sequence_token_)); 525 IsRunningSequenceOnCurrentThread(sequence_token_));
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 wallpaper_info_dict->SetInteger(kNewWallpaperLayoutNodeName, info.layout); 714 wallpaper_info_dict->SetInteger(kNewWallpaperLayoutNodeName, info.layout);
715 wallpaper_info_dict->SetInteger(kNewWallpaperTypeNodeName, info.type); 715 wallpaper_info_dict->SetInteger(kNewWallpaperTypeNodeName, info.type);
716 wallpaper_update->SetWithoutPathExpansion(user_id, wallpaper_info_dict); 716 wallpaper_update->SetWithoutPathExpansion(user_id, wallpaper_info_dict);
717 } 717 }
718 718
719 void WallpaperManager::SetLastSelectedUser( 719 void WallpaperManager::SetLastSelectedUser(
720 const std::string& last_selected_user) { 720 const std::string& last_selected_user) {
721 last_selected_user_ = last_selected_user; 721 last_selected_user_ = last_selected_user;
722 } 722 }
723 723
724 void WallpaperManager::SetUserWallpaperDelayed(const std::string& email) { 724 void WallpaperManager::SetUserWallpaperDelayed(const std::string& user_id) {
725 ScheduleSetUserWallpaper(email, true); 725 ScheduleSetUserWallpaper(user_id, true);
726 } 726 }
727 727
728 void WallpaperManager::SetUserWallpaperNow(const std::string& email) { 728 void WallpaperManager::SetUserWallpaperNow(const std::string& user_id) {
729 ScheduleSetUserWallpaper(email, false); 729 ScheduleSetUserWallpaper(user_id, false);
730 } 730 }
731 731
732 void WallpaperManager::ScheduleSetUserWallpaper(const std::string& email, 732 void WallpaperManager::ScheduleSetUserWallpaper(const std::string& user_id,
733 bool delayed) { 733 bool delayed) {
734 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 734 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
735 // Some unit tests come here without a UserManager or without a pref system. 735 // Some unit tests come here without a UserManager or without a pref system.
736 if (!UserManager::IsInitialized() || !g_browser_process->local_state()) 736 if (!UserManager::IsInitialized() || !g_browser_process->local_state())
737 return; 737 return;
738 // There is no visible background in kiosk mode. 738 // There is no visible background in kiosk mode.
739 if (UserManager::Get()->IsLoggedInAsKioskApp()) 739 if (UserManager::Get()->IsLoggedInAsKioskApp())
740 return; 740 return;
741 // Guest user, regular user in ephemeral mode, or kiosk app. 741 // Guest user, regular user in ephemeral mode, or kiosk app.
742 const User* user = UserManager::Get()->FindUser(email); 742 const User* user = UserManager::Get()->FindUser(user_id);
743 if (UserManager::Get()->IsUserNonCryptohomeDataEphemeral(email) || 743 if (UserManager::Get()->IsUserNonCryptohomeDataEphemeral(user_id) ||
744 (user != NULL && user->GetType() == User::USER_TYPE_KIOSK_APP)) { 744 (user != NULL && user->GetType() == User::USER_TYPE_KIOSK_APP)) {
745 InitInitialUserWallpaper(email, false); 745 InitInitialUserWallpaper(user_id, false);
746 GetPendingWallpaper(email, delayed)->ResetSetDefaultWallpaper(); 746 GetPendingWallpaper(user_id, delayed)->ResetSetDefaultWallpaper();
747 return; 747 return;
748 } 748 }
749 749
750 if (!UserManager::Get()->IsKnownUser(email)) 750 if (!UserManager::Get()->IsKnownUser(user_id))
751 return; 751 return;
752 752
753 SetLastSelectedUser(email); 753 SetLastSelectedUser(user_id);
754 754
755 WallpaperInfo info; 755 WallpaperInfo info;
756 756
757 if (!GetUserWallpaperInfo(email, &info)) { 757 if (!GetUserWallpaperInfo(user_id, &info)) {
758 InitInitialUserWallpaper(email, true); 758 InitInitialUserWallpaper(user_id, true);
759 GetUserWallpaperInfo(email, &info); 759 GetUserWallpaperInfo(user_id, &info);
760 } 760 }
761 761
762 gfx::ImageSkia user_wallpaper; 762 gfx::ImageSkia user_wallpaper;
763 current_user_wallpaper_info_ = info; 763 current_user_wallpaper_info_ = info;
764 if (GetWallpaperFromCache(email, &user_wallpaper)) { 764 if (GetWallpaperFromCache(user_id, &user_wallpaper)) {
765 GetPendingWallpaper(email, delayed)-> 765 GetPendingWallpaper(user_id, delayed)
766 ResetSetWallpaperImage(user_wallpaper, info); 766 ->ResetSetWallpaperImage(user_wallpaper, info);
767 } else { 767 } else {
768 if (info.type == User::CUSTOMIZED) { 768 if (info.type == User::CUSTOMIZED) {
769 ash::WallpaperResolution resolution = 769 ash::WallpaperResolution resolution =
770 ash::Shell::GetInstance()-> 770 ash::Shell::GetInstance()->
771 desktop_background_controller()-> 771 desktop_background_controller()->
772 GetAppropriateResolution(); 772 GetAppropriateResolution();
773 const char* sub_dir = (resolution == ash::WALLPAPER_RESOLUTION_SMALL) 773 const char* sub_dir = (resolution == ash::WALLPAPER_RESOLUTION_SMALL)
774 ? kSmallWallpaperSubDir 774 ? kSmallWallpaperSubDir
775 : kLargeWallpaperSubDir; 775 : kLargeWallpaperSubDir;
776 776
777 // Wallpaper is not resized when layout is ash::WALLPAPER_LAYOUT_CENTER. 777 // Wallpaper is not resized when layout is ash::WALLPAPER_LAYOUT_CENTER.
778 // Original wallpaper should be used in this case. 778 // Original wallpaper should be used in this case.
779 // TODO(bshe): Generates cropped custom wallpaper for CENTER layout. 779 // TODO(bshe): Generates cropped custom wallpaper for CENTER layout.
780 if (info.layout == ash::WALLPAPER_LAYOUT_CENTER) 780 if (info.layout == ash::WALLPAPER_LAYOUT_CENTER)
781 sub_dir = kOriginalWallpaperSubDir; 781 sub_dir = kOriginalWallpaperSubDir;
782 base::FilePath wallpaper_path = GetCustomWallpaperDir(sub_dir); 782 base::FilePath wallpaper_path = GetCustomWallpaperDir(sub_dir);
783 wallpaper_path = wallpaper_path.Append(info.file); 783 wallpaper_path = wallpaper_path.Append(info.file);
784 if (current_wallpaper_path_ == wallpaper_path) 784 if (current_wallpaper_path_ == wallpaper_path)
785 return; 785 return;
786 current_wallpaper_path_ = wallpaper_path; 786 current_wallpaper_path_ = wallpaper_path;
787 loaded_wallpapers_++; 787 loaded_wallpapers_++;
788 788
789 GetPendingWallpaper(email, delayed)-> 789 GetPendingWallpaper(user_id, delayed)
790 ResetSetCustomWallpaper(info, wallpaper_path); 790 ->ResetSetCustomWallpaper(info, wallpaper_path);
791 return; 791 return;
792 } 792 }
793 793
794 if (info.file.empty()) { 794 if (info.file.empty()) {
795 // Uses default built-in wallpaper when file is empty. Eventually, we 795 // Uses default built-in wallpaper when file is empty. Eventually, we
796 // will only ship one built-in wallpaper in ChromeOS image. 796 // will only ship one built-in wallpaper in ChromeOS image.
797 GetPendingWallpaper(email, delayed)->ResetSetDefaultWallpaper(); 797 GetPendingWallpaper(user_id, delayed)->ResetSetDefaultWallpaper();
798 return; 798 return;
799 } 799 }
800 800
801 // Load downloaded ONLINE or converted DEFAULT wallpapers. 801 // Load downloaded ONLINE or converted DEFAULT wallpapers.
802 GetPendingWallpaper(email, delayed)->ResetLoadWallpaper(info); 802 GetPendingWallpaper(user_id, delayed)->ResetLoadWallpaper(info);
803 } 803 }
804 } 804 }
805 805
806 void WallpaperManager::SetWallpaperFromImageSkia( 806 void WallpaperManager::SetWallpaperFromImageSkia(
807 const std::string& user_id, 807 const std::string& user_id,
808 const gfx::ImageSkia& wallpaper, 808 const gfx::ImageSkia& wallpaper,
809 ash::WallpaperLayout layout) { 809 ash::WallpaperLayout layout) {
810 // There is no visible background in kiosk mode. 810 // There is no visible background in kiosk mode.
811 if (UserManager::Get()->IsLoggedInAsKioskApp()) 811 if (UserManager::Get()->IsLoggedInAsKioskApp())
812 return; 812 return;
(...skipping 27 matching lines...) Expand all
840 observers_.RemoveObserver(observer); 840 observers_.RemoveObserver(observer);
841 } 841 }
842 842
843 void WallpaperManager::NotifyAnimationFinished() { 843 void WallpaperManager::NotifyAnimationFinished() {
844 FOR_EACH_OBSERVER( 844 FOR_EACH_OBSERVER(
845 Observer, observers_, OnWallpaperAnimationFinished(last_selected_user_)); 845 Observer, observers_, OnWallpaperAnimationFinished(last_selected_user_));
846 } 846 }
847 847
848 // WallpaperManager, private: -------------------------------------------------- 848 // WallpaperManager, private: --------------------------------------------------
849 849
850 bool WallpaperManager::GetWallpaperFromCache(const std::string& email, 850 bool WallpaperManager::GetWallpaperFromCache(const std::string& user_id,
851 gfx::ImageSkia* wallpaper) { 851 gfx::ImageSkia* wallpaper) {
852 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 852 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
853 CustomWallpaperMap::const_iterator it = wallpaper_cache_.find(email); 853 CustomWallpaperMap::const_iterator it = wallpaper_cache_.find(user_id);
854 if (it != wallpaper_cache_.end()) { 854 if (it != wallpaper_cache_.end()) {
855 *wallpaper = (*it).second; 855 *wallpaper = (*it).second;
856 return true; 856 return true;
857 } 857 }
858 return false; 858 return false;
859 } 859 }
860 860
861 void WallpaperManager::CacheUsersWallpapers() { 861 void WallpaperManager::CacheUsersWallpapers() {
862 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 862 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
863 UserList users = UserManager::Get()->GetUsers(); 863 UserList users = UserManager::Get()->GetUsers();
864 864
865 if (!users.empty()) { 865 if (!users.empty()) {
866 UserList::const_iterator it = users.begin(); 866 UserList::const_iterator it = users.begin();
867 // Skip the wallpaper of first user in the list. It should have been cached. 867 // Skip the wallpaper of first user in the list. It should have been cached.
868 it++; 868 it++;
869 for (int cached = 0; 869 for (int cached = 0;
870 it != users.end() && cached < kMaxWallpapersToCache; 870 it != users.end() && cached < kMaxWallpapersToCache;
871 ++it, ++cached) { 871 ++it, ++cached) {
872 std::string user_email = (*it)->email(); 872 std::string user_id = (*it)->email();
873 CacheUserWallpaper(user_email); 873 CacheUserWallpaper(user_id);
874 } 874 }
875 } 875 }
876 } 876 }
877 877
878 void WallpaperManager::CacheUserWallpaper(const std::string& email) { 878 void WallpaperManager::CacheUserWallpaper(const std::string& user_id) {
879 if (wallpaper_cache_.find(email) != wallpaper_cache_.end()) 879 if (wallpaper_cache_.find(user_id) != wallpaper_cache_.end())
880 return; 880 return;
881 WallpaperInfo info; 881 WallpaperInfo info;
882 if (GetUserWallpaperInfo(email, &info)) { 882 if (GetUserWallpaperInfo(user_id, &info)) {
883 base::FilePath wallpaper_dir; 883 base::FilePath wallpaper_dir;
884 base::FilePath wallpaper_path; 884 base::FilePath wallpaper_path;
885 if (info.type == User::CUSTOMIZED) { 885 if (info.type == User::CUSTOMIZED) {
886 ash::WallpaperResolution resolution = ash::Shell::GetInstance()-> 886 ash::WallpaperResolution resolution = ash::Shell::GetInstance()->
887 desktop_background_controller()->GetAppropriateResolution(); 887 desktop_background_controller()->GetAppropriateResolution();
888 const char* sub_dir = (resolution == ash::WALLPAPER_RESOLUTION_SMALL) ? 888 const char* sub_dir = (resolution == ash::WALLPAPER_RESOLUTION_SMALL) ?
889 kSmallWallpaperSubDir : kLargeWallpaperSubDir; 889 kSmallWallpaperSubDir : kLargeWallpaperSubDir;
890 base::FilePath wallpaper_path = GetCustomWallpaperDir(sub_dir); 890 base::FilePath wallpaper_path = GetCustomWallpaperDir(sub_dir);
891 wallpaper_path = wallpaper_path.Append(info.file); 891 wallpaper_path = wallpaper_path.Append(info.file);
892 task_runner_->PostTask( 892 task_runner_->PostTask(
893 FROM_HERE, 893 FROM_HERE,
894 base::Bind(&WallpaperManager::GetCustomWallpaperInternal, 894 base::Bind(&WallpaperManager::GetCustomWallpaperInternal,
895 base::Unretained(this), 895 base::Unretained(this),
896 email, 896 user_id,
897 info, 897 info,
898 wallpaper_path, 898 wallpaper_path,
899 false /* do not update wallpaper */, 899 false /* do not update wallpaper */,
900 base::Passed(MovableOnDestroyCallbackHolder()))); 900 base::Passed(MovableOnDestroyCallbackHolder())));
901 return; 901 return;
902 } 902 }
903 LoadWallpaper(email, 903 LoadWallpaper(user_id,
904 info, 904 info,
905 false /* do not update wallpaper */, 905 false /* do not update wallpaper */,
906 MovableOnDestroyCallbackHolder().Pass()); 906 MovableOnDestroyCallbackHolder().Pass());
907 } 907 }
908 } 908 }
909 909
910 void WallpaperManager::ClearObsoleteWallpaperPrefs() { 910 void WallpaperManager::ClearObsoleteWallpaperPrefs() {
911 PrefService* prefs = g_browser_process->local_state(); 911 PrefService* prefs = g_browser_process->local_state();
912 DictionaryPrefUpdate wallpaper_properties_pref(prefs, 912 DictionaryPrefUpdate wallpaper_properties_pref(prefs,
913 kUserWallpapersProperties); 913 kUserWallpapersProperties);
(...skipping 21 matching lines...) Expand all
935 base::FilePath path = *it; 935 base::FilePath path = *it;
936 // Some users may still have legacy wallpapers with png extension. We need 936 // Some users may still have legacy wallpapers with png extension. We need
937 // to delete these wallpapers too. 937 // to delete these wallpapers too.
938 if (!base::DeleteFile(path, true) && 938 if (!base::DeleteFile(path, true) &&
939 !base::DeleteFile(path.AddExtension(".png"), false)) { 939 !base::DeleteFile(path.AddExtension(".png"), false)) {
940 LOG(ERROR) << "Failed to remove user wallpaper at " << path.value(); 940 LOG(ERROR) << "Failed to remove user wallpaper at " << path.value();
941 } 941 }
942 } 942 }
943 } 943 }
944 944
945 void WallpaperManager::DeleteUserWallpapers(const std::string& email, 945 void WallpaperManager::DeleteUserWallpapers(const std::string& user_id,
946 const std::string& path_to_file) { 946 const std::string& path_to_file) {
947 std::vector<base::FilePath> file_to_remove; 947 std::vector<base::FilePath> file_to_remove;
948 // Remove small user wallpaper. 948 // Remove small user wallpaper.
949 base::FilePath wallpaper_path = 949 base::FilePath wallpaper_path =
950 GetCustomWallpaperDir(kSmallWallpaperSubDir); 950 GetCustomWallpaperDir(kSmallWallpaperSubDir);
951 // Remove old directory if exists 951 // Remove old directory if exists
952 file_to_remove.push_back(wallpaper_path.Append(email)); 952 file_to_remove.push_back(wallpaper_path.Append(user_id));
953 wallpaper_path = wallpaper_path.Append(path_to_file).DirName(); 953 wallpaper_path = wallpaper_path.Append(path_to_file).DirName();
954 file_to_remove.push_back(wallpaper_path); 954 file_to_remove.push_back(wallpaper_path);
955 955
956 // Remove large user wallpaper. 956 // Remove large user wallpaper.
957 wallpaper_path = GetCustomWallpaperDir(kLargeWallpaperSubDir); 957 wallpaper_path = GetCustomWallpaperDir(kLargeWallpaperSubDir);
958 file_to_remove.push_back(wallpaper_path.Append(email)); 958 file_to_remove.push_back(wallpaper_path.Append(user_id));
959 wallpaper_path = wallpaper_path.Append(path_to_file); 959 wallpaper_path = wallpaper_path.Append(path_to_file);
960 file_to_remove.push_back(wallpaper_path); 960 file_to_remove.push_back(wallpaper_path);
961 961
962 // Remove user wallpaper thumbnail. 962 // Remove user wallpaper thumbnail.
963 wallpaper_path = GetCustomWallpaperDir(kThumbnailWallpaperSubDir); 963 wallpaper_path = GetCustomWallpaperDir(kThumbnailWallpaperSubDir);
964 file_to_remove.push_back(wallpaper_path.Append(email)); 964 file_to_remove.push_back(wallpaper_path.Append(user_id));
965 wallpaper_path = wallpaper_path.Append(path_to_file); 965 wallpaper_path = wallpaper_path.Append(path_to_file);
966 file_to_remove.push_back(wallpaper_path); 966 file_to_remove.push_back(wallpaper_path);
967 967
968 // Remove original user wallpaper. 968 // Remove original user wallpaper.
969 wallpaper_path = GetCustomWallpaperDir(kOriginalWallpaperSubDir); 969 wallpaper_path = GetCustomWallpaperDir(kOriginalWallpaperSubDir);
970 file_to_remove.push_back(wallpaper_path.Append(email)); 970 file_to_remove.push_back(wallpaper_path.Append(user_id));
971 wallpaper_path = wallpaper_path.Append(path_to_file); 971 wallpaper_path = wallpaper_path.Append(path_to_file);
972 file_to_remove.push_back(wallpaper_path); 972 file_to_remove.push_back(wallpaper_path);
973 973
974 base::WorkerPool::PostTask( 974 base::WorkerPool::PostTask(
975 FROM_HERE, 975 FROM_HERE,
976 base::Bind(&WallpaperManager::DeleteWallpaperInList, 976 base::Bind(&WallpaperManager::DeleteWallpaperInList,
977 base::Unretained(this), 977 base::Unretained(this),
978 file_to_remove), 978 file_to_remove),
979 false); 979 false);
980 } 980 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 } 1025 }
1026 1026
1027 if (!disable_boot_animation) { 1027 if (!disable_boot_animation) {
1028 // Normal boot, load user wallpaper. 1028 // Normal boot, load user wallpaper.
1029 // If normal boot animation is disabled wallpaper would be set 1029 // If normal boot animation is disabled wallpaper would be set
1030 // asynchronously once user pods are loaded. 1030 // asynchronously once user pods are loaded.
1031 SetUserWallpaperDelayed(users[0]->email()); 1031 SetUserWallpaperDelayed(users[0]->email());
1032 } 1032 }
1033 } 1033 }
1034 1034
1035 void WallpaperManager::LoadWallpaper(const std::string& email, 1035 void WallpaperManager::LoadWallpaper(const std::string& user_id,
1036 const WallpaperInfo& info, 1036 const WallpaperInfo& info,
1037 bool update_wallpaper, 1037 bool update_wallpaper,
1038 MovableOnDestroyCallbackHolder on_finish) { 1038 MovableOnDestroyCallbackHolder on_finish) {
1039 base::FilePath wallpaper_dir; 1039 base::FilePath wallpaper_dir;
1040 base::FilePath wallpaper_path; 1040 base::FilePath wallpaper_path;
1041 if (info.type == User::ONLINE) { 1041 if (info.type == User::ONLINE) {
1042 std::string file_name = GURL(info.file).ExtractFileName(); 1042 std::string file_name = GURL(info.file).ExtractFileName();
1043 ash::WallpaperResolution resolution = ash::Shell::GetInstance()-> 1043 ash::WallpaperResolution resolution = ash::Shell::GetInstance()->
1044 desktop_background_controller()->GetAppropriateResolution(); 1044 desktop_background_controller()->GetAppropriateResolution();
1045 // Only solid color wallpapers have stretch layout and they have only one 1045 // Only solid color wallpapers have stretch layout and they have only one
1046 // resolution. 1046 // resolution.
1047 if (info.layout != ash::WALLPAPER_LAYOUT_STRETCH && 1047 if (info.layout != ash::WALLPAPER_LAYOUT_STRETCH &&
1048 resolution == ash::WALLPAPER_RESOLUTION_SMALL) { 1048 resolution == ash::WALLPAPER_RESOLUTION_SMALL) {
1049 file_name = base::FilePath(file_name).InsertBeforeExtension( 1049 file_name = base::FilePath(file_name).InsertBeforeExtension(
1050 kSmallWallpaperSuffix).value(); 1050 kSmallWallpaperSuffix).value();
1051 } 1051 }
1052 CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &wallpaper_dir)); 1052 CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &wallpaper_dir));
1053 wallpaper_path = wallpaper_dir.Append(file_name); 1053 wallpaper_path = wallpaper_dir.Append(file_name);
1054 if (current_wallpaper_path_ == wallpaper_path) 1054 if (current_wallpaper_path_ == wallpaper_path)
1055 return; 1055 return;
1056 1056
1057 if (update_wallpaper) 1057 if (update_wallpaper)
1058 current_wallpaper_path_ = wallpaper_path; 1058 current_wallpaper_path_ = wallpaper_path;
1059 1059
1060 loaded_wallpapers_++; 1060 loaded_wallpapers_++;
1061 StartLoad(email, info, update_wallpaper, wallpaper_path, on_finish.Pass()); 1061 StartLoad(
1062 user_id, info, update_wallpaper, wallpaper_path, on_finish.Pass());
1062 } else if (info.type == User::DEFAULT) { 1063 } else if (info.type == User::DEFAULT) {
1063 // Default wallpapers are migrated from M21 user profiles. A code refactor 1064 // Default wallpapers are migrated from M21 user profiles. A code refactor
1064 // overlooked that case and caused these wallpapers not being loaded at all. 1065 // overlooked that case and caused these wallpapers not being loaded at all.
1065 // On some slow devices, it caused login webui not visible after upgrade to 1066 // On some slow devices, it caused login webui not visible after upgrade to
1066 // M26 from M21. See crosbug.com/38429 for details. 1067 // M26 from M21. See crosbug.com/38429 for details.
1067 base::FilePath user_data_dir; 1068 base::FilePath user_data_dir;
1068 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); 1069 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
1069 wallpaper_path = user_data_dir.Append(info.file); 1070 wallpaper_path = user_data_dir.Append(info.file);
1070 StartLoad(email, info, update_wallpaper, wallpaper_path, on_finish.Pass()); 1071 StartLoad(
1072 user_id, info, update_wallpaper, wallpaper_path, on_finish.Pass());
1071 } else { 1073 } else {
1072 // In unexpected cases, revert to default wallpaper to fail safely. See 1074 // In unexpected cases, revert to default wallpaper to fail safely. See
1073 // crosbug.com/38429. 1075 // crosbug.com/38429.
1074 LOG(ERROR) << "Wallpaper reverts to default unexpected."; 1076 LOG(ERROR) << "Wallpaper reverts to default unexpected.";
1075 DoSetDefaultWallpaper(email, on_finish.Pass()); 1077 DoSetDefaultWallpaper(user_id, on_finish.Pass());
1076 } 1078 }
1077 } 1079 }
1078 1080
1079 bool WallpaperManager::GetUserWallpaperInfo(const std::string& email, 1081 bool WallpaperManager::GetUserWallpaperInfo(const std::string& user_id,
1080 WallpaperInfo* info){ 1082 WallpaperInfo* info) {
1081 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1083 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1082 1084
1083 if (UserManager::Get()->IsUserNonCryptohomeDataEphemeral(email)) { 1085 if (UserManager::Get()->IsUserNonCryptohomeDataEphemeral(user_id)) {
1084 // Default to the values cached in memory. 1086 // Default to the values cached in memory.
1085 *info = current_user_wallpaper_info_; 1087 *info = current_user_wallpaper_info_;
1086 1088
1087 // Ephemeral users do not save anything to local state. But we have got 1089 // Ephemeral users do not save anything to local state. But we have got
1088 // wallpaper info from memory. Returns true. 1090 // wallpaper info from memory. Returns true.
1089 return true; 1091 return true;
1090 } 1092 }
1091 1093
1092 const base::DictionaryValue* user_wallpapers = 1094 const base::DictionaryValue* user_wallpapers =
1093 g_browser_process->local_state()-> 1095 g_browser_process->local_state()->
1094 GetDictionary(prefs::kUsersWallpaperInfo); 1096 GetDictionary(prefs::kUsersWallpaperInfo);
1095 const base::DictionaryValue* wallpaper_info_dict; 1097 const base::DictionaryValue* wallpaper_info_dict;
1096 if (user_wallpapers->GetDictionaryWithoutPathExpansion( 1098 if (user_wallpapers->GetDictionaryWithoutPathExpansion(
1097 email, &wallpaper_info_dict)) { 1099 user_id, &wallpaper_info_dict)) {
1098 info->file = ""; 1100 info->file = "";
1099 info->layout = ash::WALLPAPER_LAYOUT_CENTER_CROPPED; 1101 info->layout = ash::WALLPAPER_LAYOUT_CENTER_CROPPED;
1100 info->type = User::UNKNOWN; 1102 info->type = User::UNKNOWN;
1101 info->date = base::Time::Now().LocalMidnight(); 1103 info->date = base::Time::Now().LocalMidnight();
1102 wallpaper_info_dict->GetString(kNewWallpaperFileNodeName, &(info->file)); 1104 wallpaper_info_dict->GetString(kNewWallpaperFileNodeName, &(info->file));
1103 int temp; 1105 int temp;
1104 wallpaper_info_dict->GetInteger(kNewWallpaperLayoutNodeName, &temp); 1106 wallpaper_info_dict->GetInteger(kNewWallpaperLayoutNodeName, &temp);
1105 info->layout = static_cast<ash::WallpaperLayout>(temp); 1107 info->layout = static_cast<ash::WallpaperLayout>(temp);
1106 wallpaper_info_dict->GetInteger(kNewWallpaperTypeNodeName, &temp); 1108 wallpaper_info_dict->GetInteger(kNewWallpaperTypeNodeName, &temp);
1107 info->type = static_cast<User::WallpaperType>(temp); 1109 info->type = static_cast<User::WallpaperType>(temp);
1108 std::string date_string; 1110 std::string date_string;
1109 int64 val; 1111 int64 val;
1110 if (!(wallpaper_info_dict->GetString(kNewWallpaperDateNodeName, 1112 if (!(wallpaper_info_dict->GetString(kNewWallpaperDateNodeName,
1111 &date_string) && 1113 &date_string) &&
1112 base::StringToInt64(date_string, &val))) 1114 base::StringToInt64(date_string, &val)))
1113 val = 0; 1115 val = 0;
1114 info->date = base::Time::FromInternalValue(val); 1116 info->date = base::Time::FromInternalValue(val);
1115 return true; 1117 return true;
1116 } 1118 }
1117 1119
1118 return false; 1120 return false;
1119 } 1121 }
1120 1122
1121 void WallpaperManager::MoveCustomWallpapersOnWorker( 1123 void WallpaperManager::MoveCustomWallpapersOnWorker(
1122 const std::string& email, 1124 const std::string& user_id,
1123 const std::string& user_id_hash) { 1125 const std::string& user_id_hash) {
1124 DCHECK(BrowserThread::GetBlockingPool()-> 1126 DCHECK(BrowserThread::GetBlockingPool()->
1125 IsRunningSequenceOnCurrentThread(sequence_token_)); 1127 IsRunningSequenceOnCurrentThread(sequence_token_));
1126 if (MoveCustomWallpaperDirectory(kOriginalWallpaperSubDir, 1128 if (MoveCustomWallpaperDirectory(
1127 email, 1129 kOriginalWallpaperSubDir, user_id, user_id_hash)) {
1128 user_id_hash)) {
1129 // Consider success if the original wallpaper is moved to the new directory. 1130 // Consider success if the original wallpaper is moved to the new directory.
1130 // Original wallpaper is the fallback if the correct resolution wallpaper 1131 // Original wallpaper is the fallback if the correct resolution wallpaper
1131 // can not be found. 1132 // can not be found.
1132 BrowserThread::PostTask( 1133 BrowserThread::PostTask(
1133 BrowserThread::UI, FROM_HERE, 1134 BrowserThread::UI,
1135 FROM_HERE,
1134 base::Bind(&WallpaperManager::MoveCustomWallpapersSuccess, 1136 base::Bind(&WallpaperManager::MoveCustomWallpapersSuccess,
1135 base::Unretained(this), 1137 base::Unretained(this),
1136 email, 1138 user_id,
1137 user_id_hash)); 1139 user_id_hash));
1138 } 1140 }
1139 MoveCustomWallpaperDirectory(kLargeWallpaperSubDir, email, user_id_hash); 1141 MoveCustomWallpaperDirectory(kLargeWallpaperSubDir, user_id, user_id_hash);
1140 MoveCustomWallpaperDirectory(kSmallWallpaperSubDir, email, user_id_hash); 1142 MoveCustomWallpaperDirectory(kSmallWallpaperSubDir, user_id, user_id_hash);
1141 MoveCustomWallpaperDirectory(kThumbnailWallpaperSubDir, email, user_id_hash); 1143 MoveCustomWallpaperDirectory(
1144 kThumbnailWallpaperSubDir, user_id, user_id_hash);
1142 } 1145 }
1143 1146
1144 void WallpaperManager::MoveCustomWallpapersSuccess( 1147 void WallpaperManager::MoveCustomWallpapersSuccess(
1145 const std::string& email, 1148 const std::string& user_id,
1146 const std::string& user_id_hash) { 1149 const std::string& user_id_hash) {
1147 WallpaperInfo info; 1150 WallpaperInfo info;
1148 GetUserWallpaperInfo(email, &info); 1151 GetUserWallpaperInfo(user_id, &info);
1149 if (info.type == User::CUSTOMIZED) { 1152 if (info.type == User::CUSTOMIZED) {
1150 // New file field should include user id hash in addition to file name. 1153 // New file field should include user id hash in addition to file name.
1151 // This is needed because at login screen, user id hash is not available. 1154 // This is needed because at login screen, user id hash is not available.
1152 std::string relative_path = 1155 std::string relative_path =
1153 base::FilePath(user_id_hash).Append(info.file).value(); 1156 base::FilePath(user_id_hash).Append(info.file).value();
1154 info.file = relative_path; 1157 info.file = relative_path;
1155 bool is_persistent = 1158 bool is_persistent =
1156 !UserManager::Get()->IsUserNonCryptohomeDataEphemeral(email); 1159 !UserManager::Get()->IsUserNonCryptohomeDataEphemeral(user_id);
1157 SetUserWallpaperInfo(email, info, is_persistent); 1160 SetUserWallpaperInfo(user_id, info, is_persistent);
1158 } 1161 }
1159 } 1162 }
1160 1163
1161 void WallpaperManager::MoveLoggedInUserCustomWallpaper() { 1164 void WallpaperManager::MoveLoggedInUserCustomWallpaper() {
1162 const User* logged_in_user = UserManager::Get()->GetLoggedInUser(); 1165 const User* logged_in_user = UserManager::Get()->GetLoggedInUser();
1163 task_runner_->PostTask( 1166 task_runner_->PostTask(
1164 FROM_HERE, 1167 FROM_HERE,
1165 base::Bind(&WallpaperManager::MoveCustomWallpapersOnWorker, 1168 base::Bind(&WallpaperManager::MoveCustomWallpapersOnWorker,
1166 base::Unretained(this), 1169 base::Unretained(this),
1167 logged_in_user->email(), 1170 logged_in_user->email(),
1168 logged_in_user->username_hash())); 1171 logged_in_user->username_hash()));
1169 } 1172 }
1170 1173
1171 void WallpaperManager::GetCustomWallpaperInternal( 1174 void WallpaperManager::GetCustomWallpaperInternal(
1172 const std::string& email, 1175 const std::string& user_id,
1173 const WallpaperInfo& info, 1176 const WallpaperInfo& info,
1174 const base::FilePath& wallpaper_path, 1177 const base::FilePath& wallpaper_path,
1175 bool update_wallpaper, 1178 bool update_wallpaper,
1176 MovableOnDestroyCallbackHolder on_finish) { 1179 MovableOnDestroyCallbackHolder on_finish) {
1177 DCHECK(BrowserThread::GetBlockingPool()-> 1180 DCHECK(BrowserThread::GetBlockingPool()->
1178 IsRunningSequenceOnCurrentThread(sequence_token_)); 1181 IsRunningSequenceOnCurrentThread(sequence_token_));
1179 1182
1180 base::FilePath valid_path = wallpaper_path; 1183 base::FilePath valid_path = wallpaper_path;
1181 if (!base::PathExists(wallpaper_path)) { 1184 if (!base::PathExists(wallpaper_path)) {
1182 // Falls back on original file if the correct resoltuion file does not 1185 // Falls back on original file if the correct resoltuion file does not
1183 // exist. This may happen when the original custom wallpaper is small or 1186 // exist. This may happen when the original custom wallpaper is small or
1184 // browser shutdown before resized wallpaper saved. 1187 // browser shutdown before resized wallpaper saved.
1185 valid_path = GetCustomWallpaperDir(kOriginalWallpaperSubDir); 1188 valid_path = GetCustomWallpaperDir(kOriginalWallpaperSubDir);
1186 valid_path = valid_path.Append(info.file); 1189 valid_path = valid_path.Append(info.file);
1187 } 1190 }
1188 1191
1189 if (!base::PathExists(valid_path)) { 1192 if (!base::PathExists(valid_path)) {
1190 // Falls back to custom wallpaper that uses email as part of its file path. 1193 // Falls back to custom wallpaper that uses email as part of its file path.
1191 // Note that email is used instead of user_id_hash here. 1194 // Note that email is used instead of user_id_hash here.
1192 valid_path = GetCustomWallpaperPath(kOriginalWallpaperSubDir, email, 1195 valid_path =
1193 info.file); 1196 GetCustomWallpaperPath(kOriginalWallpaperSubDir, user_id, info.file);
1194 } 1197 }
1195 1198
1196 if (!base::PathExists(valid_path)) { 1199 if (!base::PathExists(valid_path)) {
1197 LOG(ERROR) << "Failed to load previously selected custom wallpaper. " << 1200 LOG(ERROR) << "Failed to load previously selected custom wallpaper. " <<
1198 "Fallback to default wallpaper"; 1201 "Fallback to default wallpaper";
1199 BrowserThread::PostTask(BrowserThread::UI, 1202 BrowserThread::PostTask(BrowserThread::UI,
1200 FROM_HERE, 1203 FROM_HERE,
1201 base::Bind(&WallpaperManager::DoSetDefaultWallpaper, 1204 base::Bind(&WallpaperManager::DoSetDefaultWallpaper,
1202 base::Unretained(this), 1205 base::Unretained(this),
1203 email, 1206 user_id,
1204 base::Passed(on_finish.Pass()))); 1207 base::Passed(on_finish.Pass())));
1205 } else { 1208 } else {
1206 BrowserThread::PostTask(BrowserThread::UI, 1209 BrowserThread::PostTask(BrowserThread::UI,
1207 FROM_HERE, 1210 FROM_HERE,
1208 base::Bind(&WallpaperManager::StartLoad, 1211 base::Bind(&WallpaperManager::StartLoad,
1209 base::Unretained(this), 1212 base::Unretained(this),
1210 email, 1213 user_id,
1211 info, 1214 info,
1212 update_wallpaper, 1215 update_wallpaper,
1213 valid_path, 1216 valid_path,
1214 base::Passed(on_finish.Pass()))); 1217 base::Passed(on_finish.Pass())));
1215 } 1218 }
1216 } 1219 }
1217 1220
1218 void WallpaperManager::OnWallpaperDecoded( 1221 void WallpaperManager::OnWallpaperDecoded(
1219 const std::string& email, 1222 const std::string& user_id,
1220 ash::WallpaperLayout layout, 1223 ash::WallpaperLayout layout,
1221 bool update_wallpaper, 1224 bool update_wallpaper,
1222 MovableOnDestroyCallbackHolder on_finish, 1225 MovableOnDestroyCallbackHolder on_finish,
1223 const UserImage& wallpaper) { 1226 const UserImage& wallpaper) {
1224 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1227 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1225 TRACE_EVENT_ASYNC_END0("ui", "LoadAndDecodeWallpaper", this); 1228 TRACE_EVENT_ASYNC_END0("ui", "LoadAndDecodeWallpaper", this);
1226 1229
1227 // If decoded wallpaper is empty, we are probably failed to decode the file. 1230 // If decoded wallpaper is empty, we are probably failed to decode the file.
1228 // Use default wallpaper in this case. 1231 // Use default wallpaper in this case.
1229 if (wallpaper.image().isNull()) { 1232 if (wallpaper.image().isNull()) {
1230 // Updates user pref to default wallpaper. 1233 // Updates user pref to default wallpaper.
1231 WallpaperInfo info = { 1234 WallpaperInfo info = {
1232 "", 1235 "",
1233 ash::WALLPAPER_LAYOUT_CENTER_CROPPED, 1236 ash::WALLPAPER_LAYOUT_CENTER_CROPPED,
1234 User::DEFAULT, 1237 User::DEFAULT,
1235 base::Time::Now().LocalMidnight() 1238 base::Time::Now().LocalMidnight()
1236 }; 1239 };
1237 SetUserWallpaperInfo(email, info, true); 1240 SetUserWallpaperInfo(user_id, info, true);
1238 1241
1239 if (update_wallpaper) 1242 if (update_wallpaper)
1240 DoSetDefaultWallpaper(email, on_finish.Pass()); 1243 DoSetDefaultWallpaper(user_id, on_finish.Pass());
1241 return; 1244 return;
1242 } 1245 }
1243 1246
1244 // Only cache the user wallpaper at login screen and for multi profile users. 1247 // Only cache the user wallpaper at login screen and for multi profile users.
1245 if (!UserManager::Get()->IsUserLoggedIn() || 1248 if (!UserManager::Get()->IsUserLoggedIn() ||
1246 UserManager::IsMultipleProfilesAllowed()) { 1249 UserManager::IsMultipleProfilesAllowed()) {
1247 wallpaper_cache_[email] = wallpaper.image(); 1250 wallpaper_cache_[user_id] = wallpaper.image();
1248 } 1251 }
1249 1252
1250 if (update_wallpaper) { 1253 if (update_wallpaper) {
1251 ash::Shell::GetInstance()->desktop_background_controller()-> 1254 ash::Shell::GetInstance()->desktop_background_controller()->
1252 SetCustomWallpaper(wallpaper.image(), layout); 1255 SetCustomWallpaper(wallpaper.image(), layout);
1253 } 1256 }
1254 } 1257 }
1255 1258
1256 void WallpaperManager::ProcessCustomWallpaper( 1259 void WallpaperManager::ProcessCustomWallpaper(
1257 const std::string& user_id_hash, 1260 const std::string& user_id_hash,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 User::WALLPAPER_TYPE_COUNT); 1308 User::WALLPAPER_TYPE_COUNT);
1306 } 1309 }
1307 1310
1308 void WallpaperManager::SaveWallpaperInternal(const base::FilePath& path, 1311 void WallpaperManager::SaveWallpaperInternal(const base::FilePath& path,
1309 const char* data, 1312 const char* data,
1310 int size) { 1313 int size) {
1311 int written_bytes = file_util::WriteFile(path, data, size); 1314 int written_bytes = file_util::WriteFile(path, data, size);
1312 DCHECK(written_bytes == size); 1315 DCHECK(written_bytes == size);
1313 } 1316 }
1314 1317
1315 void WallpaperManager::StartLoad(const std::string& email, 1318 void WallpaperManager::StartLoad(const std::string& user_id,
1316 const WallpaperInfo& info, 1319 const WallpaperInfo& info,
1317 bool update_wallpaper, 1320 bool update_wallpaper,
1318 const base::FilePath& wallpaper_path, 1321 const base::FilePath& wallpaper_path,
1319 MovableOnDestroyCallbackHolder on_finish) { 1322 MovableOnDestroyCallbackHolder on_finish) {
1320 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1323 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1321 TRACE_EVENT_ASYNC_BEGIN0("ui", "LoadAndDecodeWallpaper", this); 1324 TRACE_EVENT_ASYNC_BEGIN0("ui", "LoadAndDecodeWallpaper", this);
1322 1325
1323 wallpaper_loader_->Start(wallpaper_path.value(), 1326 wallpaper_loader_->Start(wallpaper_path.value(),
1324 0, 1327 0,
1325 base::Bind(&WallpaperManager::OnWallpaperDecoded, 1328 base::Bind(&WallpaperManager::OnWallpaperDecoded,
1326 base::Unretained(this), 1329 base::Unretained(this),
1327 email, 1330 user_id,
1328 info.layout, 1331 info.layout,
1329 update_wallpaper, 1332 update_wallpaper,
1330 base::Passed(on_finish.Pass()))); 1333 base::Passed(on_finish.Pass())));
1331 } 1334 }
1332 1335
1333 void WallpaperManager::SaveLastLoadTime(const base::TimeDelta elapsed) { 1336 void WallpaperManager::SaveLastLoadTime(const base::TimeDelta elapsed) {
1334 while (last_load_times_.size() >= kLastLoadsStatsMsMaxSize) 1337 while (last_load_times_.size() >= kLastLoadsStatsMsMaxSize)
1335 last_load_times_.pop_front(); 1338 last_load_times_.pop_front();
1336 1339
1337 if (elapsed > base::TimeDelta::FromMicroseconds(0)) { 1340 if (elapsed > base::TimeDelta::FromMicroseconds(0)) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 loading_.push_back(new WallpaperManager::PendingWallpaper( 1379 loading_.push_back(new WallpaperManager::PendingWallpaper(
1377 (delayed ? GetWallpaperLoadDelay() 1380 (delayed ? GetWallpaperLoadDelay()
1378 : base::TimeDelta::FromMilliseconds(0)), 1381 : base::TimeDelta::FromMilliseconds(0)),
1379 user_id)); 1382 user_id));
1380 pending_inactive_ = loading_.back(); 1383 pending_inactive_ = loading_.back();
1381 } 1384 }
1382 return pending_inactive_; 1385 return pending_inactive_;
1383 } 1386 }
1384 1387
1385 } // namespace chromeos 1388 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wallpaper_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698