Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(384)

Side by Side Diff: chrome/browser/chromeos/background/ash_user_wallpaper_delegate.cc

Issue 13495003: Add LoginState class to src/chromeos/login (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Elim LOGGED_IN_LOCKED Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 LoginState::LoggedInUserType user_type =
88 LoginState::Get()->GetLoggedInUserType();
89 if (user_type == LoginState::LOGGED_IN_USER_REGULAR ||
90 user_type == LoginState::LOGGED_IN_USER_OWNER ||
91 user_type == LoginState::LOGGED_IN_USER_LOCALLY_MANAGED)
92 return true;
Nikita (slow) 2013/04/10 08:09:22 nit: add {} as condition takes more than one line.
stevenjb 2013/04/10 16:32:17 Heh. I've been going back and forth with different
93 return false;
88 } 94 }
89 95
90 virtual void OnWallpaperAnimationFinished() OVERRIDE { 96 virtual void OnWallpaperAnimationFinished() OVERRIDE {
91 content::NotificationService::current()->Notify( 97 content::NotificationService::current()->Notify(
92 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, 98 chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED,
93 content::NotificationService::AllSources(), 99 content::NotificationService::AllSources(),
94 content::NotificationService::NoDetails()); 100 content::NotificationService::NoDetails());
95 } 101 }
96 102
97 virtual void OnWallpaperBootAnimationFinished() OVERRIDE { 103 virtual void OnWallpaperBootAnimationFinished() OVERRIDE {
98 // Make sure that boot animation type is used only once. 104 // Make sure that boot animation type is used only once.
99 boot_animation_finished_ = true; 105 boot_animation_finished_ = true;
100 } 106 }
101 107
102 private: 108 private:
103 bool boot_animation_finished_; 109 bool boot_animation_finished_;
104 110
105 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate); 111 DISALLOW_COPY_AND_ASSIGN(UserWallpaperDelegate);
106 }; 112 };
107 113
108 } // namespace 114 } // namespace
109 115
110 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() { 116 ash::UserWallpaperDelegate* CreateUserWallpaperDelegate() {
111 return new chromeos::UserWallpaperDelegate(); 117 return new chromeos::UserWallpaperDelegate();
112 } 118 }
113 119
114 } // namespace chromeos 120 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698