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 17 matching lines...) Expand all Loading... |
28 bool return_status, | 28 bool return_status, |
29 int return_code)> | 29 int return_code)> |
30 AsyncCallStatusHandler; | 30 AsyncCallStatusHandler; |
31 // A callback to handle AsyncCallStatusWithData signals. | 31 // A callback to handle AsyncCallStatusWithData signals. |
32 typedef base::Callback<void(int async_id, | 32 typedef base::Callback<void(int async_id, |
33 bool return_status, | 33 bool return_status, |
34 const std::string& data)> | 34 const std::string& data)> |
35 AsyncCallStatusWithDataHandler; | 35 AsyncCallStatusWithDataHandler; |
36 // A callback to handle responses of AsyncXXX methods. | 36 // A callback to handle responses of AsyncXXX methods. |
37 typedef base::Callback<void(int async_id)> AsyncMethodCallback; | 37 typedef base::Callback<void(int async_id)> AsyncMethodCallback; |
| 38 // A callback for WaitForServiceToBeAvailable(). |
| 39 typedef base::Callback<void(bool service_is_ready)> |
| 40 WaitForServiceToBeAvailableCallback; |
38 // A callback to handle responses of Pkcs11GetTpmTokenInfo method. The result | 41 // A callback to handle responses of Pkcs11GetTpmTokenInfo method. The result |
39 // of the D-Bus call is in |call_status|. On success, |label| holds the | 42 // of the D-Bus call is in |call_status|. On success, |label| holds the |
40 // PKCS #11 token label. This is not useful in practice to identify a token | 43 // PKCS #11 token label. This is not useful in practice to identify a token |
41 // but may be meaningful to a user. The |user_pin| can be used with the | 44 // but may be meaningful to a user. The |user_pin| can be used with the |
42 // C_Login PKCS #11 function but is not necessary because tokens are logged in | 45 // C_Login PKCS #11 function but is not necessary because tokens are logged in |
43 // for the duration of a signed-in session. The |slot| corresponds to a | 46 // for the duration of a signed-in session. The |slot| corresponds to a |
44 // CK_SLOT_ID for the PKCS #11 API and reliably identifies the token for the | 47 // CK_SLOT_ID for the PKCS #11 API and reliably identifies the token for the |
45 // duration of the signed-in session. | 48 // duration of the signed-in session. |
46 typedef base::Callback<void( | 49 typedef base::Callback<void( |
47 DBusMethodCallStatus call_status, | 50 DBusMethodCallStatus call_status, |
(...skipping 18 matching lines...) Expand all Loading... |
66 // |handler| is called when results for AsyncXXX methods are returned. | 69 // |handler| is called when results for AsyncXXX methods are returned. |
67 // Cryptohome service will process the calls in a first-in-first-out manner | 70 // Cryptohome service will process the calls in a first-in-first-out manner |
68 // when they are made in parallel. | 71 // when they are made in parallel. |
69 virtual void SetAsyncCallStatusHandlers( | 72 virtual void SetAsyncCallStatusHandlers( |
70 const AsyncCallStatusHandler& handler, | 73 const AsyncCallStatusHandler& handler, |
71 const AsyncCallStatusWithDataHandler& data_handler) = 0; | 74 const AsyncCallStatusWithDataHandler& data_handler) = 0; |
72 | 75 |
73 // Resets AsyncCallStatus signal handlers. | 76 // Resets AsyncCallStatus signal handlers. |
74 virtual void ResetAsyncCallStatusHandlers() = 0; | 77 virtual void ResetAsyncCallStatusHandlers() = 0; |
75 | 78 |
| 79 // Runs the callback as soon as the service becomes available. |
| 80 virtual void WaitForServiceToBeAvailable( |
| 81 const WaitForServiceToBeAvailableCallback& callback) = 0; |
| 82 |
76 // Calls IsMounted method and returns true when the call succeeds. | 83 // Calls IsMounted method and returns true when the call succeeds. |
77 virtual void IsMounted(const BoolDBusMethodCallback& callback) = 0; | 84 virtual void IsMounted(const BoolDBusMethodCallback& callback) = 0; |
78 | 85 |
79 // Calls Unmount method and returns true when the call succeeds. | 86 // Calls Unmount method and returns true when the call succeeds. |
80 // This method blocks until the call returns. | 87 // This method blocks until the call returns. |
81 virtual bool Unmount(bool* success) = 0; | 88 virtual bool Unmount(bool* success) = 0; |
82 | 89 |
83 // Calls AsyncCheckKey method. |callback| is called after the method call | 90 // Calls AsyncCheckKey method. |callback| is called after the method call |
84 // succeeds. | 91 // succeeds. |
85 virtual void AsyncCheckKey(const std::string& username, | 92 virtual void AsyncCheckKey(const std::string& username, |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 // Create() should be used instead. | 413 // Create() should be used instead. |
407 CryptohomeClient(); | 414 CryptohomeClient(); |
408 | 415 |
409 private: | 416 private: |
410 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); | 417 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); |
411 }; | 418 }; |
412 | 419 |
413 } // namespace chromeos | 420 } // namespace chromeos |
414 | 421 |
415 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 422 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
OLD | NEW |