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

Side by Side Diff: chrome/browser/chromeos/login/managed/locally_managed_user_creation_controller.cc

Issue 23653007: Avatar syncing for supervised users (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ... Created 7 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/managed_mode/managed_user_registration_utility.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/login/managed/locally_managed_user_creation_co ntroller.h" 5 #include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_co ntroller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/chromeos/chromeos_version.h" 8 #include "base/chromeos/chromeos_version.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 11 matching lines...) Expand all
22 #include "chromeos/dbus/session_manager_client.h" 22 #include "chromeos/dbus/session_manager_client.h"
23 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/user_metrics.h" 24 #include "content/public/browser/user_metrics.h"
25 #include "crypto/random.h" 25 #include "crypto/random.h"
26 #include "google_apis/gaia/google_service_auth_error.h" 26 #include "google_apis/gaia/google_service_auth_error.h"
27 27
28 namespace chromeos { 28 namespace chromeos {
29 29
30 namespace { 30 namespace {
31 31
32 const int kDummyAvatarIndex = -111;
32 const int kMasterKeySize = 32; 33 const int kMasterKeySize = 32;
33 const int kUserCreationTimeoutSeconds = 60; // 60 seconds. 34 const int kUserCreationTimeoutSeconds = 60; // 60 seconds.
34 35
35 bool StoreManagedUserFiles(const std::string& token, 36 bool StoreManagedUserFiles(const std::string& token,
36 const base::FilePath& base_path) { 37 const base::FilePath& base_path) {
37 if (!base::chromeos::IsRunningOnChromeOS()) { 38 if (!base::chromeos::IsRunningOnChromeOS()) {
38 // If running on desktop, cryptohome stub does not create home directory. 39 // If running on desktop, cryptohome stub does not create home directory.
39 file_util::CreateDirectory(base_path); 40 file_util::CreateDirectory(base_path);
40 } 41 }
41 base::FilePath token_file = base_path.Append(kManagedUserTokenFilename); 42 base::FilePath token_file = base_path.Append(kManagedUserTokenFilename);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 creation_context_->password, 154 creation_context_->password,
154 creation_context_->master_key); 155 creation_context_->master_key);
155 } 156 }
156 157
157 void LocallyManagedUserCreationController::OnAddKeySuccess() { 158 void LocallyManagedUserCreationController::OnAddKeySuccess() {
158 creation_context_->registration_utility = 159 creation_context_->registration_utility =
159 ManagedUserRegistrationUtility::Create( 160 ManagedUserRegistrationUtility::Create(
160 creation_context_->manager_profile); 161 creation_context_->manager_profile);
161 162
162 VLOG(1) << "Creating user on server"; 163 VLOG(1) << "Creating user on server";
163 ManagedUserRegistrationInfo info(creation_context_->display_name); 164 ManagedUserRegistrationInfo info(creation_context_->display_name,
165 kDummyAvatarIndex);
164 info.master_key = creation_context_->master_key; 166 info.master_key = creation_context_->master_key;
165 creation_context_->registration_utility->Register( 167 creation_context_->registration_utility->Register(
166 creation_context_->sync_user_id, 168 creation_context_->sync_user_id,
167 info, 169 info,
168 base::Bind(&LocallyManagedUserCreationController::RegistrationCallback, 170 base::Bind(&LocallyManagedUserCreationController::RegistrationCallback,
169 weak_factory_.GetWeakPtr())); 171 weak_factory_.GetWeakPtr()));
170 } 172 }
171 173
172 void LocallyManagedUserCreationController::RegistrationCallback( 174 void LocallyManagedUserCreationController::RegistrationCallback(
173 const GoogleServiceAuthError& error, 175 const GoogleServiceAuthError& error,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // Assume that new token is valid. It will be automatically invalidated if 235 // Assume that new token is valid. It will be automatically invalidated if
234 // sync service fails to use it. 236 // sync service fails to use it.
235 UserManager::Get()->SaveUserOAuthStatus(creation_context_->local_user_id, 237 UserManager::Get()->SaveUserOAuthStatus(creation_context_->local_user_id,
236 User::OAUTH2_TOKEN_STATUS_VALID); 238 User::OAUTH2_TOKEN_STATUS_VALID);
237 UserManager::Get()->CommitLocallyManagedUserCreationTransaction(); 239 UserManager::Get()->CommitLocallyManagedUserCreationTransaction();
238 if (consumer_) 240 if (consumer_)
239 consumer_->OnCreationSuccess(); 241 consumer_->OnCreationSuccess();
240 } 242 }
241 243
242 } // namespace chromeos 244 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/managed_mode/managed_user_registration_utility.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698