| 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 15 matching lines...) Expand all Loading... |
| 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 returning a bool value. | 33 // A callback to handle responses of methods returning a bool value. |
| 34 typedef base::Callback<void(DBusMethodCallStatus call_status, | 34 typedef base::Callback<void(DBusMethodCallStatus call_status, |
| 35 bool result)> BoolMethodCallback; | 35 bool result)> BoolMethodCallback; |
| 36 // A callback to handle responses of methods returning a string value. |
| 37 typedef base::Callback<void(DBusMethodCallStatus call_status, |
| 38 const std::string& result)> StringMethodCallback; |
| 36 // A callback to handle responses of Pkcs11GetTpmTokenInfo method. | 39 // A callback to handle responses of Pkcs11GetTpmTokenInfo method. |
| 37 typedef base::Callback<void( | 40 typedef base::Callback<void( |
| 38 DBusMethodCallStatus call_status, | 41 DBusMethodCallStatus call_status, |
| 39 const std::string& label, | 42 const std::string& label, |
| 40 const std::string& user_pin)> Pkcs11GetTpmTokenInfoCallback; | 43 const std::string& user_pin)> Pkcs11GetTpmTokenInfoCallback; |
| 41 | 44 |
| 42 virtual ~CryptohomeClient(); | 45 virtual ~CryptohomeClient(); |
| 43 | 46 |
| 44 // Factory function, creates a new instance and returns ownership. | 47 // Factory function, creates a new instance and returns ownership. |
| 45 // For normal usage, access the singleton via DBusThreadManager::Get(). | 48 // For normal usage, access the singleton via DBusThreadManager::Get(). |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // succeeds. | 93 // succeeds. |
| 91 virtual void AsyncMount(const std::string& username, | 94 virtual void AsyncMount(const std::string& username, |
| 92 const std::string& key, | 95 const std::string& key, |
| 93 const bool create_if_missing, | 96 const bool create_if_missing, |
| 94 const AsyncMethodCallback& callback) = 0; | 97 const AsyncMethodCallback& callback) = 0; |
| 95 | 98 |
| 96 // Calls AsyncMountGuest method. |callback| is called after the method call | 99 // Calls AsyncMountGuest method. |callback| is called after the method call |
| 97 // succeeds. | 100 // succeeds. |
| 98 virtual void AsyncMountGuest(const AsyncMethodCallback& callback) = 0; | 101 virtual void AsyncMountGuest(const AsyncMethodCallback& callback) = 0; |
| 99 | 102 |
| 100 // Calls TpmIsReady method and returns true when the call succeeds. | 103 // Calls TpmIsReady method. |
| 101 // This method blocks until the call returns. | 104 virtual void TpmIsReady(const BoolMethodCallback& callback) = 0; |
| 102 virtual bool TpmIsReady(bool* ready) = 0; | |
| 103 | 105 |
| 104 // Calls TpmIsEnabled method. | 106 // Calls TpmIsEnabled method. |
| 105 virtual void TpmIsEnabled(const BoolMethodCallback& callback) = 0; | 107 virtual void TpmIsEnabled(const BoolMethodCallback& callback) = 0; |
| 106 | 108 |
| 107 // Calls TpmIsEnabled method and returns true when the call succeeds. | 109 // Calls TpmIsEnabled method and returns true when the call succeeds. |
| 108 // This method blocks until the call returns. | 110 // This method blocks until the call returns. |
| 109 // TODO(hashimoto): Remove this method. crosbug.com/28500 | 111 // TODO(hashimoto): Remove this method. crosbug.com/28500 |
| 110 virtual bool CallTpmIsEnabledAndBlock(bool* enabled) = 0; | 112 virtual bool CallTpmIsEnabledAndBlock(bool* enabled) = 0; |
| 111 | 113 |
| 112 // Calls TpmGetPassword method and returns true when the call succeeds. | 114 // Calls TpmGetPassword method. |
| 113 // This method blocks until the call returns. | 115 virtual void TpmGetPassword(const StringMethodCallback& callback) = 0; |
| 114 // The original content of |password| is lost. | |
| 115 virtual bool TpmGetPassword(std::string* password) = 0; | |
| 116 | 116 |
| 117 // Calls TpmIsOwned method and returns true when the call succeeds. | 117 // Calls TpmIsOwned method and returns true when the call succeeds. |
| 118 // This method blocks until the call returns. | 118 // This method blocks until the call returns. |
| 119 virtual bool TpmIsOwned(bool* owned) = 0; | 119 virtual bool TpmIsOwned(bool* owned) = 0; |
| 120 | 120 |
| 121 // Calls TpmIsBeingOwned method and returns true when the call succeeds. | 121 // Calls TpmIsBeingOwned method and returns true when the call succeeds. |
| 122 // This method blocks until the call returns. | 122 // This method blocks until the call returns. |
| 123 virtual bool TpmIsBeingOwned(bool* owning) = 0; | 123 virtual bool TpmIsBeingOwned(bool* owning) = 0; |
| 124 | 124 |
| 125 // Calls TpmCanAttemptOwnership method and returns true when the call | 125 // Calls TpmCanAttemptOwnership method and returns true when the call |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 // Create() should be used instead. | 170 // Create() should be used instead. |
| 171 CryptohomeClient(); | 171 CryptohomeClient(); |
| 172 | 172 |
| 173 private: | 173 private: |
| 174 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); | 174 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); |
| 175 }; | 175 }; |
| 176 | 176 |
| 177 } // namespace chromeos | 177 } // namespace chromeos |
| 178 | 178 |
| 179 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 179 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
| OLD | NEW |