| 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 "chromeos/cryptohome/homedir_methods.h" | 5 #include "chromeos/cryptohome/homedir_methods.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 215 |
| 216 if (!request.create_keys.empty()) { | 216 if (!request.create_keys.empty()) { |
| 217 CreateRequest* create = request_proto.mutable_create(); | 217 CreateRequest* create = request_proto.mutable_create(); |
| 218 for (size_t i = 0; i < request.create_keys.size(); ++i) | 218 for (size_t i = 0; i < request.create_keys.size(); ++i) |
| 219 FillKeyProtobuf(request.create_keys[i], create->add_keys()); | 219 FillKeyProtobuf(request.create_keys[i], create->add_keys()); |
| 220 } | 220 } |
| 221 | 221 |
| 222 if (request.force_dircrypto_if_available) | 222 if (request.force_dircrypto_if_available) |
| 223 request_proto.set_force_dircrypto_if_available(true); | 223 request_proto.set_force_dircrypto_if_available(true); |
| 224 | 224 |
| 225 if (request.to_migrate_from_ecryptfs) |
| 226 request_proto.set_to_migrate_from_ecryptfs(true); |
| 227 |
| 225 DBusThreadManager::Get()->GetCryptohomeClient()->MountEx( | 228 DBusThreadManager::Get()->GetCryptohomeClient()->MountEx( |
| 226 id, auth_proto, request_proto, | 229 id, auth_proto, request_proto, |
| 227 base::Bind(&HomedirMethodsImpl::OnMountExCallback, | 230 base::Bind(&HomedirMethodsImpl::OnMountExCallback, |
| 228 weak_ptr_factory_.GetWeakPtr(), callback)); | 231 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 229 } | 232 } |
| 230 | 233 |
| 231 void AddKeyEx(const Identification& id, | 234 void AddKeyEx(const Identification& id, |
| 232 const Authorization& auth, | 235 const Authorization& auth, |
| 233 const KeyDefinition& new_key, | 236 const KeyDefinition& new_key, |
| 234 bool clobber_if_exists, | 237 bool clobber_if_exists, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 293 |
| 291 void GetAccountDiskUsage( | 294 void GetAccountDiskUsage( |
| 292 const Identification& id, | 295 const Identification& id, |
| 293 const GetAccountDiskUsageCallback& callback) override { | 296 const GetAccountDiskUsageCallback& callback) override { |
| 294 DBusThreadManager::Get()->GetCryptohomeClient()->GetAccountDiskUsage( | 297 DBusThreadManager::Get()->GetCryptohomeClient()->GetAccountDiskUsage( |
| 295 id, base::Bind(&HomedirMethodsImpl::OnGetAccountDiskUsageCallback, | 298 id, base::Bind(&HomedirMethodsImpl::OnGetAccountDiskUsageCallback, |
| 296 weak_ptr_factory_.GetWeakPtr(), callback)); | 299 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 297 } | 300 } |
| 298 | 301 |
| 299 void MigrateToDircrypto(const Identification& id, | 302 void MigrateToDircrypto(const Identification& id, |
| 300 const Authorization& auth, | |
| 301 const DBusResultCallback& callback) override { | 303 const DBusResultCallback& callback) override { |
| 302 cryptohome::AuthorizationRequest auth_proto; | |
| 303 FillAuthorizationProtobuf(auth, &auth_proto); | |
| 304 | |
| 305 DBusThreadManager::Get()->GetCryptohomeClient()->MigrateToDircrypto( | 304 DBusThreadManager::Get()->GetCryptohomeClient()->MigrateToDircrypto( |
| 306 id, auth_proto, | 305 id, base::Bind(&HomedirMethodsImpl::OnDBusResultCallback, |
| 307 base::Bind(&HomedirMethodsImpl::OnDBusResultCallback, | 306 weak_ptr_factory_.GetWeakPtr(), callback)); |
| 308 weak_ptr_factory_.GetWeakPtr(), callback)); | |
| 309 } | 307 } |
| 310 | 308 |
| 311 private: | 309 private: |
| 312 void OnGetKeyDataExCallback(const GetKeyDataCallback& callback, | 310 void OnGetKeyDataExCallback(const GetKeyDataCallback& callback, |
| 313 chromeos::DBusMethodCallStatus call_status, | 311 chromeos::DBusMethodCallStatus call_status, |
| 314 bool result, | 312 bool result, |
| 315 const BaseReply& reply) { | 313 const BaseReply& reply) { |
| 316 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) { | 314 if (call_status != chromeos::DBUS_METHOD_CALL_SUCCESS) { |
| 317 callback.Run(false, MOUNT_ERROR_FATAL, std::vector<KeyDefinition>()); | 315 callback.Run(false, MOUNT_ERROR_FATAL, std::vector<KeyDefinition>()); |
| 318 return; | 316 return; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 } | 507 } |
| 510 delete g_homedir_methods; | 508 delete g_homedir_methods; |
| 511 g_homedir_methods = NULL; | 509 g_homedir_methods = NULL; |
| 512 VLOG(1) << "HomedirMethods Shutdown completed"; | 510 VLOG(1) << "HomedirMethods Shutdown completed"; |
| 513 } | 511 } |
| 514 | 512 |
| 515 // static | 513 // static |
| 516 HomedirMethods* HomedirMethods::GetInstance() { return g_homedir_methods; } | 514 HomedirMethods* HomedirMethods::GetInstance() { return g_homedir_methods; } |
| 517 | 515 |
| 518 } // namespace cryptohome | 516 } // namespace cryptohome |
| OLD | NEW |