| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 WizardController::SetZeroDelays(); | 199 WizardController::SetZeroDelays(); |
| 200 | 200 |
| 201 if (!user_manager->IsUserLoggedIn()) { | 201 if (!user_manager->IsUserLoggedIn()) { |
| 202 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 202 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 203 switches::kDisableNewOobe)) { | 203 switches::kDisableNewOobe)) { |
| 204 if (!WizardController::IsDeviceRegistered() && | 204 if (!WizardController::IsDeviceRegistered() && |
| 205 !WizardController::IsZeroDelayEnabled()) { | 205 !WizardController::IsZeroDelayEnabled()) { |
| 206 // TODO(nkostylev): Add switch to disable wallpaper transition on OOBE. | 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. | 207 // Should be used on test images so that they are not slowed down. |
| 208 ash::Shell::GetInstance()->desktop_background_controller()-> | 208 ash::Shell::GetInstance()->desktop_background_controller()-> |
| 209 SetDefaultWallpaper(kDefaultOOBEWallpaperIndex); | 209 SetDefaultWallpaper(kDefaultOOBEWallpaperIndex, false); |
| 210 } else { | 210 } else { |
| 211 bool show_users = true; | 211 bool show_users = true; |
| 212 bool result = CrosSettings::Get()->GetBoolean( | 212 bool result = CrosSettings::Get()->GetBoolean( |
| 213 kAccountsPrefShowUserNamesOnSignIn, &show_users); | 213 kAccountsPrefShowUserNamesOnSignIn, &show_users); |
| 214 DCHECK(result) << "Unable to fetch setting " | 214 DCHECK(result) << "Unable to fetch setting " |
| 215 << kAccountsPrefShowUserNamesOnSignIn; | 215 << kAccountsPrefShowUserNamesOnSignIn; |
| 216 if (!show_users) { | 216 if (!show_users) { |
| 217 ash::Shell::GetInstance()->desktop_background_controller()-> | 217 ash::Shell::GetInstance()->desktop_background_controller()-> |
| 218 SetDefaultWallpaper(ash::GetSolidColorIndex()); | 218 SetDefaultWallpaper(ash::GetSolidColorIndex(), false); |
| 219 } | 219 } |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 return; | 222 return; |
| 223 } | 223 } |
| 224 SetUserWallpaper(user_manager->GetLoggedInUser().email()); | 224 SetUserWallpaper(user_manager->GetLoggedInUser().email()); |
| 225 } | 225 } |
| 226 | 226 |
| 227 void WallpaperManager::Observe(int type, | 227 void WallpaperManager::Observe(int type, |
| 228 const content::NotificationSource& source, | 228 const content::NotificationSource& source, |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 current_user_wallpaper_index_ = ash::GetDefaultWallpaperIndex(); | 300 current_user_wallpaper_index_ = ash::GetDefaultWallpaperIndex(); |
| 301 SaveUserWallpaperProperties(username, | 301 SaveUserWallpaperProperties(username, |
| 302 current_user_wallpaper_type_, | 302 current_user_wallpaper_type_, |
| 303 current_user_wallpaper_index_); | 303 current_user_wallpaper_index_); |
| 304 | 304 |
| 305 // Some browser tests do not have shell instance. And it is not necessary to | 305 // Some browser tests do not have shell instance. And it is not necessary to |
| 306 // create a wallpaper for these tests. Add HasInstance check to prevent tests | 306 // create a wallpaper for these tests. Add HasInstance check to prevent tests |
| 307 // crash and speed up the tests by avoid loading wallpaper. | 307 // crash and speed up the tests by avoid loading wallpaper. |
| 308 if (ash::Shell::HasInstance()) { | 308 if (ash::Shell::HasInstance()) { |
| 309 ash::Shell::GetInstance()->desktop_background_controller()-> | 309 ash::Shell::GetInstance()->desktop_background_controller()-> |
| 310 SetDefaultWallpaper(current_user_wallpaper_index_); | 310 SetDefaultWallpaper(current_user_wallpaper_index_, false); |
| 311 } | 311 } |
| 312 } | 312 } |
| 313 | 313 |
| 314 void WallpaperManager::SaveUserWallpaperInfo(const std::string& username, | 314 void WallpaperManager::SaveUserWallpaperInfo(const std::string& username, |
| 315 const std::string& file_name, | 315 const std::string& file_name, |
| 316 ash::WallpaperLayout layout, | 316 ash::WallpaperLayout layout, |
| 317 User::WallpaperType type) { | 317 User::WallpaperType type) { |
| 318 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 318 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 319 | 319 |
| 320 // Ephemeral users can not save data to local state. We just cache the index | 320 // Ephemeral users can not save data to local state. We just cache the index |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 // wallpaper layout. See function SaveWallpaperToLocalState(). | 359 // wallpaper layout. See function SaveWallpaperToLocalState(). |
| 360 ash::WallpaperLayout layout = static_cast<ash::WallpaperLayout>(index); | 360 ash::WallpaperLayout layout = static_cast<ash::WallpaperLayout>(index); |
| 361 ash::Shell::GetInstance()->desktop_background_controller()-> | 361 ash::Shell::GetInstance()->desktop_background_controller()-> |
| 362 SetCustomWallpaper(custom_wallpaper, layout); | 362 SetCustomWallpaper(custom_wallpaper, layout); |
| 363 } else { | 363 } else { |
| 364 FetchCustomWallpaper(email); | 364 FetchCustomWallpaper(email); |
| 365 } | 365 } |
| 366 return; | 366 return; |
| 367 } | 367 } |
| 368 ash::Shell::GetInstance()->desktop_background_controller()-> | 368 ash::Shell::GetInstance()->desktop_background_controller()-> |
| 369 SetDefaultWallpaper(index); | 369 SetDefaultWallpaper(index, false); |
| 370 SetLastSelectedUser(email); | 370 SetLastSelectedUser(email); |
| 371 } | 371 } |
| 372 | 372 |
| 373 void WallpaperManager::SetWallpaperFromImageSkia( | 373 void WallpaperManager::SetWallpaperFromImageSkia( |
| 374 const gfx::ImageSkia& wallpaper, | 374 const gfx::ImageSkia& wallpaper, |
| 375 ash::WallpaperLayout layout) { | 375 ash::WallpaperLayout layout) { |
| 376 ash::Shell::GetInstance()->desktop_background_controller()-> | 376 ash::Shell::GetInstance()->desktop_background_controller()-> |
| 377 SetCustomWallpaper(wallpaper, layout); | 377 SetCustomWallpaper(wallpaper, layout); |
| 378 } | 378 } |
| 379 | 379 |
| 380 void WallpaperManager::OnUserDeselected() { | 380 void WallpaperManager::OnUserDeselected() { |
| 381 if (!UserManager::Get()->IsUserLoggedIn()) { | 381 if (!UserManager::Get()->IsUserLoggedIn()) { |
| 382 // This will set default login wallpaper (#fefefe). | 382 // This will set default login wallpaper (#fefefe). |
| 383 ash::Shell::GetInstance()->desktop_background_controller()-> | 383 ash::Shell::GetInstance()->desktop_background_controller()-> |
| 384 SetDefaultWallpaper(ash::GetSolidColorIndex()); | 384 SetDefaultWallpaper(ash::GetSolidColorIndex(), false); |
| 385 } | 385 } |
| 386 } | 386 } |
| 387 | 387 |
| 388 void WallpaperManager::OnUserSelected(const std::string& email) { | 388 void WallpaperManager::OnUserSelected(const std::string& email) { |
| 389 SetUserWallpaper(email); | 389 SetUserWallpaper(email); |
| 390 } | 390 } |
| 391 | 391 |
| 392 // WallpaperManager, private: -------------------------------------------------- | 392 // WallpaperManager, private: -------------------------------------------------- |
| 393 | 393 |
| 394 WallpaperManager::~WallpaperManager() { | 394 WallpaperManager::~WallpaperManager() { |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 | 578 |
| 579 void WallpaperManager::SystemResumed() { | 579 void WallpaperManager::SystemResumed() { |
| 580 BatchUpdateWallpaper(); | 580 BatchUpdateWallpaper(); |
| 581 } | 581 } |
| 582 | 582 |
| 583 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { | 583 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { |
| 584 RestartTimer(); | 584 RestartTimer(); |
| 585 } | 585 } |
| 586 | 586 |
| 587 } // chromeos | 587 } // chromeos |
| OLD | NEW |