| OLD | NEW |
| 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 COMPONENTS_USER_MANAGER_USER_MANAGER_H_ | 5 #ifndef COMPONENTS_USER_MANAGER_USER_MANAGER_H_ |
| 6 #define COMPONENTS_USER_MANAGER_USER_MANAGER_H_ | 6 #define COMPONENTS_USER_MANAGER_USER_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "components/user_manager/user.h" | 10 #include "components/user_manager/user.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // fills in |out_value|. Otherwise returns false. | 341 // fills in |out_value|. Otherwise returns false. |
| 342 virtual bool GetKnownUserBooleanPref(const UserID& user_id, | 342 virtual bool GetKnownUserBooleanPref(const UserID& user_id, |
| 343 const std::string& path, | 343 const std::string& path, |
| 344 bool* out_value) = 0; | 344 bool* out_value) = 0; |
| 345 | 345 |
| 346 // Updates user's identified by |user_id| boolean preference |path|. | 346 // Updates user's identified by |user_id| boolean preference |path|. |
| 347 virtual void SetKnownUserBooleanPref(const UserID& user_id, | 347 virtual void SetKnownUserBooleanPref(const UserID& user_id, |
| 348 const std::string& path, | 348 const std::string& path, |
| 349 const bool in_value) = 0; | 349 const bool in_value) = 0; |
| 350 | 350 |
| 351 // Returns true if |user_id| preference by |path| does exist, |
| 352 // fills in |out_value|. Otherwise returns false. |
| 353 virtual bool GetKnownUserIntegerPref(const UserID& user_id, |
| 354 const std::string& path, |
| 355 int* out_value) = 0; |
| 356 |
| 357 // Updates user's identified by |user_id| integer preference |path|. |
| 358 virtual void SetKnownUserIntegerPref(const UserID& user_id, |
| 359 const std::string& path, |
| 360 const int in_value) = 0; |
| 361 |
| 351 // Updates |gaia_id| for user with |user_id|. | 362 // Updates |gaia_id| for user with |user_id|. |
| 352 // TODO(antrim): Update this once UserID contains GAIA ID. | 363 // TODO(antrim): Update this once UserID contains GAIA ID. |
| 353 virtual void UpdateGaiaID(const UserID& user_id, | 364 virtual void UpdateGaiaID(const UserID& user_id, |
| 354 const std::string& gaia_id) = 0; | 365 const std::string& gaia_id) = 0; |
| 355 | 366 |
| 356 // Find GAIA ID for user with |user_id|, fill in |out_value| and return true | 367 // Find GAIA ID for user with |user_id|, fill in |out_value| and return true |
| 357 // if GAIA ID was found or false otherwise. | 368 // if GAIA ID was found or false otherwise. |
| 358 // TODO(antrim): Update this once UserID contains GAIA ID. | 369 // TODO(antrim): Update this once UserID contains GAIA ID. |
| 359 virtual bool FindGaiaID(const UserID& user_id, std::string* out_value) = 0; | 370 virtual bool FindGaiaID(const UserID& user_id, std::string* out_value) = 0; |
| 360 | 371 |
| 361 // Saves whether the user authenticates using SAML. | 372 // Saves whether the user authenticates using SAML. |
| 362 virtual void UpdateUsingSAML(const UserID& user_id, | 373 virtual void UpdateUsingSAML(const UserID& user_id, |
| 363 const bool using_saml) = 0; | 374 const bool using_saml) = 0; |
| 364 | 375 |
| 365 // Returns if SAML needs to be used for authentication of the user with | 376 // Returns if SAML needs to be used for authentication of the user with |
| 366 // |user_id|, if it is known (was set by a |UpdateUsingSaml| call). Otherwise | 377 // |user_id|, if it is known (was set by a |UpdateUsingSaml| call). Otherwise |
| 367 // returns false. | 378 // returns false. |
| 368 virtual bool FindUsingSAML(const UserID& user_id) = 0; | 379 virtual bool FindUsingSAML(const UserID& user_id) = 0; |
| 369 | 380 |
| 370 // Setter and getter for DeviceId known user string preference. | 381 // Setter and getter for DeviceId known user string preference. |
| 371 virtual void SetKnownUserDeviceId(const UserID& user_id, | 382 virtual void SetKnownUserDeviceId(const UserID& user_id, |
| 372 const std::string& device_id) = 0; | 383 const std::string& device_id) = 0; |
| 373 virtual std::string GetKnownUserDeviceId(const UserID& user_id) = 0; | 384 virtual std::string GetKnownUserDeviceId(const UserID& user_id) = 0; |
| 374 | 385 |
| 386 // Saves why the user has to go through re-auth flow. |
| 387 virtual void UpdateReauthReason(const UserID& user_id, |
| 388 const int reauth_reason) = 0; |
| 389 |
| 390 // Returns the reason why the user with |user_id| has to go through the |
| 391 // re-auth flow. Returns true if such a reason was recorded or false |
| 392 // otherwise. |
| 393 virtual bool FindReauthReason(const UserID& user_id, int* out_value) = 0; |
| 394 |
| 375 protected: | 395 protected: |
| 376 // Sets UserManager instance. | 396 // Sets UserManager instance. |
| 377 static void SetInstance(UserManager* user_manager); | 397 static void SetInstance(UserManager* user_manager); |
| 378 | 398 |
| 379 // Pointer to the existing UserManager instance (if any). | 399 // Pointer to the existing UserManager instance (if any). |
| 380 // Usually is set by calling Initialize(), reset by calling Destroy(). | 400 // Usually is set by calling Initialize(), reset by calling Destroy(). |
| 381 // Not owned since specific implementation of UserManager should decide on its | 401 // Not owned since specific implementation of UserManager should decide on its |
| 382 // own appropriate owner. For src/chrome implementation such place is | 402 // own appropriate owner. For src/chrome implementation such place is |
| 383 // g_browser_process->platform_part(). | 403 // g_browser_process->platform_part(). |
| 384 static UserManager* instance; | 404 static UserManager* instance; |
| 385 | 405 |
| 386 private: | 406 private: |
| 387 friend class chromeos::ScopedUserManagerEnabler; | 407 friend class chromeos::ScopedUserManagerEnabler; |
| 388 | 408 |
| 389 // Same as Get() but doesn't won't crash is current instance is NULL. | 409 // Same as Get() but doesn't won't crash is current instance is NULL. |
| 390 static UserManager* GetForTesting(); | 410 static UserManager* GetForTesting(); |
| 391 | 411 |
| 392 // Sets UserManager instance to the given |user_manager|. | 412 // Sets UserManager instance to the given |user_manager|. |
| 393 // Returns the previous value of the instance. | 413 // Returns the previous value of the instance. |
| 394 static UserManager* SetForTesting(UserManager* user_manager); | 414 static UserManager* SetForTesting(UserManager* user_manager); |
| 395 }; | 415 }; |
| 396 | 416 |
| 397 } // namespace user_manager | 417 } // namespace user_manager |
| 398 | 418 |
| 399 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_ | 419 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_ |
| OLD | NEW |