Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / chromeos / login / supervised_user_manager_impl.h
blobcbc78ed69293a77f09f087d1b632d2c85f0358a1
1 // Copyright 2013 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.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_USER_MANAGER_IMPL_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_USER_MANAGER_IMPL_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "chrome/browser/chromeos/login/managed/supervised_user_authentication.h"
13 #include "chrome/browser/chromeos/login/supervised_user_manager.h"
15 namespace chromeos {
17 class CrosSettings;
18 class UserManagerImpl;
20 // Implementation of the UserManager.
21 class SupervisedUserManagerImpl
22 : public SupervisedUserManager {
23 public:
24 virtual ~SupervisedUserManagerImpl();
26 virtual const User* CreateUserRecord(
27 const std::string& manager_id,
28 const std::string& local_user_id,
29 const std::string& sync_user_id,
30 const base::string16& display_name) OVERRIDE;
31 virtual std::string GenerateUserId() OVERRIDE;
32 virtual const User* FindByDisplayName(const base::string16& display_name) const
33 OVERRIDE;
34 virtual const User* FindBySyncId(const std::string& sync_id) const OVERRIDE;
35 virtual std::string GetUserSyncId(const std::string& user_id) const OVERRIDE;
36 virtual base::string16 GetManagerDisplayName(const std::string& user_id) const
37 OVERRIDE;
38 virtual std::string GetManagerUserId(const std::string& user_id) const
39 OVERRIDE;
40 virtual std::string GetManagerDisplayEmail(const std::string& user_id) const
41 OVERRIDE;
42 virtual void StartCreationTransaction(const base::string16& display_name) OVERRIDE;
43 virtual void SetCreationTransactionUserId(const std::string& user_id)
44 OVERRIDE;
45 virtual void CommitCreationTransaction() OVERRIDE;
46 virtual SupervisedUserAuthentication* GetAuthentication() OVERRIDE;
47 virtual void GetPasswordInformation(const std::string& user_id,
48 base::DictionaryValue* result) OVERRIDE;
49 virtual void SetPasswordInformation(
50 const std::string& user_id,
51 const base::DictionaryValue* password_info) OVERRIDE;
53 private:
54 friend class UserManager;
55 friend class UserManagerImpl;
57 explicit SupervisedUserManagerImpl(UserManagerImpl* owner);
59 // Returns true if there is non-committed user creation transaction.
60 bool HasFailedUserCreationTransaction();
62 // Attempts to clean up data that could be left from failed user creation.
63 void RollbackUserCreationTransaction();
65 void RemoveNonCryptohomeData(const std::string& user_id);
67 bool CheckForFirstRun(const std::string& user_id);
69 // Update name if this user is manager of some managed users.
70 void UpdateManagerName(const std::string& manager_id,
71 const base::string16& new_display_name);
73 bool GetUserStringValue(const std::string& user_id,
74 const char* key,
75 std::string* out_value) const;
77 void SetUserStringValue(const std::string& user_id,
78 const char* key,
79 const std::string& value);
81 bool GetUserIntegerValue(const std::string& user_id,
82 const char* key,
83 int* out_value) const;
85 void SetUserIntegerValue(const std::string& user_id,
86 const char* key,
87 const int value);
89 void CleanPref(const std::string& user_id,
90 const char* key);
92 UserManagerImpl* owner_;
94 // Interface to the signed settings store.
95 CrosSettings* cros_settings_;
97 scoped_ptr<SupervisedUserAuthentication> authentication_;
99 DISALLOW_COPY_AND_ASSIGN(SupervisedUserManagerImpl);
102 } // namespace chromeos
104 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_USER_MANAGER_IMPL_H_