| 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/background/ash_user_wallpaper_delegate.h" | 5 #include "chrome/browser/chromeos/background/ash_user_wallpaper_delegate.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/desktop_background/user_wallpaper_delegate.h" | 8 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 9 #include "ash/wm/window_animations.h" | 9 #include "ash/wm/window_animations.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h" | 12 #include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h" |
| 13 #include "chrome/browser/chromeos/login/user_manager.h" | |
| 14 #include "chrome/browser/chromeos/login/wallpaper_manager.h" | 13 #include "chrome/browser/chromeos/login/wallpaper_manager.h" |
| 15 #include "chrome/browser/chromeos/login/wizard_controller.h" | 14 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 16 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 17 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_finder.h" | 17 #include "chrome/browser/ui/browser_finder.h" |
| 19 #include "chrome/browser/ui/chrome_pages.h" | 18 #include "chrome/browser/ui/chrome_pages.h" |
| 20 #include "chrome/common/chrome_notification_types.h" | 19 #include "chrome/common/chrome_notification_types.h" |
| 21 #include "chrome/common/chrome_switches.h" | 20 #include "chrome/common/chrome_switches.h" |
| 22 #include "chromeos/chromeos_switches.h" | 21 #include "chromeos/chromeos_switches.h" |
| 22 #include "chromeos/login/login_state.h" |
| 23 #include "content/public/browser/notification_service.h" | 23 #include "content/public/browser/notification_service.h" |
| 24 | 24 |
| 25 namespace chromeos { | 25 namespace chromeos { |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 bool IsNormalWallpaperChange() { | 29 bool IsNormalWallpaperChange() { |
| 30 if (chromeos::UserManager::Get()->IsUserLoggedIn() || | 30 if (chromeos::LoginState::Get()->IsUserLoggedIn() || |
| 31 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kFirstBoot) || | 31 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kFirstBoot) || |
| 32 WizardController::IsZeroDelayEnabled() || | 32 WizardController::IsZeroDelayEnabled() || |
| 33 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager)) { | 33 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kLoginManager)) { |
| 34 return true; | 34 return true; |
| 35 } | 35 } |
| 36 | 36 |
| 37 return false; | 37 return false; |
| 38 } | 38 } |
| 39 | 39 |
| 40 class UserWallpaperDelegate : public ash::UserWallpaperDelegate { | 40 class UserWallpaperDelegate : public ash::UserWallpaperDelegate { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 virtual void InitializeWallpaper() OVERRIDE { | 78 virtual void InitializeWallpaper() OVERRIDE { |
| 79 chromeos::WallpaperManager::Get()->InitializeWallpaper(); | 79 chromeos::WallpaperManager::Get()->InitializeWallpaper(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 virtual void OpenSetWallpaperPage() OVERRIDE { | 82 virtual void OpenSetWallpaperPage() OVERRIDE { |
| 83 wallpaper_manager_util::OpenWallpaperManager(); | 83 wallpaper_manager_util::OpenWallpaperManager(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 virtual bool CanOpenSetWallpaperPage() OVERRIDE { | 86 virtual bool CanOpenSetWallpaperPage() OVERRIDE { |
| 87 return !chromeos::UserManager::Get()->IsLoggedInAsGuest(); | 87 return LoginState::Get()->GetLoginState() != LoginState::LOGGED_IN_GUEST; |
| 88 } | 88 } |
| 89 | 89 |
| 90 virtual void OnWallpaperAnimationFinished() OVERRIDE { | 90 virtual void OnWallpaperAnimationFinished() OVERRIDE { |
| 91 content::NotificationService::current()->Notify( | 91 content::NotificationService::current()->Notify( |
| 92 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, | 92 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, |
| 93 content::NotificationService::AllSources(), | 93 content::NotificationService::AllSources(), |
| 94 content::NotificationService::NoDetails()); | 94 content::NotificationService::NoDetails()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 virtual void OnWallpaperBootAnimationFinished() OVERRIDE { | 97 virtual void OnWallpaperBootAnimationFinished() OVERRIDE { |
| 98 // Make sure that boot animation type is used only once. | 98 // Make sure that boot animation type is used only once. |
| 99 boot_animation_finished_ = true; | 99 boot_animation_finished_ = true; |
| 100 } | 100 } |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 bool boot_animation_finished_; | 103 bool boot_animation_finished_; |
| 104 | 104 |
| 105 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); | 105 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 } // namespace | 108 } // namespace |
| 109 | 109 |
| 110 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() { | 110 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() { |
| 111 return new chromeos::UserWallpaperDelegate(); | 111 return new chromeos::UserWallpaperDelegate(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 } // namespace chromeos | 114 } // namespace chromeos |
| OLD | NEW |