OLD | NEW |
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/wallpaper_manager.h" | 5 #include "chrome/browser/chromeos/login/wallpaper_manager.h" |
6 | 6 |
7 #include "ash/desktop_background/desktop_background_controller.h" | 7 #include "ash/desktop_background/desktop_background_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 type, index, last_modification_date); | 191 type, index, last_modification_date); |
192 } | 192 } |
193 | 193 |
194 void WallpaperManager::InitializeWallpaper() { | 194 void WallpaperManager::InitializeWallpaper() { |
195 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 195 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
196 UserManager* user_manager = UserManager::Get(); | 196 UserManager* user_manager = UserManager::Get(); |
197 | 197 |
198 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) | 198 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType)) |
199 WizardController::SetZeroDelays(); | 199 WizardController::SetZeroDelays(); |
200 | 200 |
| 201 // Zero delays is also set in autotests. |
| 202 if (WizardController::IsZeroDelayEnabled()) |
| 203 return; |
| 204 |
| 205 bool disable_new_oobe = CommandLine::ForCurrentProcess()-> |
| 206 HasSwitch(switches::kDisableNewOobe); |
| 207 bool disable_boot_animation = CommandLine::ForCurrentProcess()-> |
| 208 HasSwitch(switches::kDisableBootAnimation); |
| 209 |
201 if (!user_manager->IsUserLoggedIn()) { | 210 if (!user_manager->IsUserLoggedIn()) { |
202 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 211 if (!disable_new_oobe) { |
203 switches::kDisableNewOobe)) { | 212 if (!WizardController::IsDeviceRegistered()) { |
204 if (!WizardController::IsDeviceRegistered() && | |
205 !WizardController::IsZeroDelayEnabled()) { | |
206 // TODO(nkostylev): Add switch to disable wallpaper transition on OOBE. | |
207 // Should be used on test images so that they are not slowed down. | |
208 ash::Shell::GetInstance()->desktop_background_controller()-> | 213 ash::Shell::GetInstance()->desktop_background_controller()-> |
209 SetDefaultWallpaper(kDefaultOOBEWallpaperIndex, false); | 214 SetDefaultWallpaper(kDefaultOOBEWallpaperIndex, false); |
210 } else { | 215 } else { |
211 bool show_users = true; | 216 bool show_users = true; |
212 bool result = CrosSettings::Get()->GetBoolean( | 217 bool result = CrosSettings::Get()->GetBoolean( |
213 kAccountsPrefShowUserNamesOnSignIn, &show_users); | 218 kAccountsPrefShowUserNamesOnSignIn, &show_users); |
214 DCHECK(result) << "Unable to fetch setting " | 219 DCHECK(result) << "Unable to fetch setting " |
215 << kAccountsPrefShowUserNamesOnSignIn; | 220 << kAccountsPrefShowUserNamesOnSignIn; |
216 if (!show_users) { | 221 if (!show_users) { |
| 222 // Boot into sign in form, preload default wallpaper. |
217 ash::Shell::GetInstance()->desktop_background_controller()-> | 223 ash::Shell::GetInstance()->desktop_background_controller()-> |
218 SetDefaultWallpaper(ash::GetSolidColorIndex(), false); | 224 SetDefaultWallpaper(kDefaultOOBEWallpaperIndex, false); |
| 225 } else if (!disable_boot_animation) { |
| 226 // Normal boot, load user wallpaper. |
| 227 // If normal boot animation is disabled wallpaper would be set |
| 228 // asynchronously once user pods are loaded. |
| 229 const chromeos::UserList& users = user_manager->GetUsers(); |
| 230 if (!users.empty()) { |
| 231 SetUserWallpaper(users[0]->email()); |
| 232 } else { |
| 233 ash::Shell::GetInstance()->desktop_background_controller()-> |
| 234 SetDefaultWallpaper(kDefaultOOBEWallpaperIndex, false); |
| 235 } |
219 } | 236 } |
220 } | 237 } |
221 } | 238 } |
222 return; | 239 return; |
223 } | 240 } |
224 SetUserWallpaper(user_manager->GetLoggedInUser().email()); | 241 SetUserWallpaper(user_manager->GetLoggedInUser().email()); |
225 } | 242 } |
226 | 243 |
227 void WallpaperManager::Observe(int type, | 244 void WallpaperManager::Observe(int type, |
228 const content::NotificationSource& source, | 245 const content::NotificationSource& source, |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 | 595 |
579 void WallpaperManager::SystemResumed() { | 596 void WallpaperManager::SystemResumed() { |
580 BatchUpdateWallpaper(); | 597 BatchUpdateWallpaper(); |
581 } | 598 } |
582 | 599 |
583 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { | 600 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { |
584 RestartTimer(); | 601 RestartTimer(); |
585 } | 602 } |
586 | 603 |
587 } // chromeos | 604 } // chromeos |
OLD | NEW |