Chromium Code Reviews| Index: components/user_manager/known_user.h |
| diff --git a/components/user_manager/known_user.h b/components/user_manager/known_user.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..db7f17ae8192f23b01668bdc04c64d103f31a2e0 |
| --- /dev/null |
| +++ b/components/user_manager/known_user.h |
| @@ -0,0 +1,123 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_USER_MANAGER_KNOWN_USER_H_ |
| +#define COMPONENTS_USER_MANAGER_KNOWN_USER_H_ |
| + |
| +#include <string> |
| + |
| +class AccountId; |
| +class PrefRegistrySimple; |
| + |
| +namespace base { |
| +class DictionaryValue; |
| +class ListValue; |
| +class TaskRunner; |
| +} |
| + |
| +namespace user_manager { |
| +namespace known_user { |
| +// Methods for storage/retrieval of per-user properties in Local State. |
| + |
| +// Performs a lookup of properties associated with |account_id|. If found, |
| +// returns |true| and fills |out_value|. |out_value| can be NULL, if |
| +// only existence check is required. |
| +bool FindKnownUserPrefs(const AccountId& account_id, |
| + const base::DictionaryValue** out_value); |
| + |
| +// Updates (or creates) properties associated with |account_id| based |
| +// on |values|. |clear| defines if existing properties are cleared (|true|) |
| +// or if it is just a incremental update (|false|). |
| +void UpdateKnownUserPrefs(const AccountId& account_id, |
| + const base::DictionaryValue& values, |
| + bool clear); |
| + |
| +// Returns true if |account_id| preference by |path| does exist, |
| +// fills in |out_value|. Otherwise returns false. |
| +bool GetKnownUserStringPref(const AccountId& account_id, |
| + const std::string& path, |
| + std::string* out_value); |
| + |
| +// Updates user's identified by |account_id| string preference |path|. |
| +void SetKnownUserStringPref(const AccountId& account_id, |
| + const std::string& path, |
| + const std::string& in_value); |
| + |
| +// Returns true if |account_id| preference by |path| does exist, |
| +// fills in |out_value|. Otherwise returns false. |
| +bool GetKnownUserBooleanPref(const AccountId& account_id, |
| + const std::string& path, |
| + bool* out_value); |
| + |
| +// Updates user's identified by |account_id| boolean preference |path|. |
| +void SetKnownUserBooleanPref(const AccountId& account_id, |
| + const std::string& path, |
| + const bool in_value); |
| + |
| +// Returns true if |account_id| preference by |path| does exist, |
| +// fills in |out_value|. Otherwise returns false. |
| +bool GetKnownUserIntegerPref(const AccountId& account_id, |
| + const std::string& path, |
| + int* out_value); |
| + |
| +// Updates user's identified by |account_id| integer preference |path|. |
| +void SetKnownUserIntegerPref(const AccountId& account_id, |
| + const std::string& path, |
| + const int in_value); |
| + |
| +// This call forms full account id of a known user by email and (optionally) |
| +// gaia_id. |
| +// This is a temporary call while migrating to AccountId. |
| +AccountId GetKnownUserAccountId(const std::string& user_email, |
| + const std::string& gaia_id); |
| + |
| +// Updates |gaia_id| for user with |account_id|. |
| +// TODO(alemate): Update this once AccountId contains GAIA ID |
| +// (crbug.com/548926). |
| +void UpdateGaiaID(const AccountId& account_id, const std::string& gaia_id); |
| + |
| +// Find GAIA ID for user with |account_id|, fill in |out_value| and return |
| +// true |
| +// if GAIA ID was found or false otherwise. |
| +// TODO(antrim): Update this once AccountId contains GAIA ID |
| +// (crbug.com/548926). |
| +bool FindGaiaID(const AccountId& account_id, std::string* out_value); |
| + |
| +// Setter and getter for DeviceId known user string preference. |
| +void SetKnownUserDeviceId(const AccountId& account_id, |
| + const std::string& device_id); |
| +std::string GetKnownUserDeviceId(const AccountId& account_id); |
| + |
| +// Setter and getter for GAPSCookie known user string preference. |
| +void SetKnownUserGAPSCookie(const AccountId& account_id, |
| + const std::string& gaps_cookie); |
| + |
| +std::string GetKnownUserGAPSCookie(const AccountId& account_id); |
| + |
| +// Saves whether the user authenticates using SAML. |
| +void UpdateUsingSAML(const AccountId& account_id, const bool using_saml); |
| + |
| +// Returns if SAML needs to be used for authentication of the user with |
| +// |account_id|, if it is known (was set by a |UpdateUsingSaml| call). |
| +// Otherwise |
| +// returns false. |
| +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.
|
| + |
| +// Saves why the user has to go through re-auth flow. |
| +void UpdateReauthReason(const AccountId& account_id, const int reauth_reason); |
| + |
| +// Returns the reason why the user with |account_id| has to go through the |
| +// re-auth flow. Returns true if such a reason was recorded or false |
| +// otherwise. |
| +bool FindReauthReason(const AccountId& account_id, int* out_value); |
| + |
| +// Removes all user preferences associated with |account_id|. |
| +void RemoveKnownUserPrefs(const AccountId& account_id); |
| + |
| +// Register known user prefs. |
| +void RegisterPrefs(PrefRegistrySimple* registry); |
| +} |
| +} // namespace user_manager |
| + |
| +#endif // COMPONENTS_USER_MANAGER_KNOWN_USER_H_ |