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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 // CryptohomeClient is used to communicate with the Cryptohome service. | 23 // CryptohomeClient is used to communicate with the Cryptohome service. |
| 24 // All method should be called from the origin thread (UI thread) which | 24 // All method should be called from the origin thread (UI thread) which |
| 25 // initializes the DBusThreadManager instance. | 25 // initializes the DBusThreadManager instance. |
| 26 class CHROMEOS_EXPORT CryptohomeClient { | 26 class CHROMEOS_EXPORT CryptohomeClient { |
| 27 public: | 27 public: |
| 28 // A callback to handle AsyncCallStatus signals. | 28 // A callback to handle AsyncCallStatus signals. |
| 29 typedef base::Callback<void(int async_id, bool return_status, int return_code) | 29 typedef base::Callback<void(int async_id, bool return_status, int return_code) |
| 30 > AsyncCallStatusHandler; | 30 > AsyncCallStatusHandler; |
| 31 // A callback to handle responses of AsyncXXX methods. | 31 // A callback to handle responses of AsyncXXX methods. |
| 32 typedef base::Callback<void(int async_id)> AsyncMethodCallback; | 32 typedef base::Callback<void(int async_id)> AsyncMethodCallback; |
| 33 // A callback to handle responses of methods without result values. | |
| 34 typedef base::Callback<void( | |
| 35 DBusMethodCallStatus call_status)> VoidMethodCallback; | |
|
stevenjb
2012/07/26 17:19:52
This and the two callbacks below seem generic enou
hashimoto
2012/07/27 04:37:18
Sounds good, will do in a separate patch.
| |
| 33 // A callback to handle responses of methods returning a bool value. | 36 // A callback to handle responses of methods returning a bool value. |
| 34 typedef base::Callback<void(DBusMethodCallStatus call_status, | 37 typedef base::Callback<void(DBusMethodCallStatus call_status, |
| 35 bool result)> BoolMethodCallback; | 38 bool result)> BoolMethodCallback; |
| 36 // A callback to handle responses of methods returning a string value. | 39 // A callback to handle responses of methods returning a string value. |
| 37 typedef base::Callback<void(DBusMethodCallStatus call_status, | 40 typedef base::Callback<void(DBusMethodCallStatus call_status, |
| 38 const std::string& result)> StringMethodCallback; | 41 const std::string& result)> StringMethodCallback; |
| 39 // A callback to handle responses of Pkcs11GetTpmTokenInfo method. | 42 // A callback to handle responses of Pkcs11GetTpmTokenInfo method. |
| 40 typedef base::Callback<void( | 43 typedef base::Callback<void( |
| 41 DBusMethodCallStatus call_status, | 44 DBusMethodCallStatus call_status, |
| 42 const std::string& label, | 45 const std::string& label, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 115 virtual void TpmGetPassword(const StringMethodCallback& callback) = 0; | 118 virtual void TpmGetPassword(const StringMethodCallback& callback) = 0; |
| 116 | 119 |
| 117 // Calls TpmIsOwned method and returns true when the call succeeds. | 120 // Calls TpmIsOwned method and returns true when the call succeeds. |
| 118 // This method blocks until the call returns. | 121 // This method blocks until the call returns. |
| 119 virtual bool TpmIsOwned(bool* owned) = 0; | 122 virtual bool TpmIsOwned(bool* owned) = 0; |
| 120 | 123 |
| 121 // Calls TpmIsBeingOwned method and returns true when the call succeeds. | 124 // Calls TpmIsBeingOwned method and returns true when the call succeeds. |
| 122 // This method blocks until the call returns. | 125 // This method blocks until the call returns. |
| 123 virtual bool TpmIsBeingOwned(bool* owning) = 0; | 126 virtual bool TpmIsBeingOwned(bool* owning) = 0; |
| 124 | 127 |
| 125 // Calls TpmCanAttemptOwnership method and returns true when the call | 128 // Calls TpmCanAttemptOwnership method. |
| 126 // succeeds. This method blocks until the call returns. | 129 virtual void TpmCanAttemptOwnership(const VoidMethodCallback& callback) = 0; |
|
stevenjb
2012/07/26 17:19:52
I'm confused about what this method does. It looks
hashimoto
2012/07/27 04:37:18
Looks like your latter guess is correct. (http://g
stevenjb
2012/07/30 22:24:38
OK, I see. That is definitely badly named. Can you
hashimoto
2012/07/31 02:27:34
Added a comment.
| |
| 127 virtual bool TpmCanAttemptOwnership() = 0; | |
| 128 | 130 |
| 129 // Calls TpmClearStoredPassword method and returns true when the call | 131 // Calls TpmClearStoredPassword method and returns true when the call |
| 130 // succeeds. This method blocks until the call returns. | 132 // succeeds. This method blocks until the call returns. |
| 131 virtual bool TpmClearStoredPassword() = 0; | 133 virtual bool TpmClearStoredPassword() = 0; |
| 132 | 134 |
| 133 // Calls Pkcs11IsTpmTokenReady method. | 135 // Calls Pkcs11IsTpmTokenReady method. |
| 134 virtual void Pkcs11IsTpmTokenReady(const BoolMethodCallback& callback) = 0; | 136 virtual void Pkcs11IsTpmTokenReady(const BoolMethodCallback& callback) = 0; |
| 135 | 137 |
| 136 // Calls Pkcs11GetTpmTokenInfo method. | 138 // Calls Pkcs11GetTpmTokenInfo method. |
| 137 virtual void Pkcs11GetTpmTokenInfo( | 139 virtual void Pkcs11GetTpmTokenInfo( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 // Create() should be used instead. | 172 // Create() should be used instead. |
| 171 CryptohomeClient(); | 173 CryptohomeClient(); |
| 172 | 174 |
| 173 private: | 175 private: |
| 174 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); | 176 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); |
| 175 }; | 177 }; |
| 176 | 178 |
| 177 } // namespace chromeos | 179 } // namespace chromeos |
| 178 | 180 |
| 179 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 181 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
| OLD | NEW |