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

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

Issue 141103007: Fixing valgrind problem with wallpaper animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 | « no previous file | 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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 ScheduleSetUserWallpaper(email, true); 695 ScheduleSetUserWallpaper(email, true);
696 } 696 }
697 697
698 void WallpaperManager::SetUserWallpaperNow(const std::string& email) { 698 void WallpaperManager::SetUserWallpaperNow(const std::string& email) {
699 ScheduleSetUserWallpaper(email, false); 699 ScheduleSetUserWallpaper(email, false);
700 } 700 }
701 701
702 void WallpaperManager::ScheduleSetUserWallpaper(const std::string& email, 702 void WallpaperManager::ScheduleSetUserWallpaper(const std::string& email,
703 bool delayed) { 703 bool delayed) {
704 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 704 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
705 // Some unit tests come here without a UserManager. 705 // Some unit tests come here without a UserManager or without a pref system.
706 if (!UserManager::IsInitialized()) 706 if (!UserManager::IsInitialized() || !g_browser_process->local_state())
707 return; 707 return;
708 // There is no visible background in kiosk mode. 708 // There is no visible background in kiosk mode.
709 if (UserManager::Get()->IsLoggedInAsKioskApp()) 709 if (UserManager::Get()->IsLoggedInAsKioskApp())
710 return; 710 return;
711 // Guest user, regular user in ephemeral mode, or kiosk app. 711 // Guest user, regular user in ephemeral mode, or kiosk app.
712 const User* user = UserManager::Get()->FindUser(email); 712 const User* user = UserManager::Get()->FindUser(email);
713 if (UserManager::Get()->IsUserNonCryptohomeDataEphemeral(email) || 713 if (UserManager::Get()->IsUserNonCryptohomeDataEphemeral(email) ||
714 (user != NULL && user->GetType() == User::USER_TYPE_KIOSK_APP)) { 714 (user != NULL && user->GetType() == User::USER_TYPE_KIOSK_APP)) {
715 InitInitialUserWallpaper(email, false); 715 InitInitialUserWallpaper(email, false);
716 GetPendingWallpaper(email, delayed)->ResetSetDefaultWallpaper(); 716 GetPendingWallpaper(email, delayed)->ResetSetDefaultWallpaper();
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 // crosbug.com/38429. 1029 // crosbug.com/38429.
1030 LOG(ERROR) << "Wallpaper reverts to default unexpected."; 1030 LOG(ERROR) << "Wallpaper reverts to default unexpected.";
1031 DoSetDefaultWallpaper(on_finish.Pass()); 1031 DoSetDefaultWallpaper(on_finish.Pass());
1032 } 1032 }
1033 } 1033 }
1034 1034
1035 bool WallpaperManager::GetUserWallpaperInfo(const std::string& email, 1035 bool WallpaperManager::GetUserWallpaperInfo(const std::string& email,
1036 WallpaperInfo* info){ 1036 WallpaperInfo* info){
1037 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1037 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1038 1038
1039 // Some unit tests come here with no browser local state attached. 1039 if (UserManager::Get()->IsUserNonCryptohomeDataEphemeral(email)) {
1040 if (UserManager::Get()->IsUserNonCryptohomeDataEphemeral(email) ||
1041 !g_browser_process->local_state()) {
1042 // Default to the values cached in memory. 1040 // Default to the values cached in memory.
1043 *info = current_user_wallpaper_info_; 1041 *info = current_user_wallpaper_info_;
1044 1042
1045 // Ephemeral users do not save anything to local state. But we have got 1043 // Ephemeral users do not save anything to local state. But we have got
1046 // wallpaper info from memory. Returns true. 1044 // wallpaper info from memory. Returns true.
1047 return true; 1045 return true;
1048 } 1046 }
1049 1047
1050 const base::DictionaryValue* user_wallpapers = 1048 const base::DictionaryValue* user_wallpapers =
1051 g_browser_process->local_state()-> 1049 g_browser_process->local_state()->
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 loading_.push_back(new WallpaperManager::PendingWallpaper( 1331 loading_.push_back(new WallpaperManager::PendingWallpaper(
1334 (delayed ? GetWallpaperLoadDelay() 1332 (delayed ? GetWallpaperLoadDelay()
1335 : base::TimeDelta::FromMilliseconds(0)), 1333 : base::TimeDelta::FromMilliseconds(0)),
1336 username)); 1334 username));
1337 pending_inactive_ = loading_.back(); 1335 pending_inactive_ = loading_.back();
1338 } 1336 }
1339 return pending_inactive_; 1337 return pending_inactive_;
1340 } 1338 }
1341 1339
1342 } // namespace chromeos 1340 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698