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 CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_REGISTRATION_UTILI
TY_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_REGISTRATION_UTILI
TY_H_ |
6 #define CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_REGISTRATION_UTILI
TY_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_REGISTRATION_UTILI
TY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 class PrefService; | 24 class PrefService; |
25 class Profile; | 25 class Profile; |
26 class SupervisedUserRefreshTokenFetcher; | 26 class SupervisedUserRefreshTokenFetcher; |
27 class SupervisedUserRegistrationUtilityTest; | 27 class SupervisedUserRegistrationUtilityTest; |
28 class SupervisedUserSharedSettingsService; | 28 class SupervisedUserSharedSettingsService; |
29 | 29 |
30 namespace browser_sync { | 30 namespace browser_sync { |
31 class DeviceInfo; | 31 class DeviceInfo; |
32 } | 32 } |
33 | 33 |
| 34 namespace user_manager { |
| 35 class UserID; |
| 36 } |
| 37 |
34 // Structure to store registration information. | 38 // Structure to store registration information. |
35 struct SupervisedUserRegistrationInfo { | 39 struct SupervisedUserRegistrationInfo { |
36 SupervisedUserRegistrationInfo(const base::string16& name, int avatar_index); | 40 SupervisedUserRegistrationInfo(const base::string16& name, int avatar_index); |
37 ~SupervisedUserRegistrationInfo(); | 41 ~SupervisedUserRegistrationInfo(); |
38 int avatar_index; | 42 int avatar_index; |
39 base::string16 name; | 43 base::string16 name; |
40 std::string master_key; | 44 std::string master_key; |
41 std::string password_signature_key; | 45 std::string password_signature_key; |
42 std::string password_encryption_key; | 46 std::string password_encryption_key; |
43 base::DictionaryValue password_data; | 47 base::DictionaryValue password_data; |
(...skipping 11 matching lines...) Expand all Loading... |
55 // error for the custodian. | 59 // error for the custodian. |
56 typedef base::Callback<void(const GoogleServiceAuthError& /* error */, | 60 typedef base::Callback<void(const GoogleServiceAuthError& /* error */, |
57 const std::string& /* token */)> | 61 const std::string& /* token */)> |
58 RegistrationCallback; | 62 RegistrationCallback; |
59 | 63 |
60 virtual ~SupervisedUserRegistrationUtility() {} | 64 virtual ~SupervisedUserRegistrationUtility() {} |
61 | 65 |
62 // Creates SupervisedUserRegistrationUtility for a given |profile|. | 66 // Creates SupervisedUserRegistrationUtility for a given |profile|. |
63 static scoped_ptr<SupervisedUserRegistrationUtility> Create(Profile* profile); | 67 static scoped_ptr<SupervisedUserRegistrationUtility> Create(Profile* profile); |
64 | 68 |
65 static std::string GenerateNewSupervisedUserId(); | 69 static user_manager::UserID GenerateNewSupervisedUserId(); |
66 | 70 |
67 // Registers a new supervised user with the server. |supervised_user_id| is a | 71 // Registers a new supervised user with the server. |supervised_user_id| is a |
68 // new unique ID for the new supervised user. If its value is the same as that | 72 // new unique ID for the new supervised user. If its value is the same as that |
69 // of one of the existing supervised users, then the same user will be created | 73 // of one of the existing supervised users, then the same user will be created |
70 // on this machine (and if he has no avatar in sync, his avatar will be | 74 // on this machine (and if he has no avatar in sync, his avatar will be |
71 // updated). |info| contains necessary information like the display name of | 75 // updated). |info| contains necessary information like the display name of |
72 // the user and his avatar. |callback| is called with the result of the | 76 // the user and his avatar. |callback| is called with the result of the |
73 // registration. We use the info here and not the profile, because on Chrome | 77 // registration. We use the info here and not the profile, because on Chrome |
74 // OS the profile of the supervised user does not yet exist. | 78 // OS the profile of the supervised user does not yet exist. |
75 virtual void Register(const std::string& supervised_user_id, | 79 virtual void Register(const user_manager::UserID& supervised_user_id, |
76 const SupervisedUserRegistrationInfo& info, | 80 const SupervisedUserRegistrationInfo& info, |
77 const RegistrationCallback& callback) = 0; | 81 const RegistrationCallback& callback) = 0; |
78 | 82 |
79 protected: | 83 protected: |
80 SupervisedUserRegistrationUtility() {} | 84 SupervisedUserRegistrationUtility() {} |
81 | 85 |
82 private: | 86 private: |
83 friend class ScopedTestingSupervisedUserRegistrationUtility; | 87 friend class ScopedTestingSupervisedUserRegistrationUtility; |
84 friend class SupervisedUserRegistrationUtilityTest; | 88 friend class SupervisedUserRegistrationUtilityTest; |
85 | 89 |
(...skipping 15 matching lines...) Expand all Loading... |
101 class ScopedTestingSupervisedUserRegistrationUtility { | 105 class ScopedTestingSupervisedUserRegistrationUtility { |
102 public: | 106 public: |
103 // Delegates ownership of the |instance| to SupervisedUserRegistrationUtility. | 107 // Delegates ownership of the |instance| to SupervisedUserRegistrationUtility. |
104 ScopedTestingSupervisedUserRegistrationUtility( | 108 ScopedTestingSupervisedUserRegistrationUtility( |
105 SupervisedUserRegistrationUtility* instance); | 109 SupervisedUserRegistrationUtility* instance); |
106 | 110 |
107 ~ScopedTestingSupervisedUserRegistrationUtility(); | 111 ~ScopedTestingSupervisedUserRegistrationUtility(); |
108 }; | 112 }; |
109 | 113 |
110 #endif // CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_REGISTRATION_UT
ILITY_H_ | 114 #endif // CHROME_BROWSER_SUPERVISED_USER_LEGACY_SUPERVISED_USER_REGISTRATION_UT
ILITY_H_ |
OLD | NEW |