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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 namespace { | 33 namespace { |
34 | 34 |
35 const int kMasterKeySize = 32; | 35 const int kMasterKeySize = 32; |
36 const int kUserCreationTimeoutSeconds = 30; // 30 seconds. | 36 const int kUserCreationTimeoutSeconds = 30; // 30 seconds. |
37 | 37 |
38 bool StoreManagedUserFiles(const std::string& token, | 38 bool StoreManagedUserFiles(const std::string& token, |
39 const base::FilePath& base_path) { | 39 const base::FilePath& base_path) { |
40 if (!base::SysInfo::IsRunningOnChromeOS()) { | 40 if (!base::SysInfo::IsRunningOnChromeOS()) { |
41 // If running on desktop, cryptohome stub does not create home directory. | 41 // If running on desktop, cryptohome stub does not create home directory. |
42 file_util::CreateDirectory(base_path); | 42 base::CreateDirectory(base_path); |
43 } | 43 } |
44 base::FilePath token_file = base_path.Append(kManagedUserTokenFilename); | 44 base::FilePath token_file = base_path.Append(kManagedUserTokenFilename); |
45 int bytes = file_util::WriteFile(token_file, token.c_str(), token.length()); | 45 int bytes = file_util::WriteFile(token_file, token.c_str(), token.length()); |
46 return bytes >= 0; | 46 return bytes >= 0; |
47 } | 47 } |
48 | 48 |
49 } // namespace | 49 } // namespace |
50 | 50 |
51 // static | 51 // static |
52 const int LocallyManagedUserCreationController::kDummyAvatarIndex = -111; | 52 const int LocallyManagedUserCreationController::kDummyAvatarIndex = -111; |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // sync service fails to use it. | 280 // sync service fails to use it. |
281 UserManager::Get()->SaveUserOAuthStatus(creation_context_->local_user_id, | 281 UserManager::Get()->SaveUserOAuthStatus(creation_context_->local_user_id, |
282 User::OAUTH2_TOKEN_STATUS_VALID); | 282 User::OAUTH2_TOKEN_STATUS_VALID); |
283 UserManager::Get()->GetSupervisedUserManager()-> | 283 UserManager::Get()->GetSupervisedUserManager()-> |
284 CommitCreationTransaction(); | 284 CommitCreationTransaction(); |
285 if (consumer_) | 285 if (consumer_) |
286 consumer_->OnCreationSuccess(); | 286 consumer_->OnCreationSuccess(); |
287 } | 287 } |
288 | 288 |
289 } // namespace chromeos | 289 } // namespace chromeos |
OLD | NEW |