OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/managed_mode/managed_user_registration_utility.h" | 5 #include "chrome/browser/managed_mode/managed_user_registration_utility.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 194 } |
195 | 195 |
196 void ManagedUserRegistrationUtilityImpl::Register( | 196 void ManagedUserRegistrationUtilityImpl::Register( |
197 const std::string& managed_user_id, | 197 const std::string& managed_user_id, |
198 const ManagedUserRegistrationInfo& info, | 198 const ManagedUserRegistrationInfo& info, |
199 const RegistrationCallback& callback) { | 199 const RegistrationCallback& callback) { |
200 DCHECK(pending_managed_user_id_.empty()); | 200 DCHECK(pending_managed_user_id_.empty()); |
201 callback_ = callback; | 201 callback_ = callback; |
202 pending_managed_user_id_ = managed_user_id; | 202 pending_managed_user_id_ = managed_user_id; |
203 | 203 |
204 const DictionaryValue* dict = prefs_->GetDictionary(prefs::kManagedUsers); | 204 const base::DictionaryValue* dict = |
| 205 prefs_->GetDictionary(prefs::kManagedUsers); |
205 is_existing_managed_user_ = dict->HasKey(managed_user_id); | 206 is_existing_managed_user_ = dict->HasKey(managed_user_id); |
206 if (!is_existing_managed_user_) { | 207 if (!is_existing_managed_user_) { |
207 managed_user_sync_service_->AddManagedUser(pending_managed_user_id_, | 208 managed_user_sync_service_->AddManagedUser(pending_managed_user_id_, |
208 base::UTF16ToUTF8(info.name), | 209 base::UTF16ToUTF8(info.name), |
209 info.master_key, | 210 info.master_key, |
210 info.avatar_index); | 211 info.avatar_index); |
211 } else { | 212 } else { |
212 avatar_updated_ = | 213 avatar_updated_ = |
213 managed_user_sync_service_->UpdateManagedUserAvatarIfNeeded( | 214 managed_user_sync_service_->UpdateManagedUserAvatarIfNeeded( |
214 managed_user_id, | 215 managed_user_id, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 pending_managed_user_id_); | 306 pending_managed_user_id_); |
306 } | 307 } |
307 } | 308 } |
308 | 309 |
309 if (run_callback) | 310 if (run_callback) |
310 callback_.Run(error, pending_managed_user_token_); | 311 callback_.Run(error, pending_managed_user_token_); |
311 callback_.Reset(); | 312 callback_.Reset(); |
312 } | 313 } |
313 | 314 |
314 } // namespace | 315 } // namespace |
OLD | NEW |