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

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

Issue 290483003: Tame the proliferation of UserContext constructors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_USERS_USER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_USER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_USER_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_USER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 18 matching lines...) Expand all
29 enum AuthFlow { 29 enum AuthFlow {
30 // Online authentication against GAIA. GAIA did not redirect to a SAML IdP. 30 // Online authentication against GAIA. GAIA did not redirect to a SAML IdP.
31 AUTH_FLOW_GAIA_WITHOUT_SAML, 31 AUTH_FLOW_GAIA_WITHOUT_SAML,
32 // Online authentication against GAIA. GAIA redirected to a SAML IdP. 32 // Online authentication against GAIA. GAIA redirected to a SAML IdP.
33 AUTH_FLOW_GAIA_WITH_SAML, 33 AUTH_FLOW_GAIA_WITH_SAML,
34 // Offline authentication against a cached key. 34 // Offline authentication against a cached key.
35 AUTH_FLOW_OFFLINE 35 AUTH_FLOW_OFFLINE
36 }; 36 };
37 37
38 UserContext(); 38 UserContext();
39 UserContext(const std::string& user_id, 39 UserContext(const UserContext& other);
40 const std::string& password, 40 explicit UserContext(const std::string& user_id);
41 const std::string& auth_code);
42 UserContext(const std::string& user_id,
43 const std::string& password,
44 const std::string& auth_code,
45 const std::string& user_id_hash);
46 UserContext(const std::string& user_id,
47 const std::string& password,
48 const std::string& auth_code,
49 const std::string& user_id_hash,
50 bool is_using_oauth,
51 AuthFlow auth_flow);
52 ~UserContext(); 41 ~UserContext();
42
53 bool operator==(const UserContext& context) const; 43 bool operator==(const UserContext& context) const;
54 44
55 void CopyFrom(const UserContext& other);
56
57 const std::string& GetUserID() const; 45 const std::string& GetUserID() const;
58 const std::string& GetPassword() const; 46 const std::string& GetPassword() const;
59 bool DoesNeedPasswordHashing() const; 47 bool DoesNeedPasswordHashing() const;
60 const std::string& GetKeyLabel() const; 48 const std::string& GetKeyLabel() const;
61 const std::string& GetAuthCode() const; 49 const std::string& GetAuthCode() const;
62 const std::string& GetUserIDHash() const; 50 const std::string& GetUserIDHash() const;
63 bool IsUsingOAuth() const; 51 bool IsUsingOAuth() const;
64 AuthFlow GetAuthFlow() const; 52 AuthFlow GetAuthFlow() const;
65 53
66 bool HasCredentials() const; 54 bool HasCredentials() const;
67 55
68 void SetUserID(const std::string& user_id); 56 void SetUserID(const std::string& user_id);
69 void SetPassword(const std::string& password); 57 void SetPassword(const std::string& password);
70 void SetDoesNeedPasswordHashing(bool does_need_password_hashing); 58 void SetDoesNeedPasswordHashing(bool does_need_password_hashing);
71 void SetKeyLabel(const std::string& key_label); 59 void SetKeyLabel(const std::string& key_label);
72 void SetAuthCode(const std::string& auth_code); 60 void SetAuthCode(const std::string& auth_code);
73 void SetUserIDHash(const std::string& user_id_hash); 61 void SetUserIDHash(const std::string& user_id_hash);
74 void SetIsUsingOAuth(bool is_using_oauth); 62 void SetIsUsingOAuth(bool is_using_oauth);
63 void SetAuthFlow(AuthFlow auth_flow);
64
65 void ClearSecrets();
75 66
76 private: 67 private:
77 std::string user_id_; 68 std::string user_id_;
78 std::string password_; 69 std::string password_;
79 bool does_need_password_hashing_; 70 bool does_need_password_hashing_;
80 std::string key_label_; 71 std::string key_label_;
81 std::string auth_code_; 72 std::string auth_code_;
82 std::string user_id_hash_; 73 std::string user_id_hash_;
83 bool is_using_oauth_; 74 bool is_using_oauth_;
84 AuthFlow auth_flow_; 75 AuthFlow auth_flow_;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 333
343 DISALLOW_COPY_AND_ASSIGN(User); 334 DISALLOW_COPY_AND_ASSIGN(User);
344 }; 335 };
345 336
346 // List of known users. 337 // List of known users.
347 typedef std::vector<User*> UserList; 338 typedef std::vector<User*> UserList;
348 339
349 } // namespace chromeos 340 } // namespace chromeos
350 341
351 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_USER_H_ 342 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_USER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/signin/oauth2_browsertest.cc ('k') | chrome/browser/chromeos/login/users/user.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698