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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 // Factory function, creates a new instance and returns ownership. | 45 // Factory function, creates a new instance and returns ownership. |
46 // For normal usage, access the singleton via DBusThreadManager::Get(). | 46 // For normal usage, access the singleton via DBusThreadManager::Get(). |
47 static CryptohomeClient* Create(DBusClientImplementationType type, | 47 static CryptohomeClient* Create(DBusClientImplementationType type, |
48 dbus::Bus* bus); | 48 dbus::Bus* bus); |
49 | 49 |
50 // Sets AsyncCallStatus signal handler. | 50 // Sets AsyncCallStatus signal handler. |
51 // |handler| is called when results for AsyncXXX methods are returned. | 51 // |handler| is called when results for AsyncXXX methods are returned. |
52 // Cryptohome service will process the calls in a first-in-first-out manner | 52 // Cryptohome service will process the calls in a first-in-first-out manner |
53 // when they are made in parallel. | 53 // when they are made in parallel. |
54 virtual void SetAsyncCallStatusHandler(AsyncCallStatusHandler handler) = 0; | 54 virtual void SetAsyncCallStatusHandler( |
| 55 const AsyncCallStatusHandler& handler) = 0; |
55 | 56 |
56 // Resets AsyncCallStatus signal handler. | 57 // Resets AsyncCallStatus signal handler. |
57 virtual void ResetAsyncCallStatusHandler() = 0; | 58 virtual void ResetAsyncCallStatusHandler() = 0; |
58 | 59 |
59 // Calls IsMounted method and returns true when the call succeeds. | 60 // Calls IsMounted method and returns true when the call succeeds. |
60 // This method blocks until the call returns. | 61 // This method blocks until the call returns. |
61 virtual bool IsMounted(bool* is_mounted) = 0; | 62 virtual bool IsMounted(bool* is_mounted) = 0; |
62 | 63 |
63 // Calls Unmount method and returns true when the call succeeds. | 64 // Calls Unmount method and returns true when the call succeeds. |
64 // This method blocks until the call returns. | 65 // This method blocks until the call returns. |
65 virtual bool Unmount(bool* success) = 0; | 66 virtual bool Unmount(bool* success) = 0; |
66 | 67 |
67 // Calls AsyncCheckKey method. |callback| is called after the method call | 68 // Calls AsyncCheckKey method. |callback| is called after the method call |
68 // succeeds. | 69 // succeeds. |
69 virtual void AsyncCheckKey(const std::string& username, | 70 virtual void AsyncCheckKey(const std::string& username, |
70 const std::string& key, | 71 const std::string& key, |
71 AsyncMethodCallback callback) = 0; | 72 const AsyncMethodCallback& callback) = 0; |
72 | 73 |
73 // Calls AsyncMigrateKey method. |callback| is called after the method call | 74 // Calls AsyncMigrateKey method. |callback| is called after the method call |
74 // succeeds. | 75 // succeeds. |
75 virtual void AsyncMigrateKey(const std::string& username, | 76 virtual void AsyncMigrateKey(const std::string& username, |
76 const std::string& from_key, | 77 const std::string& from_key, |
77 const std::string& to_key, | 78 const std::string& to_key, |
78 AsyncMethodCallback callback) = 0; | 79 const AsyncMethodCallback& callback) = 0; |
79 | 80 |
80 // Calls AsyncRemove method. |callback| is called after the method call | 81 // Calls AsyncRemove method. |callback| is called after the method call |
81 // succeeds. | 82 // succeeds. |
82 virtual void AsyncRemove(const std::string& username, | 83 virtual void AsyncRemove(const std::string& username, |
83 AsyncMethodCallback callback) = 0; | 84 const AsyncMethodCallback& callback) = 0; |
84 | 85 |
85 // Calls GetSystemSalt method. This method blocks until the call returns. | 86 // Calls GetSystemSalt method. This method blocks until the call returns. |
86 // The original content of |salt| is lost. | 87 // The original content of |salt| is lost. |
87 virtual bool GetSystemSalt(std::vector<uint8>* salt) = 0; | 88 virtual bool GetSystemSalt(std::vector<uint8>* salt) = 0; |
88 | 89 |
89 // Calls AsyncMount method. |callback| is called after the method call | 90 // Calls AsyncMount method. |callback| is called after the method call |
90 // succeeds. | 91 // succeeds. |
91 virtual void AsyncMount(const std::string& username, | 92 virtual void AsyncMount(const std::string& username, |
92 const std::string& key, | 93 const std::string& key, |
93 const bool create_if_missing, | 94 const bool create_if_missing, |
94 AsyncMethodCallback callback) = 0; | 95 const AsyncMethodCallback& callback) = 0; |
95 | 96 |
96 // Calls AsyncMountGuest method. |callback| is called after the method call | 97 // Calls AsyncMountGuest method. |callback| is called after the method call |
97 // succeeds. | 98 // succeeds. |
98 virtual void AsyncMountGuest(AsyncMethodCallback callback) = 0; | 99 virtual void AsyncMountGuest(const AsyncMethodCallback& callback) = 0; |
99 | 100 |
100 // Calls TpmIsReady method and returns true when the call succeeds. | 101 // Calls TpmIsReady method and returns true when the call succeeds. |
101 // This method blocks until the call returns. | 102 // This method blocks until the call returns. |
102 virtual bool TpmIsReady(bool* ready) = 0; | 103 virtual bool TpmIsReady(bool* ready) = 0; |
103 | 104 |
104 // Calls TpmIsEnabled method. | 105 // Calls TpmIsEnabled method. |
105 virtual void TpmIsEnabled(BoolMethodCallback callback) = 0; | 106 virtual void TpmIsEnabled(const BoolMethodCallback& callback) = 0; |
106 | 107 |
107 // Calls TpmIsEnabled method and returns true when the call succeeds. | 108 // Calls TpmIsEnabled method and returns true when the call succeeds. |
108 // This method blocks until the call returns. | 109 // This method blocks until the call returns. |
109 // TODO(hashimoto): Remove this method. crosbug.com/28500 | 110 // TODO(hashimoto): Remove this method. crosbug.com/28500 |
110 virtual bool CallTpmIsEnabledAndBlock(bool* enabled) = 0; | 111 virtual bool CallTpmIsEnabledAndBlock(bool* enabled) = 0; |
111 | 112 |
112 // Calls TpmGetPassword method and returns true when the call succeeds. | 113 // Calls TpmGetPassword method and returns true when the call succeeds. |
113 // This method blocks until the call returns. | 114 // This method blocks until the call returns. |
114 // The original content of |password| is lost. | 115 // The original content of |password| is lost. |
115 virtual bool TpmGetPassword(std::string* password) = 0; | 116 virtual bool TpmGetPassword(std::string* password) = 0; |
116 | 117 |
117 // Calls TpmIsOwned method and returns true when the call succeeds. | 118 // Calls TpmIsOwned method and returns true when the call succeeds. |
118 // This method blocks until the call returns. | 119 // This method blocks until the call returns. |
119 virtual bool TpmIsOwned(bool* owned) = 0; | 120 virtual bool TpmIsOwned(bool* owned) = 0; |
120 | 121 |
121 // Calls TpmIsBeingOwned method and returns true when the call succeeds. | 122 // Calls TpmIsBeingOwned method and returns true when the call succeeds. |
122 // This method blocks until the call returns. | 123 // This method blocks until the call returns. |
123 virtual bool TpmIsBeingOwned(bool* owning) = 0; | 124 virtual bool TpmIsBeingOwned(bool* owning) = 0; |
124 | 125 |
125 // Calls TpmCanAttemptOwnership method and returns true when the call | 126 // Calls TpmCanAttemptOwnership method and returns true when the call |
126 // succeeds. This method blocks until the call returns. | 127 // succeeds. This method blocks until the call returns. |
127 virtual bool TpmCanAttemptOwnership() = 0; | 128 virtual bool TpmCanAttemptOwnership() = 0; |
128 | 129 |
129 // Calls TpmClearStoredPassword method and returns true when the call | 130 // Calls TpmClearStoredPassword method and returns true when the call |
130 // succeeds. This method blocks until the call returns. | 131 // succeeds. This method blocks until the call returns. |
131 virtual bool TpmClearStoredPassword() = 0; | 132 virtual bool TpmClearStoredPassword() = 0; |
132 | 133 |
133 // Calls Pkcs11IsTpmTokenReady method. | 134 // Calls Pkcs11IsTpmTokenReady method. |
134 virtual void Pkcs11IsTpmTokenReady(BoolMethodCallback callback) = 0; | 135 virtual void Pkcs11IsTpmTokenReady(const BoolMethodCallback& callback) = 0; |
135 | 136 |
136 // Calls Pkcs11GetTpmTokenInfo method. | 137 // Calls Pkcs11GetTpmTokenInfo method. |
137 virtual void Pkcs11GetTpmTokenInfo( | 138 virtual void Pkcs11GetTpmTokenInfo( |
138 Pkcs11GetTpmTokenInfoCallback callback) = 0; | 139 const Pkcs11GetTpmTokenInfoCallback& callback) = 0; |
139 | 140 |
140 // Calls InstallAttributesGet method and returns true when the call succeeds. | 141 // Calls InstallAttributesGet method and returns true when the call succeeds. |
141 // This method blocks until the call returns. | 142 // This method blocks until the call returns. |
142 // The original content of |value| is lost. | 143 // The original content of |value| is lost. |
143 virtual bool InstallAttributesGet(const std::string& name, | 144 virtual bool InstallAttributesGet(const std::string& name, |
144 std::vector<uint8>* value, | 145 std::vector<uint8>* value, |
145 bool* successful) = 0; | 146 bool* successful) = 0; |
146 | 147 |
147 // Calls InstallAttributesSet method and returns true when the call succeeds. | 148 // Calls InstallAttributesSet method and returns true when the call succeeds. |
148 // This method blocks until the call returns. | 149 // This method blocks until the call returns. |
(...skipping 21 matching lines...) Expand all Loading... |
170 // Create() should be used instead. | 171 // Create() should be used instead. |
171 CryptohomeClient(); | 172 CryptohomeClient(); |
172 | 173 |
173 private: | 174 private: |
174 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); | 175 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); |
175 }; | 176 }; |
176 | 177 |
177 } // namespace chromeos | 178 } // namespace chromeos |
178 | 179 |
179 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 180 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
OLD | NEW |