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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 wallpaper_update->SetWithoutPathExpansion(username, wallpaper_properties); | 352 wallpaper_update->SetWithoutPathExpansion(username, wallpaper_properties); |
353 } | 353 } |
354 | 354 |
355 void WallpaperManager::SetLastSelectedUser( | 355 void WallpaperManager::SetLastSelectedUser( |
356 const std::string& last_selected_user) { | 356 const std::string& last_selected_user) { |
357 last_selected_user_ = last_selected_user; | 357 last_selected_user_ = last_selected_user; |
358 } | 358 } |
359 | 359 |
360 void WallpaperManager::SetUserWallpaper(const std::string& email) { | 360 void WallpaperManager::SetUserWallpaper(const std::string& email) { |
361 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 361 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 362 if (email == kGuestUser) { |
| 363 ash::Shell::GetInstance()->desktop_background_controller()-> |
| 364 SetDefaultWallpaper(ash::GetGuestWallpaperIndex(), false); |
| 365 } |
| 366 |
362 if (!UserManager::Get()->IsKnownUser(email)) | 367 if (!UserManager::Get()->IsKnownUser(email)) |
363 return; | 368 return; |
364 | 369 |
365 User::WallpaperType type; | 370 User::WallpaperType type; |
366 int index; | 371 int index; |
367 base::Time date; | 372 base::Time date; |
368 GetUserWallpaperProperties(email, &type, &index, &date); | 373 GetUserWallpaperProperties(email, &type, &index, &date); |
369 if (type == User::DAILY && date != base::Time::Now().LocalMidnight()) { | 374 if (type == User::DAILY && date != base::Time::Now().LocalMidnight()) { |
370 index = ash::GetNextWallpaperIndex(index); | 375 index = ash::GetNextWallpaperIndex(index); |
371 SaveUserWallpaperProperties(email, User::DAILY, index); | 376 SaveUserWallpaperProperties(email, User::DAILY, index); |
(...skipping 15 matching lines...) Expand all Loading... |
387 SetLastSelectedUser(email); | 392 SetLastSelectedUser(email); |
388 } | 393 } |
389 | 394 |
390 void WallpaperManager::SetWallpaperFromImageSkia( | 395 void WallpaperManager::SetWallpaperFromImageSkia( |
391 const gfx::ImageSkia& wallpaper, | 396 const gfx::ImageSkia& wallpaper, |
392 ash::WallpaperLayout layout) { | 397 ash::WallpaperLayout layout) { |
393 ash::Shell::GetInstance()->desktop_background_controller()-> | 398 ash::Shell::GetInstance()->desktop_background_controller()-> |
394 SetCustomWallpaper(wallpaper, layout); | 399 SetCustomWallpaper(wallpaper, layout); |
395 } | 400 } |
396 | 401 |
397 void WallpaperManager::OnUserDeselected() { | |
398 if (!UserManager::Get()->IsUserLoggedIn()) { | |
399 // This will set default login wallpaper (#fefefe). | |
400 ash::Shell::GetInstance()->desktop_background_controller()-> | |
401 SetDefaultWallpaper(ash::GetSolidColorIndex(), false); | |
402 } | |
403 } | |
404 | |
405 void WallpaperManager::OnUserSelected(const std::string& email) { | 402 void WallpaperManager::OnUserSelected(const std::string& email) { |
406 SetUserWallpaper(email); | 403 SetUserWallpaper(email); |
407 } | 404 } |
408 | 405 |
409 // WallpaperManager, private: -------------------------------------------------- | 406 // WallpaperManager, private: -------------------------------------------------- |
410 | 407 |
411 WallpaperManager::~WallpaperManager() { | 408 WallpaperManager::~WallpaperManager() { |
412 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 409 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
413 system::TimezoneSettings::GetInstance()->RemoveObserver(this); | 410 system::TimezoneSettings::GetInstance()->RemoveObserver(this); |
414 } | 411 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 | 592 |
596 void WallpaperManager::SystemResumed() { | 593 void WallpaperManager::SystemResumed() { |
597 BatchUpdateWallpaper(); | 594 BatchUpdateWallpaper(); |
598 } | 595 } |
599 | 596 |
600 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { | 597 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { |
601 RestartTimer(); | 598 RestartTimer(); |
602 } | 599 } |
603 | 600 |
604 } // chromeos | 601 } // chromeos |
OLD | NEW |