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

Side by Side Diff: chromeos/login/login_state.cc

Issue 450363002: Simplify LoginState methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chromeos/login/login_state.h" 5 #include "chromeos/login/login_state.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/sys_info.h" 9 #include "base/sys_info.h"
10 #include "chromeos/chromeos_switches.h" 10 #include "chromeos/chromeos_switches.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if (always_logged_in_) 85 if (always_logged_in_)
86 return true; 86 return true;
87 return logged_in_state_ == LOGGED_IN_ACTIVE; 87 return logged_in_state_ == LOGGED_IN_ACTIVE;
88 } 88 }
89 89
90 bool LoginState::IsInSafeMode() const { 90 bool LoginState::IsInSafeMode() const {
91 DCHECK(!always_logged_in_ || logged_in_state_ != LOGGED_IN_SAFE_MODE); 91 DCHECK(!always_logged_in_ || logged_in_state_ != LOGGED_IN_SAFE_MODE);
92 return logged_in_state_ == LOGGED_IN_SAFE_MODE; 92 return logged_in_state_ == LOGGED_IN_SAFE_MODE;
93 } 93 }
94 94
95 bool LoginState::IsGuestUser() const { 95 bool LoginState::IsGuestSessionUser() const {
96 if (!IsUserLoggedIn()) 96 return logged_in_user_type_ == LOGGED_IN_USER_GUEST;
97 return false; 97 }
98 switch (logged_in_user_type_) { 98
99 case LOGGED_IN_USER_NONE: 99 bool LoginState::IsPublicSessionUser() const {
100 case LOGGED_IN_USER_REGULAR: 100 return logged_in_user_type_ == LOGGED_IN_USER_PUBLIC_ACCOUNT;
101 case LOGGED_IN_USER_OWNER:
102 case LOGGED_IN_USER_SUPERVISED:
103 case LOGGED_IN_USER_KIOSK_APP:
104 return false;
105 case LOGGED_IN_USER_GUEST:
106 case LOGGED_IN_USER_RETAIL_MODE:
107 case LOGGED_IN_USER_PUBLIC_ACCOUNT:
108 return true;
109 }
110 NOTREACHED();
111 return false;
112 } 101 }
113 102
114 bool LoginState::IsKioskApp() const { 103 bool LoginState::IsKioskApp() const {
115 return logged_in_user_type_ == LoginState::LOGGED_IN_USER_KIOSK_APP; 104 return logged_in_user_type_ == LOGGED_IN_USER_KIOSK_APP;
116 } 105 }
117 106
118 bool LoginState::UserHasNetworkProfile() const { 107 bool LoginState::UserHasNetworkProfile() const {
119 if (!IsUserLoggedIn()) 108 if (!IsUserLoggedIn())
120 return false; 109 return false;
121 return logged_in_user_type_ != LOGGED_IN_USER_RETAIL_MODE && 110 return logged_in_user_type_ != LOGGED_IN_USER_RETAIL_MODE &&
122 logged_in_user_type_ != LOGGED_IN_USER_PUBLIC_ACCOUNT; 111 logged_in_user_type_ != LOGGED_IN_USER_PUBLIC_ACCOUNT;
123 } 112 }
124 113
125 bool LoginState::IsUserAuthenticated() const { 114 bool LoginState::IsUserAuthenticated() const {
(...skipping 16 matching lines...) Expand all
142 131
143 LoginState::~LoginState() { 132 LoginState::~LoginState() {
144 } 133 }
145 134
146 void LoginState::NotifyObservers() { 135 void LoginState::NotifyObservers() {
147 FOR_EACH_OBSERVER(LoginState::Observer, observer_list_, 136 FOR_EACH_OBSERVER(LoginState::Observer, observer_list_,
148 LoggedInStateChanged()); 137 LoggedInStateChanged());
149 } 138 }
150 139
151 } // namespace chromeos 140 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698