OLD | NEW |
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/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 const int kMasterKeySize = 32; | 36 const int kMasterKeySize = 32; |
37 const int kUserCreationTimeoutSeconds = 30; // 30 seconds. | 37 const int kUserCreationTimeoutSeconds = 30; // 30 seconds. |
38 | 38 |
39 bool StoreManagedUserFiles(const std::string& token, | 39 bool StoreManagedUserFiles(const std::string& token, |
40 const base::FilePath& base_path) { | 40 const base::FilePath& base_path) { |
41 if (!base::SysInfo::IsRunningOnChromeOS()) { | 41 if (!base::SysInfo::IsRunningOnChromeOS()) { |
42 // If running on desktop, cryptohome stub does not create home directory. | 42 // If running on desktop, cryptohome stub does not create home directory. |
43 base::CreateDirectory(base_path); | 43 base::CreateDirectory(base_path); |
44 } | 44 } |
45 base::FilePath token_file = base_path.Append(kManagedUserTokenFilename); | 45 base::FilePath token_file = base_path.Append(kManagedUserTokenFilename); |
46 int bytes = file_util::WriteFile(token_file, token.c_str(), token.length()); | 46 int bytes = base::WriteFile(token_file, token.c_str(), token.length()); |
47 return bytes >= 0; | 47 return bytes >= 0; |
48 } | 48 } |
49 | 49 |
50 } // namespace | 50 } // namespace |
51 | 51 |
52 // static | 52 // static |
53 const int LocallyManagedUserCreationController::kDummyAvatarIndex = -111; | 53 const int LocallyManagedUserCreationController::kDummyAvatarIndex = -111; |
54 | 54 |
55 LocallyManagedUserCreationController::StatusConsumer::~StatusConsumer() {} | 55 LocallyManagedUserCreationController::StatusConsumer::~StatusConsumer() {} |
56 | 56 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 // sync service fails to use it. | 297 // sync service fails to use it. |
298 UserManager::Get()->SaveUserOAuthStatus(creation_context_->local_user_id, | 298 UserManager::Get()->SaveUserOAuthStatus(creation_context_->local_user_id, |
299 User::OAUTH2_TOKEN_STATUS_VALID); | 299 User::OAUTH2_TOKEN_STATUS_VALID); |
300 UserManager::Get()->GetSupervisedUserManager()-> | 300 UserManager::Get()->GetSupervisedUserManager()-> |
301 CommitCreationTransaction(); | 301 CommitCreationTransaction(); |
302 if (consumer_) | 302 if (consumer_) |
303 consumer_->OnCreationSuccess(); | 303 consumer_->OnCreationSuccess(); |
304 } | 304 } |
305 | 305 |
306 } // namespace chromeos | 306 } // namespace chromeos |
OLD | NEW |