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

Side by Side Diff: chrome/browser/chromeos/login/supervised/supervised_user_creation_controller_new.h

Issue 393343002: Rename "managed (mode|user)" to "supervised user" (part 7) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more alphabetize (and rebase again) Created 6 years, 5 months 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 | Annotate | Revision Log
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 CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_MANAGED_USER_CREATION_CONTROLLER_N EW_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CONTRO LLER_NEW_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_MANAGED_USER_CREATION_CONTROLLER_N EW_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CONTRO LLER_NEW_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/chromeos/login/auth/extended_authenticator.h" 16 #include "chrome/browser/chromeos/login/auth/extended_authenticator.h"
17 #include "chrome/browser/chromeos/login/managed/managed_user_creation_controller .h" 17 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont roller.h"
18 #include "chrome/browser/supervised_user/supervised_user_registration_utility.h" 18 #include "chrome/browser/supervised_user/supervised_user_registration_utility.h"
19 19
20 class Profile; 20 class Profile;
21 21
22 namespace chromeos { 22 namespace chromeos {
23 23
24 class UserContext; 24 class UserContext;
25 25
26 // LMU Creation process: 26 // Supervised user creation process:
27 // 0. Manager is logged in 27 // 0. Manager is logged in
28 // 1. Generate ID for new LMU 28 // 1. Generate ID for new supervised user
29 // 2. Start "transaction" in Local State. 29 // 2. Start "transaction" in Local State.
30 // 3, Generate keys for user : master key, salt, encryption and signature keys. 30 // 3, Generate keys for user : master key, salt, encryption and signature keys.
31 // 4. Create local cryptohome (errors could arise) 31 // 4. Create local cryptohome (errors could arise)
32 // 5. Create user in cloud (errors could arise) 32 // 5. Create user in cloud (errors could arise)
33 // 6. Store cloud token in cryptohome (actually, error could arise). 33 // 6. Store cloud token in cryptohome (actually, error could arise).
34 // 7. Mark "transaction" as completed. 34 // 7. Mark "transaction" as completed.
35 // 8. End manager session. 35 // 8. End manager session.
36 class ManagedUserCreationControllerNew 36 class SupervisedUserCreationControllerNew
37 : public ManagedUserCreationController, 37 : public SupervisedUserCreationController,
38 public ExtendedAuthenticator::NewAuthStatusConsumer { 38 public ExtendedAuthenticator::NewAuthStatusConsumer {
39 public: 39 public:
40 // All UI initialization is deferred till Init() call. 40 // All UI initialization is deferred till Init() call.
41 // |Consumer| is not owned by controller, and it is expected that it wouldn't 41 // |Consumer| is not owned by controller, and it is expected that it wouldn't
42 // be deleted before ManagedUserCreationControllerNew. 42 // be deleted before SupervisedUserCreationControllerNew.
43 ManagedUserCreationControllerNew(StatusConsumer* consumer, 43 SupervisedUserCreationControllerNew(StatusConsumer* consumer,
44 const std::string& manager_id); 44 const std::string& manager_id);
45 virtual ~ManagedUserCreationControllerNew(); 45 virtual ~SupervisedUserCreationControllerNew();
46 46
47 // Returns the current locally managed user controller if it has been created. 47 // Returns the current supervised user controller if it has been created.
48 static ManagedUserCreationControllerNew* current_controller() { 48 static SupervisedUserCreationControllerNew* current_controller() {
49 return current_controller_; 49 return current_controller_;
50 } 50 }
51 51
52 // Set up controller for creating new supervised user with |display_name|, 52 // Set up controller for creating new supervised user with |display_name|,
53 // |password| and avatar indexed by |avatar_index|. StartCreation() have to 53 // |password| and avatar indexed by |avatar_index|. StartCreation() have to
54 // be called to actually start creating user. 54 // be called to actually start creating user.
55 virtual void StartCreation(const base::string16& display_name, 55 virtual void StartCreation(const base::string16& display_name,
56 const std::string& password, 56 const std::string& password,
57 int avatar_index) OVERRIDE; 57 int avatar_index) OVERRIDE;
58 58
(...skipping 19 matching lines...) Expand all
78 const std::string& master_key, 78 const std::string& master_key,
79 const base::DictionaryValue* password_data, 79 const base::DictionaryValue* password_data,
80 const std::string& encryption_key, 80 const std::string& encryption_key,
81 const std::string& signature_key) OVERRIDE; 81 const std::string& signature_key) OVERRIDE;
82 82
83 virtual void SetManagerProfile(Profile* manager_profile) OVERRIDE; 83 virtual void SetManagerProfile(Profile* manager_profile) OVERRIDE;
84 virtual Profile* GetManagerProfile() OVERRIDE; 84 virtual Profile* GetManagerProfile() OVERRIDE;
85 85
86 virtual void CancelCreation() OVERRIDE; 86 virtual void CancelCreation() OVERRIDE;
87 virtual void FinishCreation() OVERRIDE; 87 virtual void FinishCreation() OVERRIDE;
88 virtual std::string GetManagedUserId() OVERRIDE; 88 virtual std::string GetSupervisedUserId() OVERRIDE;
89 89
90 private: 90 private:
91 enum Stage { 91 enum Stage {
92 // Just initial stage. 92 // Just initial stage.
93 STAGE_INITIAL, 93 STAGE_INITIAL,
94 94
95 // Creation attempt is recoreded to allow cleanup in case of failure. 95 // Creation attempt is recoreded to allow cleanup in case of failure.
96 TRANSACTION_STARTED, 96 TRANSACTION_STARTED,
97 // Different keys are generated and public ones are stored in LocalState. 97 // Different keys are generated and public ones are stored in LocalState.
98 KEYS_GENERATED, 98 KEYS_GENERATED,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 std::string token; 138 std::string token;
139 139
140 CreationType creation_type; 140 CreationType creation_type;
141 141
142 base::DictionaryValue password_data; 142 base::DictionaryValue password_data;
143 143
144 Profile* manager_profile; 144 Profile* manager_profile;
145 scoped_ptr<SupervisedUserRegistrationUtility> registration_utility; 145 scoped_ptr<SupervisedUserRegistrationUtility> registration_utility;
146 }; 146 };
147 147
148 // ManagedUserAuthenticator::StatusConsumer overrides. 148 // SupervisedUserAuthenticator::StatusConsumer overrides.
149 virtual void OnAuthenticationFailure(ExtendedAuthenticator::AuthState error) 149 virtual void OnAuthenticationFailure(ExtendedAuthenticator::AuthState error)
150 OVERRIDE; 150 OVERRIDE;
151 151
152 // Authenticator success callbacks. 152 // Authenticator success callbacks.
153 void OnMountSuccess(const std::string& mount_hash); 153 void OnMountSuccess(const std::string& mount_hash);
154 void OnAddKeySuccess(); 154 void OnAddKeySuccess();
155 void OnKeyTransformedIfNeeded(const UserContext& user_context); 155 void OnKeyTransformedIfNeeded(const UserContext& user_context);
156 156
157 void StartCreationImpl(); 157 void StartCreationImpl();
158 158
159 // Guard timer callback. 159 // Guard timer callback.
160 void CreationTimedOut(); 160 void CreationTimedOut();
161 // SupervisedUserRegistrationUtility callback. 161 // SupervisedUserRegistrationUtility callback.
162 void RegistrationCallback(const GoogleServiceAuthError& error, 162 void RegistrationCallback(const GoogleServiceAuthError& error,
163 const std::string& token); 163 const std::string& token);
164 164
165 // Completion callback for StoreManagedUserFiles method. 165 // Completion callback for StoreSupervisedUserFiles method.
166 // Called on the UI thread. 166 // Called on the UI thread.
167 void OnManagedUserFilesStored(bool success); 167 void OnSupervisedUserFilesStored(bool success);
168 168
169 // Pointer to the current instance of the controller to be used by 169 // Pointer to the current instance of the controller to be used by
170 // automation tests. 170 // automation tests.
171 static ManagedUserCreationControllerNew* current_controller_; 171 static SupervisedUserCreationControllerNew* current_controller_;
172 172
173 // Current stage of user creation. 173 // Current stage of user creation.
174 Stage stage_; 174 Stage stage_;
175 175
176 // Authenticator used for user creation. 176 // Authenticator used for user creation.
177 scoped_refptr<ExtendedAuthenticator> authenticator_; 177 scoped_refptr<ExtendedAuthenticator> authenticator_;
178 178
179 // Creation context. Not null while creating new LMU. 179 // Creation context. Not null while creating new LMU.
180 scoped_ptr<UserCreationContext> creation_context_; 180 scoped_ptr<UserCreationContext> creation_context_;
181 181
182 // Timer for showing warning if creation process takes too long. 182 // Timer for showing warning if creation process takes too long.
183 base::OneShotTimer<ManagedUserCreationControllerNew> timeout_timer_; 183 base::OneShotTimer<SupervisedUserCreationControllerNew> timeout_timer_;
184 184
185 // Factory of callbacks. 185 // Factory of callbacks.
186 base::WeakPtrFactory<ManagedUserCreationControllerNew> weak_factory_; 186 base::WeakPtrFactory<SupervisedUserCreationControllerNew> weak_factory_;
187 187
188 DISALLOW_COPY_AND_ASSIGN(ManagedUserCreationControllerNew); 188 DISALLOW_COPY_AND_ASSIGN(SupervisedUserCreationControllerNew);
189 }; 189 };
190 190
191 } // namespace chromeos 191 } // namespace chromeos
192 192
193 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_MANAGED_USER_CREATION_CONTROLLE R_NEW_H_ 193 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SUPERVISED_SUPERVISED_USER_CREATION_CON TROLLER_NEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698