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

Side by Side Diff: components/user_manager/user_manager.h

Issue 1534173003: ChromeOS user_manager: move all KnownUser code to separate file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add empty line. Created 5 years 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
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 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"
11 #include "components/user_manager/user_manager_export.h" 11 #include "components/user_manager/user_manager_export.h"
12 #include "components/user_manager/user_type.h" 12 #include "components/user_manager/user_type.h"
13 13
14 class AccountId; 14 class AccountId;
15 class PrefService;
15 16
16 namespace base { 17 namespace base {
17 class DictionaryValue; 18 class DictionaryValue;
18 } 19 }
19 20
20 namespace chromeos { 21 namespace chromeos {
21 class ScopedUserManagerEnabler; 22 class ScopedUserManagerEnabler;
22 } 23 }
23 24
24 namespace user_manager { 25 namespace user_manager {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 309
309 virtual void NotifyLocalStateChanged() = 0; 310 virtual void NotifyLocalStateChanged() = 0;
310 311
311 // Changes the child status and notifies observers. 312 // Changes the child status and notifies observers.
312 virtual void ChangeUserChildStatus(User* user, bool is_child) = 0; 313 virtual void ChangeUserChildStatus(User* user, bool is_child) = 0;
313 314
314 315
315 // Returns true if supervised users allowed. 316 // Returns true if supervised users allowed.
316 virtual bool AreSupervisedUsersAllowed() const = 0; 317 virtual bool AreSupervisedUsersAllowed() const = 0;
317 318
318 // Methods for storage/retrieval of per-user properties in Local State. 319 // Returns "Local State" PrefService instance.
319 320 virtual PrefService* GetLocalState() const = 0;
320 // Performs a lookup of properties associated with |account_id|. If found,
321 // returns |true| and fills |out_value|. |out_value| can be NULL, if
322 // only existence check is required.
323 virtual bool FindKnownUserPrefs(const AccountId& account_id,
324 const base::DictionaryValue** out_value) = 0;
325
326 // Updates (or creates) properties associated with |account_id| based
327 // on |values|. |clear| defines if existing properties are cleared (|true|)
328 // or if it is just a incremental update (|false|).
329 virtual void UpdateKnownUserPrefs(const AccountId& account_id,
330 const base::DictionaryValue& values,
331 bool clear) = 0;
332
333 // Returns true if |account_id| preference by |path| does exist,
334 // fills in |out_value|. Otherwise returns false.
335 virtual bool GetKnownUserStringPref(const AccountId& account_id,
336 const std::string& path,
337 std::string* out_value) = 0;
338
339 // Updates user's identified by |account_id| string preference |path|.
340 virtual void SetKnownUserStringPref(const AccountId& account_id,
341 const std::string& path,
342 const std::string& in_value) = 0;
343
344 // Returns true if |account_id| preference by |path| does exist,
345 // fills in |out_value|. Otherwise returns false.
346 virtual bool GetKnownUserBooleanPref(const AccountId& account_id,
347 const std::string& path,
348 bool* out_value) = 0;
349
350 // Updates user's identified by |account_id| boolean preference |path|.
351 virtual void SetKnownUserBooleanPref(const AccountId& account_id,
352 const std::string& path,
353 const bool in_value) = 0;
354
355 // Returns true if |account_id| preference by |path| does exist,
356 // fills in |out_value|. Otherwise returns false.
357 virtual bool GetKnownUserIntegerPref(const AccountId& account_id,
358 const std::string& path,
359 int* out_value) = 0;
360
361 // Updates user's identified by |account_id| integer preference |path|.
362 virtual void SetKnownUserIntegerPref(const AccountId& account_id,
363 const std::string& path,
364 const int in_value) = 0;
365
366 // This call forms full account id of a known user by email and (optionally)
367 // gaia_id.
368 // This is a temporary call while migrating to AccountId.
369 virtual AccountId GetKnownUserAccountIdImpl(const std::string& user_email,
370 const std::string& gaia_id) = 0;
371
372 // The same as above, but doesn't crash in unit_tests when Usermanager
373 // doesn't exist.
374 static AccountId GetKnownUserAccountId(const std::string& user_email,
375 const std::string& gaia_id);
376
377 // Updates |gaia_id| for user with |account_id|.
378 // TODO(alemate): Update this once AccountId contains GAIA ID
379 // (crbug.com/548926).
380 virtual void UpdateGaiaID(const AccountId& account_id,
381 const std::string& gaia_id) = 0;
382
383 // Find GAIA ID for user with |account_id|, fill in |out_value| and return
384 // true
385 // if GAIA ID was found or false otherwise.
386 // TODO(antrim): Update this once AccountId contains GAIA ID
387 // (crbug.com/548926).
388 virtual bool FindGaiaID(const AccountId& account_id,
389 std::string* out_value) = 0;
390
391 // Saves whether the user authenticates using SAML.
392 virtual void UpdateUsingSAML(const AccountId& account_id,
393 const bool using_saml) = 0;
394
395 // Returns if SAML needs to be used for authentication of the user with
396 // |account_id|, if it is known (was set by a |UpdateUsingSaml| call).
397 // Otherwise
398 // returns false.
399 virtual bool FindUsingSAML(const AccountId& account_id) = 0;
400
401 // Setter and getter for DeviceId known user string preference.
402 virtual void SetKnownUserDeviceId(const AccountId& account_id,
403 const std::string& device_id) = 0;
404 virtual std::string GetKnownUserDeviceId(const AccountId& account_id) = 0;
405
406 // Setter and getter for GAPSCookie known user string preference.
407 virtual void SetKnownUserGAPSCookie(const AccountId& account_id,
408 const std::string& gaps_cookie) = 0;
409
410 virtual std::string GetKnownUserGAPSCookie(const AccountId& account_id) = 0;
411
412 // Saves why the user has to go through re-auth flow.
413 virtual void UpdateReauthReason(const AccountId& account_id,
414 const int reauth_reason) = 0;
415
416 // Returns the reason why the user with |account_id| has to go through the
417 // re-auth flow. Returns true if such a reason was recorded or false
418 // otherwise.
419 virtual bool FindReauthReason(const AccountId& account_id,
420 int* out_value) = 0;
421 321
422 protected: 322 protected:
423 // Sets UserManager instance. 323 // Sets UserManager instance.
424 static void SetInstance(UserManager* user_manager); 324 static void SetInstance(UserManager* user_manager);
425 325
426 // Pointer to the existing UserManager instance (if any). 326 // Pointer to the existing UserManager instance (if any).
427 // Usually is set by calling Initialize(), reset by calling Destroy(). 327 // Usually is set by calling Initialize(), reset by calling Destroy().
428 // Not owned since specific implementation of UserManager should decide on its 328 // Not owned since specific implementation of UserManager should decide on its
429 // own appropriate owner. For src/chrome implementation such place is 329 // own appropriate owner. For src/chrome implementation such place is
430 // g_browser_process->platform_part(). 330 // g_browser_process->platform_part().
431 static UserManager* instance; 331 static UserManager* instance;
432 332
433 private: 333 private:
434 friend class chromeos::ScopedUserManagerEnabler; 334 friend class chromeos::ScopedUserManagerEnabler;
435 335
436 // Same as Get() but doesn't won't crash is current instance is NULL. 336 // Same as Get() but doesn't won't crash is current instance is NULL.
437 static UserManager* GetForTesting(); 337 static UserManager* GetForTesting();
438 338
439 // Sets UserManager instance to the given |user_manager|. 339 // Sets UserManager instance to the given |user_manager|.
440 // Returns the previous value of the instance. 340 // Returns the previous value of the instance.
441 static UserManager* SetForTesting(UserManager* user_manager); 341 static UserManager* SetForTesting(UserManager* user_manager);
442 }; 342 };
443 343
444 } // namespace user_manager 344 } // namespace user_manager
445 345
446 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_ 346 #endif // COMPONENTS_USER_MANAGER_USER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698