Chromium Code Reviews| 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 #ifndef CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 6 #define CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 typedef base::Callback<void(DBusMethodCallStatus call_status, | 84 typedef base::Callback<void(DBusMethodCallStatus call_status, |
| 85 bool result, | 85 bool result, |
| 86 const std::string& data)> DataMethodCallback; | 86 const std::string& data)> DataMethodCallback; |
| 87 | 87 |
| 88 // A callback for methods which return both a bool and a protobuf as reply. | 88 // A callback for methods which return both a bool and a protobuf as reply. |
| 89 typedef base::Callback< | 89 typedef base::Callback< |
| 90 void(DBusMethodCallStatus call_status, | 90 void(DBusMethodCallStatus call_status, |
| 91 bool result, | 91 bool result, |
| 92 const cryptohome::BaseReply& reply)> ProtobufMethodCallback; | 92 const cryptohome::BaseReply& reply)> ProtobufMethodCallback; |
| 93 | 93 |
| 94 // A callback to handle DircryptoMigrationProgress signals. | |
| 95 typedef base::Callback<void(uint64_t current, uint64_t total)> | |
| 96 DircryptoMigrationProgessHandler; | |
| 97 | |
| 94 ~CryptohomeClient() override; | 98 ~CryptohomeClient() override; |
| 95 | 99 |
| 96 // Factory function, creates a new instance and returns ownership. | 100 // Factory function, creates a new instance and returns ownership. |
| 97 // For normal usage, access the singleton via DBusThreadManager::Get(). | 101 // For normal usage, access the singleton via DBusThreadManager::Get(). |
| 98 static CryptohomeClient* Create(); | 102 static CryptohomeClient* Create(); |
| 99 | 103 |
| 100 // Returns the sanitized |username| that the stub implementation would return. | 104 // Returns the sanitized |username| that the stub implementation would return. |
| 101 static std::string GetStubSanitizedUsername( | 105 static std::string GetStubSanitizedUsername( |
| 102 const cryptohome::Identification& cryptohome_id); | 106 const cryptohome::Identification& cryptohome_id); |
| 103 | 107 |
| 104 // Sets AsyncCallStatus signal handlers. | 108 // Sets AsyncCallStatus signal handlers. |
| 105 // |handler| is called when results for AsyncXXX methods are returned. | 109 // |handler| is called when results for AsyncXXX methods are returned. |
| 106 // Cryptohome service will process the calls in a first-in-first-out manner | 110 // Cryptohome service will process the calls in a first-in-first-out manner |
| 107 // when they are made in parallel. | 111 // when they are made in parallel. |
| 108 virtual void SetAsyncCallStatusHandlers( | 112 virtual void SetAsyncCallStatusHandlers( |
| 109 const AsyncCallStatusHandler& handler, | 113 const AsyncCallStatusHandler& handler, |
| 110 const AsyncCallStatusWithDataHandler& data_handler) = 0; | 114 const AsyncCallStatusWithDataHandler& data_handler) = 0; |
| 111 | 115 |
| 112 // Resets AsyncCallStatus signal handlers. | 116 // Resets AsyncCallStatus signal handlers. |
| 113 virtual void ResetAsyncCallStatusHandlers() = 0; | 117 virtual void ResetAsyncCallStatusHandlers() = 0; |
| 114 | 118 |
| 115 // Sets LowDiskSpace signal handler. |handler| is called when the cryptohome | 119 // Sets LowDiskSpace signal handler. |handler| is called when the cryptohome |
| 116 // partition is running out of disk space. | 120 // partition is running out of disk space. |
| 117 virtual void SetLowDiskSpaceHandler(const LowDiskSpaceHandler& handler) = 0; | 121 virtual void SetLowDiskSpaceHandler(const LowDiskSpaceHandler& handler) = 0; |
| 118 | 122 |
| 123 // A callback to handle DircryptoMigrationProgress signals. |handler| is | |
| 124 // called periodicaly during a migration is performed by cryptohomed. | |
|
Daniel Erat
2017/03/14 15:37:36
nit: "called periodically while a migration is bei
kinaba
2017/03/15 08:17:30
My intent is that the callback from MigrateToDircr
| |
| 125 virtual void SetDircryptoMigrationProgressHandler( | |
| 126 const DircryptoMigrationProgessHandler& handler) = 0; | |
| 127 | |
| 119 // Runs the callback as soon as the service becomes available. | 128 // Runs the callback as soon as the service becomes available. |
| 120 virtual void WaitForServiceToBeAvailable( | 129 virtual void WaitForServiceToBeAvailable( |
| 121 const WaitForServiceToBeAvailableCallback& callback) = 0; | 130 const WaitForServiceToBeAvailableCallback& callback) = 0; |
| 122 | 131 |
| 123 // Calls IsMounted method and returns true when the call succeeds. | 132 // Calls IsMounted method and returns true when the call succeeds. |
| 124 virtual void IsMounted(const BoolDBusMethodCallback& callback) = 0; | 133 virtual void IsMounted(const BoolDBusMethodCallback& callback) = 0; |
| 125 | 134 |
| 126 // Calls Unmount method and returns true when the call succeeds. | 135 // Calls Unmount method and returns true when the call succeeds. |
| 127 // This method blocks until the call returns. | 136 // This method blocks until the call returns. |
| 128 virtual bool Unmount(bool* success) = 0; | 137 virtual bool Unmount(bool* success) = 0; |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 548 | 557 |
| 549 // Asynchronously calls FlushAndSignBootAttributes method. |callback| is | 558 // Asynchronously calls FlushAndSignBootAttributes method. |callback| is |
| 550 // called after method call, and with reply protobuf. | 559 // called after method call, and with reply protobuf. |
| 551 // FlushAndSignBootAttributes makes all pending boot attribute settings | 560 // FlushAndSignBootAttributes makes all pending boot attribute settings |
| 552 // available, and have them signed by a special TPM key. This method always | 561 // available, and have them signed by a special TPM key. This method always |
| 553 // fails after any user, publuc, or guest session starts. | 562 // fails after any user, publuc, or guest session starts. |
| 554 virtual void FlushAndSignBootAttributes( | 563 virtual void FlushAndSignBootAttributes( |
| 555 const cryptohome::FlushAndSignBootAttributesRequest& request, | 564 const cryptohome::FlushAndSignBootAttributesRequest& request, |
| 556 const ProtobufMethodCallback& callback) = 0; | 565 const ProtobufMethodCallback& callback) = 0; |
| 557 | 566 |
| 567 // Asynchronously calls MigrateToDicrypto method. |callback| is called after | |
| 568 // method call, and with reply protobuf. | |
|
Daniel Erat
2017/03/14 15:37:36
does the callback get invoked immediately, or only
kinaba
2017/03/15 08:17:30
Done.
| |
| 569 // MigrateToDicrypto attempts to migrate the home dir using given | |
|
Daniel Erat
2017/03/14 15:37:37
nit: MigrateToDirCrypto
kinaba
2017/03/15 08:17:30
Done.
| |
| 570 // authorization, to the new "dicrypto" encryption. | |
|
Daniel Erat
2017/03/14 15:37:36
nit: "dircrypto", also remove comma on this line
kinaba
2017/03/15 08:17:30
Done.
| |
| 571 virtual void MigrateToDircrypto( | |
| 572 const cryptohome::Identification& cryptohome_id, | |
| 573 const cryptohome::AuthorizationRequest& auth, | |
| 574 const ProtobufMethodCallback& callback) = 0; | |
| 575 | |
| 558 protected: | 576 protected: |
| 559 // Create() should be used instead. | 577 // Create() should be used instead. |
| 560 CryptohomeClient(); | 578 CryptohomeClient(); |
| 561 | 579 |
| 562 private: | 580 private: |
| 563 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); | 581 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); |
| 564 }; | 582 }; |
| 565 | 583 |
| 566 } // namespace chromeos | 584 } // namespace chromeos |
| 567 | 585 |
| 568 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 586 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
| OLD | NEW |