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/desktop_background/user_wallpaper_delegate.h" | 7 #include "ash/desktop_background/user_wallpaper_delegate.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.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/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h" | 13 #include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h" |
14 #include "chrome/browser/chromeos/login/startup_utils.h" | 14 #include "chrome/browser/chromeos/login/startup_utils.h" |
15 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
16 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 15 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
17 #include "chrome/browser/chromeos/login/wizard_controller.h" | 16 #include "chrome/browser/chromeos/login/wizard_controller.h" |
18 #include "chromeos/chromeos_switches.h" | 17 #include "chromeos/chromeos_switches.h" |
19 #include "chromeos/login/login_state.h" | 18 #include "chromeos/login/login_state.h" |
20 #include "components/user_manager/user.h" | 19 #include "components/user_manager/user.h" |
| 20 #include "components/user_manager/user_manager.h" |
21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
22 | 22 |
23 namespace chromeos { | 23 namespace chromeos { |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 bool IsNormalWallpaperChange() { | 27 bool IsNormalWallpaperChange() { |
28 if (chromeos::LoginState::Get()->IsUserLoggedIn() || | 28 if (chromeos::LoginState::Get()->IsUserLoggedIn() || |
29 !CommandLine::ForCurrentProcess()->HasSwitch( | 29 !CommandLine::ForCurrentProcess()->HasSwitch( |
30 switches::kFirstExecAfterBoot) || | 30 switches::kFirstExecAfterBoot) || |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 // Whitelist user types that are allowed to change their wallpaper. (Guest | 100 // Whitelist user types that are allowed to change their wallpaper. (Guest |
101 // users are not, see crosbug 26900.) | 101 // users are not, see crosbug 26900.) |
102 if (user_type != LoginState::LOGGED_IN_USER_REGULAR && | 102 if (user_type != LoginState::LOGGED_IN_USER_REGULAR && |
103 user_type != LoginState::LOGGED_IN_USER_OWNER && | 103 user_type != LoginState::LOGGED_IN_USER_OWNER && |
104 user_type != LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT && | 104 user_type != LoginState::LOGGED_IN_USER_PUBLIC_ACCOUNT && |
105 user_type != LoginState::LOGGED_IN_USER_SUPERVISED) { | 105 user_type != LoginState::LOGGED_IN_USER_SUPERVISED) { |
106 return false; | 106 return false; |
107 } | 107 } |
108 const user_manager::User* user = | 108 const user_manager::User* user = |
109 chromeos::UserManager::Get()->GetActiveUser(); | 109 user_manager::UserManager::Get()->GetActiveUser(); |
110 if (!user) | 110 if (!user) |
111 return false; | 111 return false; |
112 if (chromeos::WallpaperManager::Get()->IsPolicyControlled(user->email())) | 112 if (chromeos::WallpaperManager::Get()->IsPolicyControlled(user->email())) |
113 return false; | 113 return false; |
114 return true; | 114 return true; |
115 } | 115 } |
116 | 116 |
117 virtual void OnWallpaperAnimationFinished() OVERRIDE { | 117 virtual void OnWallpaperAnimationFinished() OVERRIDE { |
118 content::NotificationService::current()->Notify( | 118 content::NotificationService::current()->Notify( |
119 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, | 119 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, |
(...skipping 15 matching lines...) Expand all Loading... |
135 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); | 135 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); |
136 }; | 136 }; |
137 | 137 |
138 } // namespace | 138 } // namespace |
139 | 139 |
140 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() { | 140 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() { |
141 return new chromeos::UserWallpaperDelegate(); | 141 return new chromeos::UserWallpaperDelegate(); |
142 } | 142 } |
143 | 143 |
144 } // namespace chromeos | 144 } // namespace chromeos |
OLD | NEW |