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

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

Powered by Google App Engine
This is Rietveld 408576698