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; |
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 virtual void TpmGetPassword(const StringMethodCallback& callback) = 0; | 117 virtual void TpmGetPassword(const StringMethodCallback& callback) = 0; |
115 | 118 |
116 // Calls TpmIsOwned method and returns true when the call succeeds. | 119 // Calls TpmIsOwned method and returns true when the call succeeds. |
117 // This method blocks until the call returns. | 120 // This method blocks until the call returns. |
118 virtual bool TpmIsOwned(bool* owned) = 0; | 121 virtual bool TpmIsOwned(bool* owned) = 0; |
119 | 122 |
120 // Calls TpmIsBeingOwned method and returns true when the call succeeds. | 123 // Calls TpmIsBeingOwned method and returns true when the call succeeds. |
121 // This method blocks until the call returns. | 124 // This method blocks until the call returns. |
122 virtual bool TpmIsBeingOwned(bool* owning) = 0; | 125 virtual bool TpmIsBeingOwned(bool* owning) = 0; |
123 | 126 |
124 // Calls TpmCanAttemptOwnership method and returns true when the call | 127 // Calls TpmCanAttemptOwnership method. |
125 // succeeds. This method blocks until the call returns. | 128 // This method tells the service that it is OK to attempt ownership. |
126 virtual bool TpmCanAttemptOwnership() = 0; | 129 virtual void TpmCanAttemptOwnership(const VoidMethodCallback& callback) = 0; |
127 | 130 |
128 // Calls TpmClearStoredPassword method and returns true when the call | 131 // Calls TpmClearStoredPassword method and returns true when the call |
129 // succeeds. This method blocks until the call returns. | 132 // succeeds. This method blocks until the call returns. |
130 virtual bool TpmClearStoredPassword() = 0; | 133 virtual bool TpmClearStoredPassword() = 0; |
131 | 134 |
132 // Calls Pkcs11IsTpmTokenReady method. | 135 // Calls Pkcs11IsTpmTokenReady method. |
133 virtual void Pkcs11IsTpmTokenReady(const BoolMethodCallback& callback) = 0; | 136 virtual void Pkcs11IsTpmTokenReady(const BoolMethodCallback& callback) = 0; |
134 | 137 |
135 // Calls Pkcs11GetTpmTokenInfo method. | 138 // Calls Pkcs11GetTpmTokenInfo method. |
136 virtual void Pkcs11GetTpmTokenInfo( | 139 virtual void Pkcs11GetTpmTokenInfo( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // Create() should be used instead. | 172 // Create() should be used instead. |
170 CryptohomeClient(); | 173 CryptohomeClient(); |
171 | 174 |
172 private: | 175 private: |
173 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); | 176 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); |
174 }; | 177 }; |
175 | 178 |
176 } // namespace chromeos | 179 } // namespace chromeos |
177 | 180 |
178 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 181 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
OLD | NEW |