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

Side by Side Diff: chrome/browser/chromeos/login/user.h

Issue 23095006: If user profile doesn't contain language setting, default to his Google account settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 7 years, 2 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
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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 static User* CreateRegularUser(const std::string& email); 173 static User* CreateRegularUser(const std::string& email);
174 static User* CreateGuestUser(); 174 static User* CreateGuestUser();
175 static User* CreateKioskAppUser(const std::string& kiosk_app_username); 175 static User* CreateKioskAppUser(const std::string& kiosk_app_username);
176 static User* CreateLocallyManagedUser(const std::string& username); 176 static User* CreateLocallyManagedUser(const std::string& username);
177 static User* CreateRetailModeUser(); 177 static User* CreateRetailModeUser();
178 static User* CreatePublicAccountUser(const std::string& email); 178 static User* CreatePublicAccountUser(const std::string& email);
179 179
180 explicit User(const std::string& email); 180 explicit User(const std::string& email);
181 virtual ~User(); 181 virtual ~User();
182 182
183 bool is_profile_created() const {
184 return profile_is_created_;
185 }
186
187 const std::string* GetAccountLocale() const {
188 return account_locale_.get();
189 }
190
183 // Setters are private so only UserManager can call them. 191 // Setters are private so only UserManager can call them.
192 void SetAccountLocale(const std::string& raw_account_locale);
193
184 void SetImage(const UserImage& user_image, int image_index); 194 void SetImage(const UserImage& user_image, int image_index);
185 195
186 void SetImageURL(const GURL& image_url); 196 void SetImageURL(const GURL& image_url);
187 197
188 // Sets a stub image until the next |SetImage| call. |image_index| may be 198 // Sets a stub image until the next |SetImage| call. |image_index| may be
189 // one of |kExternalImageIndex| or |kProfileImageIndex|. 199 // one of |kExternalImageIndex| or |kProfileImageIndex|.
190 // If |is_loading| is |true|, that means user image is being loaded from file. 200 // If |is_loading| is |true|, that means user image is being loaded from file.
191 void SetStubImage(int image_index, bool is_loading); 201 void SetStubImage(int image_index, bool is_loading);
192 202
193 void set_oauth_token_status(OAuthTokenStatus status) { 203 void set_oauth_token_status(OAuthTokenStatus status) {
(...skipping 15 matching lines...) Expand all
209 } 219 }
210 220
211 void set_is_logged_in(bool is_logged_in) { 221 void set_is_logged_in(bool is_logged_in) {
212 is_logged_in_ = is_logged_in; 222 is_logged_in_ = is_logged_in;
213 } 223 }
214 224
215 void set_is_active(bool is_active) { 225 void set_is_active(bool is_active) {
216 is_active_ = is_active; 226 is_active_ = is_active;
217 } 227 }
218 228
229 void set_profile_is_created() {
230 profile_is_created_ = true;
231 }
232
233 // True if user has google account (not a guest or managed user).
234 bool has_gaia_account() const;
235
219 private: 236 private:
220 std::string email_; 237 std::string email_;
221 string16 display_name_; 238 string16 display_name_;
222 // The displayed user email, defaults to |email_|. 239 // The displayed user email, defaults to |email_|.
223 std::string display_email_; 240 std::string display_email_;
224 UserImage user_image_; 241 UserImage user_image_;
225 OAuthTokenStatus oauth_token_status_; 242 OAuthTokenStatus oauth_token_status_;
226 243
244 // This is set to chromeos locale if account data has been downloaded.
245 // (Or failed to download, but at least one download attempt finished).
246 // An empty string indicates error in data load, or in
247 // translation of Account locale to chromeos locale.
248 scoped_ptr<std::string> account_locale_;
249
227 // Used to identify homedir mount point. 250 // Used to identify homedir mount point.
228 std::string username_hash_; 251 std::string username_hash_;
229 252
230 // Either index of a default image for the user, |kExternalImageIndex| or 253 // Either index of a default image for the user, |kExternalImageIndex| or
231 // |kProfileImageIndex|. 254 // |kProfileImageIndex|.
232 int image_index_; 255 int image_index_;
233 256
234 // True if current user image is a stub set by a |SetStubImage| call. 257 // True if current user image is a stub set by a |SetStubImage| call.
235 bool image_is_stub_; 258 bool image_is_stub_;
236 259
237 // True if current user image is being loaded from file. 260 // True if current user image is being loaded from file.
238 bool image_is_loading_; 261 bool image_is_loading_;
239 262
240 // True if user is currently logged in in current session. 263 // True if user is currently logged in in current session.
241 bool is_logged_in_; 264 bool is_logged_in_;
242 265
243 // True if user is currently logged in and active in current session. 266 // True if user is currently logged in and active in current session.
244 bool is_active_; 267 bool is_active_;
245 268
269 // True if user Profile is created
270 bool profile_is_created_;
271
246 DISALLOW_COPY_AND_ASSIGN(User); 272 DISALLOW_COPY_AND_ASSIGN(User);
247 }; 273 };
248 274
249 // List of known users. 275 // List of known users.
250 typedef std::vector<User*> UserList; 276 typedef std::vector<User*> UserList;
251 277
252 } // namespace chromeos 278 } // namespace chromeos
253 279
254 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_ 280 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/mock_user_manager.h ('k') | chrome/browser/chromeos/login/user.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698