| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/dbus/fake_cryptohome_client.h" | 5 #include "chromeos/dbus/fake_cryptohome_client.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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 void FakeCryptohomeClient::MountEx( | 526 void FakeCryptohomeClient::MountEx( |
| 527 const cryptohome::Identification& cryptohome_id, | 527 const cryptohome::Identification& cryptohome_id, |
| 528 const cryptohome::AuthorizationRequest& auth, | 528 const cryptohome::AuthorizationRequest& auth, |
| 529 const cryptohome::MountRequest& request, | 529 const cryptohome::MountRequest& request, |
| 530 const ProtobufMethodCallback& callback) { | 530 const ProtobufMethodCallback& callback) { |
| 531 cryptohome::BaseReply reply; | 531 cryptohome::BaseReply reply; |
| 532 cryptohome::MountReply* mount = | 532 cryptohome::MountReply* mount = |
| 533 reply.MutableExtension(cryptohome::MountReply::reply); | 533 reply.MutableExtension(cryptohome::MountReply::reply); |
| 534 mount->set_sanitized_username(GetStubSanitizedUsername(cryptohome_id)); | 534 mount->set_sanitized_username(GetStubSanitizedUsername(cryptohome_id)); |
| 535 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 535 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 536 switches::kTestEncryptionMigrationUI)) { | 536 switches::kTestEncryptionMigrationUI) && |
| 537 !request.to_migrate_from_ecryptfs()) { |
| 537 reply.set_error(cryptohome::CRYPTOHOME_ERROR_MOUNT_OLD_ENCRYPTION); | 538 reply.set_error(cryptohome::CRYPTOHOME_ERROR_MOUNT_OLD_ENCRYPTION); |
| 538 } | 539 } |
| 539 ReturnProtobufMethodCallback(reply, callback); | 540 ReturnProtobufMethodCallback(reply, callback); |
| 540 } | 541 } |
| 541 | 542 |
| 542 void FakeCryptohomeClient::AddKeyEx( | 543 void FakeCryptohomeClient::AddKeyEx( |
| 543 const cryptohome::Identification& cryptohome_id, | 544 const cryptohome::Identification& cryptohome_id, |
| 544 const cryptohome::AuthorizationRequest& auth, | 545 const cryptohome::AuthorizationRequest& auth, |
| 545 const cryptohome::AddKeyRequest& request, | 546 const cryptohome::AddKeyRequest& request, |
| 546 const ProtobufMethodCallback& callback) { | 547 const ProtobufMethodCallback& callback) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 | 586 |
| 586 void FakeCryptohomeClient::FlushAndSignBootAttributes( | 587 void FakeCryptohomeClient::FlushAndSignBootAttributes( |
| 587 const cryptohome::FlushAndSignBootAttributesRequest& request, | 588 const cryptohome::FlushAndSignBootAttributesRequest& request, |
| 588 const ProtobufMethodCallback& callback) { | 589 const ProtobufMethodCallback& callback) { |
| 589 cryptohome::BaseReply reply; | 590 cryptohome::BaseReply reply; |
| 590 ReturnProtobufMethodCallback(reply, callback); | 591 ReturnProtobufMethodCallback(reply, callback); |
| 591 } | 592 } |
| 592 | 593 |
| 593 void FakeCryptohomeClient::MigrateToDircrypto( | 594 void FakeCryptohomeClient::MigrateToDircrypto( |
| 594 const cryptohome::Identification& cryptohome_id, | 595 const cryptohome::Identification& cryptohome_id, |
| 595 const cryptohome::AuthorizationRequest& auth, | |
| 596 const VoidDBusMethodCallback& callback) { | 596 const VoidDBusMethodCallback& callback) { |
| 597 base::ThreadTaskRunnerHandle::Get()->PostTask( | 597 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 598 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS)); | 598 FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS)); |
| 599 dircrypto_migration_progress_ = 0; | 599 dircrypto_migration_progress_ = 0; |
| 600 dircrypto_migration_progress_timer_.Start( | 600 dircrypto_migration_progress_timer_.Start( |
| 601 FROM_HERE, | 601 FROM_HERE, |
| 602 base::TimeDelta::FromMilliseconds(kDircryptoMigrationUpdateIntervalMs), | 602 base::TimeDelta::FromMilliseconds(kDircryptoMigrationUpdateIntervalMs), |
| 603 this, &FakeCryptohomeClient::OnDircryptoMigrationProgressUpdated); | 603 this, &FakeCryptohomeClient::OnDircryptoMigrationProgressUpdated); |
| 604 } | 604 } |
| 605 | 605 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 if (!dircrypto_migration_progress_handler_.is_null()) { | 704 if (!dircrypto_migration_progress_handler_.is_null()) { |
| 705 base::ThreadTaskRunnerHandle::Get()->PostTask( | 705 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 706 FROM_HERE, base::Bind(dircrypto_migration_progress_handler_, | 706 FROM_HERE, base::Bind(dircrypto_migration_progress_handler_, |
| 707 cryptohome::DIRCRYPTO_MIGRATION_IN_PROGRESS, | 707 cryptohome::DIRCRYPTO_MIGRATION_IN_PROGRESS, |
| 708 dircrypto_migration_progress_, | 708 dircrypto_migration_progress_, |
| 709 kDircryptoMigrationMaxProgress)); | 709 kDircryptoMigrationMaxProgress)); |
| 710 } | 710 } |
| 711 } | 711 } |
| 712 | 712 |
| 713 } // namespace chromeos | 713 } // namespace chromeos |
| OLD | NEW |