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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 static UserManager* Get(); | 51 static UserManager* Get(); |
52 | 52 |
53 // Set UserManager singleton object for test purpose only! | 53 // Set UserManager singleton object for test purpose only! |
54 static void Set(UserManager* mock); | 54 static void Set(UserManager* mock); |
55 | 55 |
56 // Registers user manager preferences. | 56 // Registers user manager preferences. |
57 static void RegisterPrefs(PrefService* local_state); | 57 static void RegisterPrefs(PrefService* local_state); |
58 | 58 |
59 virtual ~UserManager(); | 59 virtual ~UserManager(); |
60 | 60 |
61 // Returns a list of the users who have logged into this device previously. | 61 // Returns a list of users who have logged into this device previously. This |
62 // It is sorted in order of recency, with most recent at the beginning. | 62 // is sorted by last login date with the most recent user at the beginning. |
63 virtual const UserList& GetUsers() const = 0; | 63 virtual const UserList& GetUsers() const = 0; |
64 | 64 |
65 // Indicates that a user with the given email has just logged in. | 65 // Indicates that a user with the given email has just logged in. The |
66 // The persistent list will be updated accordingly. | 66 // persistent list is updated accordingly if the user is not ephemeral. |
67 virtual void UserLoggedIn(const std::string& email) = 0; | 67 virtual void UserLoggedIn(const std::string& email) = 0; |
68 | 68 |
69 // Indicates that user just logged on as the demo user. | 69 // Indicates that user just logged on as the demo user. |
70 virtual void DemoUserLoggedIn() = 0; | 70 virtual void DemoUserLoggedIn() = 0; |
71 | 71 |
72 // Indicates that user just started incognito session. | 72 // Indicates that user just started incognito session. |
73 virtual void GuestUserLoggedIn() = 0; | 73 virtual void GuestUserLoggedIn() = 0; |
74 | 74 |
75 // Removes the user from the device. Note, it will verify that the given user | 75 // Removes the user from the device. Note, it will verify that the given user |
76 // isn't the owner, so calling this method for the owner will take no effect. | 76 // isn't the owner, so calling this method for the owner will take no effect. |
77 // Note, |delegate| can be NULL. | 77 // Note, |delegate| can be NULL. |
78 virtual void RemoveUser(const std::string& email, | 78 virtual void RemoveUser(const std::string& email, |
79 RemoveUserDelegate* delegate) = 0; | 79 RemoveUserDelegate* delegate) = 0; |
80 | 80 |
81 // Removes the user from the persistent list only. Also removes the user's | 81 // Removes the user from the persistent list only. Also removes the user's |
82 // picture. | 82 // picture. |
83 virtual void RemoveUserFromList(const std::string& email) = 0; | 83 virtual void RemoveUserFromList(const std::string& email) = 0; |
84 | 84 |
85 // Returns true if given user has logged into the device before. | 85 // Returns true if a user with the given email address is found in the |
| 86 // persistent list or currently logged in as ephemeral. |
86 virtual bool IsKnownUser(const std::string& email) const = 0; | 87 virtual bool IsKnownUser(const std::string& email) const = 0; |
87 | 88 |
88 // Returns a user with given email or |NULL| if no such user exists. | 89 // Returns the user with the given email address if found in the persistent |
| 90 // list or currently logged in as ephemeral. Returns |NULL| otherwise. |
89 virtual const User* FindUser(const std::string& email) const = 0; | 91 virtual const User* FindUser(const std::string& email) const = 0; |
90 | 92 |
91 // Returns the logged-in user. | 93 // Returns the logged-in user. |
92 virtual const User& GetLoggedInUser() const = 0; | 94 virtual const User& GetLoggedInUser() const = 0; |
93 virtual User& GetLoggedInUser() = 0; | 95 virtual User& GetLoggedInUser() = 0; |
94 | 96 |
95 // Returns true if given display name is unique. | 97 // Returns true if given display name is unique. |
96 virtual bool IsDisplayNameUnique(const std::string& display_name) const = 0; | 98 virtual bool IsDisplayNameUnique(const std::string& display_name) const = 0; |
97 | 99 |
98 // Saves user's oauth token status in local state preferences. | 100 // Saves user's oauth token status in local state preferences. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // |reason| is an arbitraty string (used to report UMA histograms with | 141 // |reason| is an arbitraty string (used to report UMA histograms with |
140 // download times). | 142 // download times). |
141 virtual void DownloadProfileImage(const std::string& reason) = 0; | 143 virtual void DownloadProfileImage(const std::string& reason) = 0; |
142 | 144 |
143 // Returns true if current user is an owner. | 145 // Returns true if current user is an owner. |
144 virtual bool IsCurrentUserOwner() const = 0; | 146 virtual bool IsCurrentUserOwner() const = 0; |
145 | 147 |
146 // Returns true if current user is not existing one (hasn't signed in before). | 148 // Returns true if current user is not existing one (hasn't signed in before). |
147 virtual bool IsCurrentUserNew() const = 0; | 149 virtual bool IsCurrentUserNew() const = 0; |
148 | 150 |
| 151 // Returns true if the current user is ephemeral. |
| 152 virtual bool IsCurrentUserEphemeral() const = 0; |
| 153 |
149 // Returns true if user is signed in. | 154 // Returns true if user is signed in. |
150 virtual bool IsUserLoggedIn() const = 0; | 155 virtual bool IsUserLoggedIn() const = 0; |
151 | 156 |
152 // Returns true if we're logged in as a demo user. | 157 // Returns true if we're logged in as a demo user. |
153 virtual bool IsLoggedInAsDemoUser() const = 0; | 158 virtual bool IsLoggedInAsDemoUser() const = 0; |
154 | 159 |
155 // Returns true if we're logged in as a Guest. | 160 // Returns true if we're logged in as a Guest. |
156 virtual bool IsLoggedInAsGuest() const = 0; | 161 virtual bool IsLoggedInAsGuest() const = 0; |
157 | 162 |
158 virtual void AddObserver(Observer* obs) = 0; | 163 virtual void AddObserver(Observer* obs) = 0; |
159 virtual void RemoveObserver(Observer* obs) = 0; | 164 virtual void RemoveObserver(Observer* obs) = 0; |
160 | 165 |
161 virtual void NotifyLocalStateChanged() = 0; | 166 virtual void NotifyLocalStateChanged() = 0; |
162 | 167 |
163 // Returns the result of the last successful profile image download, if any. | 168 // Returns the result of the last successful profile image download, if any. |
164 // Otherwise, returns an empty bitmap. | 169 // Otherwise, returns an empty bitmap. |
165 virtual const SkBitmap& DownloadedProfileImage() const = 0; | 170 virtual const SkBitmap& DownloadedProfileImage() const = 0; |
166 }; | 171 }; |
167 | 172 |
168 } // namespace chromeos | 173 } // namespace chromeos |
169 | 174 |
170 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ | 175 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_MANAGER_H_ |
OLD | NEW |