Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_USER_MANAGER_KNOWN_USER_H_ | |
| 6 #define COMPONENTS_USER_MANAGER_KNOWN_USER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 class AccountId; | |
| 11 class PrefRegistrySimple; | |
| 12 | |
| 13 namespace base { | |
| 14 class DictionaryValue; | |
| 15 class ListValue; | |
| 16 class TaskRunner; | |
| 17 } | |
| 18 | |
| 19 namespace user_manager { | |
| 20 namespace known_user { | |
| 21 // Methods for storage/retrieval of per-user properties in Local State. | |
| 22 | |
| 23 // Performs a lookup of properties associated with |account_id|. If found, | |
| 24 // returns |true| and fills |out_value|. |out_value| can be NULL, if | |
| 25 // only existence check is required. | |
| 26 bool FindKnownUserPrefs(const AccountId& account_id, | |
| 27 const base::DictionaryValue** out_value); | |
| 28 | |
| 29 // Updates (or creates) properties associated with |account_id| based | |
| 30 // on |values|. |clear| defines if existing properties are cleared (|true|) | |
| 31 // or if it is just a incremental update (|false|). | |
| 32 void UpdateKnownUserPrefs(const AccountId& account_id, | |
| 33 const base::DictionaryValue& values, | |
| 34 bool clear); | |
| 35 | |
| 36 // Returns true if |account_id| preference by |path| does exist, | |
| 37 // fills in |out_value|. Otherwise returns false. | |
| 38 bool GetKnownUserStringPref(const AccountId& account_id, | |
| 39 const std::string& path, | |
| 40 std::string* out_value); | |
| 41 | |
| 42 // Updates user's identified by |account_id| string preference |path|. | |
| 43 void SetKnownUserStringPref(const AccountId& account_id, | |
| 44 const std::string& path, | |
| 45 const std::string& in_value); | |
| 46 | |
| 47 // Returns true if |account_id| preference by |path| does exist, | |
| 48 // fills in |out_value|. Otherwise returns false. | |
| 49 bool GetKnownUserBooleanPref(const AccountId& account_id, | |
| 50 const std::string& path, | |
| 51 bool* out_value); | |
| 52 | |
| 53 // Updates user's identified by |account_id| boolean preference |path|. | |
| 54 void SetKnownUserBooleanPref(const AccountId& account_id, | |
| 55 const std::string& path, | |
| 56 const bool in_value); | |
| 57 | |
| 58 // Returns true if |account_id| preference by |path| does exist, | |
| 59 // fills in |out_value|. Otherwise returns false. | |
| 60 bool GetKnownUserIntegerPref(const AccountId& account_id, | |
| 61 const std::string& path, | |
| 62 int* out_value); | |
| 63 | |
| 64 // Updates user's identified by |account_id| integer preference |path|. | |
| 65 void SetKnownUserIntegerPref(const AccountId& account_id, | |
| 66 const std::string& path, | |
| 67 const int in_value); | |
| 68 | |
| 69 // This call forms full account id of a known user by email and (optionally) | |
| 70 // gaia_id. | |
| 71 // This is a temporary call while migrating to AccountId. | |
| 72 AccountId GetKnownUserAccountId(const std::string& user_email, | |
| 73 const std::string& gaia_id); | |
| 74 | |
| 75 // Updates |gaia_id| for user with |account_id|. | |
| 76 // TODO(alemate): Update this once AccountId contains GAIA ID | |
| 77 // (crbug.com/548926). | |
| 78 void UpdateGaiaID(const AccountId& account_id, const std::string& gaia_id); | |
| 79 | |
| 80 // Find GAIA ID for user with |account_id|, fill in |out_value| and return | |
| 81 // true | |
| 82 // if GAIA ID was found or false otherwise. | |
| 83 // TODO(antrim): Update this once AccountId contains GAIA ID | |
| 84 // (crbug.com/548926). | |
| 85 bool FindGaiaID(const AccountId& account_id, std::string* out_value); | |
| 86 | |
| 87 // Setter and getter for DeviceId known user string preference. | |
| 88 void SetKnownUserDeviceId(const AccountId& account_id, | |
| 89 const std::string& device_id); | |
| 90 std::string GetKnownUserDeviceId(const AccountId& account_id); | |
| 91 | |
| 92 // Setter and getter for GAPSCookie known user string preference. | |
| 93 void SetKnownUserGAPSCookie(const AccountId& account_id, | |
| 94 const std::string& gaps_cookie); | |
| 95 | |
| 96 std::string GetKnownUserGAPSCookie(const AccountId& account_id); | |
| 97 | |
| 98 // Saves whether the user authenticates using SAML. | |
| 99 void UpdateUsingSAML(const AccountId& account_id, const bool using_saml); | |
| 100 | |
| 101 // Returns if SAML needs to be used for authentication of the user with | |
| 102 // |account_id|, if it is known (was set by a |UpdateUsingSaml| call). | |
| 103 // Otherwise | |
| 104 // returns false. | |
| 105 bool FindUsingSAML(const AccountId& account_id); | |
|
Roger Tawa OOO till Jul 10th
2015/12/18 16:41:26
Nit: rename to IsUsingSAML() ?
Alexander Alekseev
2015/12/19 05:46:39
Done.
| |
| 106 | |
| 107 // Saves why the user has to go through re-auth flow. | |
| 108 void UpdateReauthReason(const AccountId& account_id, const int reauth_reason); | |
| 109 | |
| 110 // Returns the reason why the user with |account_id| has to go through the | |
| 111 // re-auth flow. Returns true if such a reason was recorded or false | |
| 112 // otherwise. | |
| 113 bool FindReauthReason(const AccountId& account_id, int* out_value); | |
| 114 | |
| 115 // Removes all user preferences associated with |account_id|. | |
| 116 void RemoveKnownUserPrefs(const AccountId& account_id); | |
| 117 | |
| 118 // Register known user prefs. | |
| 119 void RegisterPrefs(PrefRegistrySimple* registry); | |
| 120 } | |
| 121 } // namespace user_manager | |
| 122 | |
| 123 #endif // COMPONENTS_USER_MANAGER_KNOWN_USER_H_ | |
| OLD | NEW |