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