| 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 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont
roller_new.h" | 5 #include "chrome/browser/chromeos/login/supervised/supervised_user_creation_cont
roller_new.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/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
| 14 #include "base/task_runner_util.h" | 14 #include "base/task_runner_util.h" |
| 15 #include "base/threading/sequenced_worker_pool.h" | 15 #include "base/threading/sequenced_worker_pool.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/browser/chromeos/login/auth/mount_manager.h" | |
| 18 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" | 17 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" |
| 19 #include "chrome/browser/chromeos/login/supervised/supervised_user_constants.h" | 18 #include "chrome/browser/chromeos/login/supervised/supervised_user_constants.h" |
| 20 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 19 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 21 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 20 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 21 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 22 #include "chrome/browser/lifetime/application_lifetime.h" | 22 #include "chrome/browser/lifetime/application_lifetime.h" |
| 23 #include "chrome/browser/sync/profile_sync_service.h" | 23 #include "chrome/browser/sync/profile_sync_service.h" |
| 24 #include "chrome/browser/sync/profile_sync_service_factory.h" | 24 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 25 #include "chromeos/cryptohome/cryptohome_parameters.h" | 25 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 26 #include "chromeos/dbus/dbus_thread_manager.h" | 26 #include "chromeos/dbus/dbus_thread_manager.h" |
| 27 #include "chromeos/dbus/session_manager_client.h" | 27 #include "chromeos/dbus/session_manager_client.h" |
| 28 #include "chromeos/login/auth/key.h" | 28 #include "chromeos/login/auth/key.h" |
| 29 #include "chromeos/login/auth/user_context.h" | 29 #include "chromeos/login/auth/user_context.h" |
| 30 #include "components/user_manager/user.h" | 30 #include "components/user_manager/user.h" |
| 31 #include "components/user_manager/user_manager.h" | 31 #include "components/user_manager/user_manager.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 stage_ = DASHBOARD_CREATED; | 336 stage_ = DASHBOARD_CREATED; |
| 337 | 337 |
| 338 if (error.state() == GoogleServiceAuthError::NONE) { | 338 if (error.state() == GoogleServiceAuthError::NONE) { |
| 339 creation_context_->token = token; | 339 creation_context_->token = token; |
| 340 | 340 |
| 341 PostTaskAndReplyWithResult( | 341 PostTaskAndReplyWithResult( |
| 342 content::BrowserThread::GetBlockingPool(), | 342 content::BrowserThread::GetBlockingPool(), |
| 343 FROM_HERE, | 343 FROM_HERE, |
| 344 base::Bind(&StoreSupervisedUserFiles, | 344 base::Bind(&StoreSupervisedUserFiles, |
| 345 creation_context_->token, | 345 creation_context_->token, |
| 346 MountManager::GetHomeDir(creation_context_->mount_hash)), | 346 ProfileHelper::GetProfilePathByUserIdHash( |
| 347 base::Bind(&SupervisedUserCreationControllerNew:: | 347 creation_context_->mount_hash)), |
| 348 OnSupervisedUserFilesStored, | 348 base::Bind( |
| 349 weak_factory_.GetWeakPtr())); | 349 &SupervisedUserCreationControllerNew::OnSupervisedUserFilesStored, |
| 350 weak_factory_.GetWeakPtr())); |
| 350 } else { | 351 } else { |
| 351 stage_ = STAGE_ERROR; | 352 stage_ = STAGE_ERROR; |
| 352 LOG(ERROR) << "Supervised user creation failed. Error code " | 353 LOG(ERROR) << "Supervised user creation failed. Error code " |
| 353 << error.state(); | 354 << error.state(); |
| 354 if (consumer_) | 355 if (consumer_) |
| 355 consumer_->OnCreationError(CLOUD_SERVER_ERROR); | 356 consumer_->OnCreationError(CLOUD_SERVER_ERROR); |
| 356 } | 357 } |
| 357 } | 358 } |
| 358 | 359 |
| 359 void SupervisedUserCreationControllerNew::OnSupervisedUserFilesStored( | 360 void SupervisedUserCreationControllerNew::OnSupervisedUserFilesStored( |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 creation_context_->registration_utility.reset(); | 403 creation_context_->registration_utility.reset(); |
| 403 chrome::AttemptUserExit(); | 404 chrome::AttemptUserExit(); |
| 404 } | 405 } |
| 405 | 406 |
| 406 std::string SupervisedUserCreationControllerNew::GetSupervisedUserId() { | 407 std::string SupervisedUserCreationControllerNew::GetSupervisedUserId() { |
| 407 DCHECK(creation_context_); | 408 DCHECK(creation_context_); |
| 408 return creation_context_->local_user_id; | 409 return creation_context_->local_user_id; |
| 409 } | 410 } |
| 410 | 411 |
| 411 } // namespace chromeos | 412 } // namespace chromeos |
| OLD | NEW |