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

Unified Diff: chrome/browser/chromeos/login/wallpaper_manager.cc

Issue 11968044: Fix login visual hitch on chromebook (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/wallpaper_manager.cc
diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc
index 4d816268b438a443befa612a408d080c71b33620..68106bdea81122d2b571317967a21b48b5b5e3eb 100644
--- a/chrome/browser/chromeos/login/wallpaper_manager.cc
+++ b/chrome/browser/chromeos/login/wallpaper_manager.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -98,7 +98,8 @@ WallpaperManager* WallpaperManager::Get() {
}
WallpaperManager::WallpaperManager()
- : loaded_wallpapers_(0),
+ : called_shutdown_(false),
+ loaded_wallpapers_(0),
ALLOW_THIS_IN_INITIALIZER_LIST(wallpaper_loader_(
new UserImageLoader(ImageDecoder::ROBUST_JPEG_CODEC))),
should_cache_wallpaper_(false),
@@ -119,6 +120,24 @@ WallpaperManager::WallpaperManager()
GetSequencedTaskRunnerWithShutdownBehavior(
sequence_token_,
base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
+ DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
+ system::TimezoneSettings::GetInstance()->AddObserver(this);
+ CrosSettings::Get()->AddSettingsObserver(kAccountsPrefShowUserNamesOnSignIn,
+ this);
+}
+
+WallpaperManager::~WallpaperManager() {
+ DCHECK(called_shutdown_);
+ ClearObsoleteWallpaperPrefs();
+ weak_factory_.InvalidateWeakPtrs();
+}
+
+void WallpaperManager::Shutdown() {
+ DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
+ system::TimezoneSettings::GetInstance()->RemoveObserver(this);
+ CrosSettings::Get()->RemoveSettingsObserver(
+ kAccountsPrefShowUserNamesOnSignIn, this);
+ called_shutdown_ = true;
}
// static
@@ -128,11 +147,6 @@ void WallpaperManager::RegisterPrefs(PrefServiceSimple* local_state) {
local_state->RegisterDictionaryPref(kUserWallpapersProperties);
}
-void WallpaperManager::AddObservers() {
- DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
- system::TimezoneSettings::GetInstance()->AddObserver(this);
-}
-
void WallpaperManager::EnsureLoggedInUserWallpaperLoaded() {
// Some browser tests do not have a shell instance. As no wallpaper is needed
// in these tests anyway, avoid loading one, preventing crashes and speeding
@@ -267,6 +281,13 @@ void WallpaperManager::Observe(int type,
}
break;
}
+ case chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED: {
+ if (*content::Details<const std::string>(details).ptr() ==
+ kAccountsPrefShowUserNamesOnSignIn) {
+ InitializeRegisteredDeviceWallpaper();
+ }
+ break;
+ }
default:
NOTREACHED() << "Unexpected notification " << type;
}
@@ -553,13 +574,6 @@ void WallpaperManager::UpdateWallpaper() {
// WallpaperManager, private: --------------------------------------------------
-WallpaperManager::~WallpaperManager() {
- ClearObsoleteWallpaperPrefs();
- DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
- system::TimezoneSettings::GetInstance()->RemoveObserver(this);
- weak_factory_.InvalidateWeakPtrs();
-}
-
void WallpaperManager::BatchUpdateWallpaper() {
NOTIMPLEMENTED();
}
@@ -650,12 +664,9 @@ void WallpaperManager::DeleteUserWallpapers(const std::string& email) {
}
void WallpaperManager::InitializeRegisteredDeviceWallpaper() {
- if (CrosSettingsProvider::TEMPORARILY_UNTRUSTED ==
- CrosSettings::Get()->PrepareTrustedValues(
- base::Bind(&WallpaperManager::InitializeRegisteredDeviceWallpaper,
- base::Unretained(this)))) {
+ if (UserManager::Get()->IsUserLoggedIn())
return;
- }
+
bool disable_boot_animation = CommandLine::ForCurrentProcess()->
HasSwitch(switches::kDisableBootAnimation);
bool show_users = true;

Powered by Google App Engine
This is Rietveld 408576698