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

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

Issue 450363002: Simplify LoginState methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Check that retail mode is not used. 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
« no previous file with comments | « chrome/browser/metrics/perf_provider_chromeos.cc ('k') | chromeos/login/login_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROMEOS_LOGIN_LOGIN_STATE_H_ 5 #ifndef CHROMEOS_LOGIN_LOGIN_STATE_H_
6 #define CHROMEOS_LOGIN_LOGIN_STATE_H_ 6 #define CHROMEOS_LOGIN_LOGIN_STATE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/observer_list.h" 9 #include "base/observer_list.h"
10 #include "chromeos/chromeos_export.h" 10 #include "chromeos/chromeos_export.h"
11 11
12 namespace chromeos { 12 namespace chromeos {
13 13
14 // Tracks the login state of chrome, accessible to Ash and other chromeos code. 14 // Tracks the login state of chrome, accessible to Ash and other chromeos code.
15 class CHROMEOS_EXPORT LoginState { 15 class CHROMEOS_EXPORT LoginState {
16 public: 16 public:
17 enum LoggedInState { 17 enum LoggedInState {
18 LOGGED_IN_NONE, // Not logged in 18 LOGGED_IN_NONE, // Not logged in
19 LOGGED_IN_SAFE_MODE, // Not logged in and login not allowed for non-owners 19 LOGGED_IN_SAFE_MODE, // Not logged in and login not allowed for non-owners
20 LOGGED_IN_ACTIVE // A user has logged in 20 LOGGED_IN_ACTIVE // A user has logged in
21 }; 21 };
22 22
23 enum LoggedInUserType { 23 enum LoggedInUserType {
24 LOGGED_IN_USER_NONE, // User is not logged in 24 LOGGED_IN_USER_NONE, // User is not logged in
25 LOGGED_IN_USER_REGULAR, // A regular user is logged in 25 LOGGED_IN_USER_REGULAR, // A regular user is logged in
26 LOGGED_IN_USER_OWNER, // The owner of the device is logged in 26 LOGGED_IN_USER_OWNER, // The owner of the device is logged in
27 LOGGED_IN_USER_GUEST, // A guest is logged in (i.e. incognito) 27 LOGGED_IN_USER_GUEST, // A guest is logged in (i.e. incognito)
28 LOGGED_IN_USER_RETAIL_MODE, // Is in retail mode 28 LOGGED_IN_USER_RETAIL_MODE, // Is in retail mode
29 LOGGED_IN_USER_PUBLIC_ACCOUNT, // A public account is logged in 29 LOGGED_IN_USER_PUBLIC_ACCOUNT, // A user is logged in to a public session.
30 LOGGED_IN_USER_SUPERVISED, // A supervised user is logged in 30 LOGGED_IN_USER_SUPERVISED, // A supervised user is logged in
31 LOGGED_IN_USER_KIOSK_APP // Is in kiosk app mode 31 LOGGED_IN_USER_KIOSK_APP // Is in kiosk app mode
32 }; 32 };
33 33
34 class Observer { 34 class Observer {
35 public: 35 public:
36 // Called when either the login state or the logged in user type changes. 36 // Called when either the login state or the logged in user type changes.
37 virtual void LoggedInStateChanged() = 0; 37 virtual void LoggedInStateChanged() = 0;
38 38
39 protected: 39 protected:
(...skipping 25 matching lines...) Expand all
65 // Gets the logged in user type. 65 // Gets the logged in user type.
66 LoggedInUserType GetLoggedInUserType() const; 66 LoggedInUserType GetLoggedInUserType() const;
67 67
68 // Returns true if a user is considered to be logged in. 68 // Returns true if a user is considered to be logged in.
69 bool IsUserLoggedIn() const; 69 bool IsUserLoggedIn() const;
70 70
71 // Returns true if |logged_in_state_| is safe mode (i.e. the user is not yet 71 // Returns true if |logged_in_state_| is safe mode (i.e. the user is not yet
72 // logged in, and only the owner will be allowed to log in). 72 // logged in, and only the owner will be allowed to log in).
73 bool IsInSafeMode() const; 73 bool IsInSafeMode() const;
74 74
75 // Returns true if logged in and is a guest, retail, or public user. 75 // Returns true if logged in to a guest session.
76 bool IsGuestUser() const; 76 bool IsGuestSessionUser() const;
77
78 // Returns true if logged in to a public session.
79 bool IsPublicSessionUser() const;
77 80
78 // Returns true if logged in as a kiosk app. 81 // Returns true if logged in as a kiosk app.
79 bool IsKioskApp() const; 82 bool IsKioskApp() const;
80 83
81 // Whether a network profile is created for the user. 84 // Whether a network profile is created for the user.
82 bool UserHasNetworkProfile() const; 85 bool UserHasNetworkProfile() const;
83 86
84 // Returns true if the user is an authenticated user (i.e. non public account) 87 // Returns true if the user is an authenticated user (i.e. the user is not
88 // using an anonymous session like public or guest session)
85 bool IsUserAuthenticated() const; 89 bool IsUserAuthenticated() const;
86 90
87 // Returns true if the user is authenticated by logging into Google account 91 // Returns true if the user is authenticated by logging into Google account
88 // (i.e., non public nor supervised account). 92 // (i.e. not using an anonymous nor supervised session).
89 bool IsUserGaiaAuthenticated() const; 93 bool IsUserGaiaAuthenticated() const;
90 94
91 void set_always_logged_in(bool always_logged_in) { 95 void set_always_logged_in(bool always_logged_in) {
92 always_logged_in_ = always_logged_in; 96 always_logged_in_ = always_logged_in;
93 } 97 }
94 98
95 const std::string& primary_user_hash() const { return primary_user_hash_; } 99 const std::string& primary_user_hash() const { return primary_user_hash_; }
96 100
97 private: 101 private:
98 LoginState(); 102 LoginState();
(...skipping 10 matching lines...) Expand all
109 // default running on a Linux desktop without flags and test cases. To test 113 // default running on a Linux desktop without flags and test cases. To test
110 // behaviors with a specific login state, call set_always_logged_in(false). 114 // behaviors with a specific login state, call set_always_logged_in(false).
111 bool always_logged_in_; 115 bool always_logged_in_;
112 116
113 DISALLOW_COPY_AND_ASSIGN(LoginState); 117 DISALLOW_COPY_AND_ASSIGN(LoginState);
114 }; 118 };
115 119
116 } // namespace chromeos 120 } // namespace chromeos
117 121
118 #endif // CHROMEOS_LOGIN_LOGIN_STATE_H_ 122 #endif // CHROMEOS_LOGIN_LOGIN_STATE_H_
OLDNEW
« no previous file with comments | « chrome/browser/metrics/perf_provider_chromeos.cc ('k') | chromeos/login/login_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698