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/chromeos/chromeos_version.h" |
8 #include "base/file_util.h" | 9 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
10 #include "base/task_runner_util.h" | 11 #include "base/task_runner_util.h" |
11 #include "base/threading/sequenced_worker_pool.h" | 12 #include "base/threading/sequenced_worker_pool.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "chrome/browser/chromeos/login/managed/locally_managed_user_constants.h
" | 14 #include "chrome/browser/chromeos/login/managed/locally_managed_user_constants.h
" |
14 #include "chrome/browser/chromeos/login/mount_manager.h" | 15 #include "chrome/browser/chromeos/login/mount_manager.h" |
15 #include "chrome/browser/chromeos/login/user.h" | 16 #include "chrome/browser/chromeos/login/user.h" |
16 #include "chrome/browser/chromeos/login/user_manager.h" | 17 #include "chrome/browser/chromeos/login/user_manager.h" |
17 #include "chrome/browser/lifetime/application_lifetime.h" | 18 #include "chrome/browser/lifetime/application_lifetime.h" |
18 #include "chrome/browser/managed_mode/managed_user_registration_service_factory.
h" | 19 #include "chrome/browser/managed_mode/managed_user_registration_service_factory.
h" |
19 #include "chromeos/dbus/dbus_thread_manager.h" | 20 #include "chromeos/dbus/dbus_thread_manager.h" |
20 #include "chromeos/dbus/session_manager_client.h" | 21 #include "chromeos/dbus/session_manager_client.h" |
21 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
22 #include "google_apis/gaia/google_service_auth_error.h" | 23 #include "google_apis/gaia/google_service_auth_error.h" |
23 | 24 |
24 namespace chromeos { | 25 namespace chromeos { |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 bool StoreManagedUserFiles(const std::string& token, | 29 bool StoreManagedUserFiles(const std::string& token, |
29 const base::FilePath& base_path) { | 30 const base::FilePath& base_path) { |
| 31 if (!base::chromeos::IsRunningOnChromeOS()) { |
| 32 // If running on desktop, cryptohome stub does not create home directory. |
| 33 file_util::CreateDirectory(base_path); |
| 34 } |
30 base::FilePath token_file = base_path.Append(kManagedUserTokenFilename); | 35 base::FilePath token_file = base_path.Append(kManagedUserTokenFilename); |
31 int bytes = file_util::WriteFile(token_file, token.c_str(), token.length()); | 36 int bytes = file_util::WriteFile(token_file, token.c_str(), token.length()); |
32 return bytes >= 0; | 37 return bytes >= 0; |
33 } | 38 } |
34 | 39 |
35 } // namespace | 40 } // namespace |
36 | 41 |
37 LocallyManagedUserCreationController::StatusConsumer::~StatusConsumer() {} | 42 LocallyManagedUserCreationController::StatusConsumer::~StatusConsumer() {} |
38 | 43 |
39 LocallyManagedUserCreationController::UserCreationContext::UserCreationContext() | 44 LocallyManagedUserCreationController::UserCreationContext::UserCreationContext() |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 if (consumer_) | 175 if (consumer_) |
171 consumer_->OnCreationError(TOKEN_WRITE_FAILED); | 176 consumer_->OnCreationError(TOKEN_WRITE_FAILED); |
172 return; | 177 return; |
173 } | 178 } |
174 UserManager::Get()->CommitLocallyManagedUserCreationTransaction(); | 179 UserManager::Get()->CommitLocallyManagedUserCreationTransaction(); |
175 if (consumer_) | 180 if (consumer_) |
176 consumer_->OnCreationSuccess(); | 181 consumer_->OnCreationSuccess(); |
177 } | 182 } |
178 | 183 |
179 } // namespace chromeos | 184 } // namespace chromeos |
OLD | NEW |