| 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 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "chromeos/attestation/attestation_constants.h" | 13 #include "chromeos/attestation/attestation_constants.h" |
| 14 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
| 15 #include "chromeos/dbus/dbus_client.h" | 15 #include "chromeos/dbus/dbus_client.h" |
| 16 #include "chromeos/dbus/dbus_client_implementation_type.h" | |
| 17 #include "chromeos/dbus/dbus_method_call_status.h" | 16 #include "chromeos/dbus/dbus_method_call_status.h" |
| 18 | 17 |
| 19 namespace chromeos { | 18 namespace chromeos { |
| 20 | 19 |
| 21 // CryptohomeClient is used to communicate with the Cryptohome service. | 20 // CryptohomeClient is used to communicate with the Cryptohome service. |
| 22 // All method should be called from the origin thread (UI thread) which | 21 // All method should be called from the origin thread (UI thread) which |
| 23 // initializes the DBusThreadManager instance. | 22 // initializes the DBusThreadManager instance. |
| 24 class CHROMEOS_EXPORT CryptohomeClient : public DBusClient { | 23 class CHROMEOS_EXPORT CryptohomeClient : public DBusClient { |
| 25 public: | 24 public: |
| 26 // A callback to handle AsyncCallStatus signals. | 25 // A callback to handle AsyncCallStatus signals. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 57 int slot)> Pkcs11GetTpmTokenInfoCallback; | 56 int slot)> Pkcs11GetTpmTokenInfoCallback; |
| 58 // A callback for methods which return both a bool result and data. | 57 // A callback for methods which return both a bool result and data. |
| 59 typedef base::Callback<void(DBusMethodCallStatus call_status, | 58 typedef base::Callback<void(DBusMethodCallStatus call_status, |
| 60 bool result, | 59 bool result, |
| 61 const std::string& data)> DataMethodCallback; | 60 const std::string& data)> DataMethodCallback; |
| 62 | 61 |
| 63 virtual ~CryptohomeClient(); | 62 virtual ~CryptohomeClient(); |
| 64 | 63 |
| 65 // Factory function, creates a new instance and returns ownership. | 64 // Factory function, creates a new instance and returns ownership. |
| 66 // For normal usage, access the singleton via DBusThreadManager::Get(). | 65 // For normal usage, access the singleton via DBusThreadManager::Get(). |
| 67 static CryptohomeClient* Create(DBusClientImplementationType type); | 66 static CryptohomeClient* Create(); |
| 68 | 67 |
| 69 // Returns the sanitized |username| that the stub implementation would return. | 68 // Returns the sanitized |username| that the stub implementation would return. |
| 70 static std::string GetStubSanitizedUsername(const std::string& username); | 69 static std::string GetStubSanitizedUsername(const std::string& username); |
| 71 | 70 |
| 72 // Sets AsyncCallStatus signal handlers. | 71 // Sets AsyncCallStatus signal handlers. |
| 73 // |handler| is called when results for AsyncXXX methods are returned. | 72 // |handler| is called when results for AsyncXXX methods are returned. |
| 74 // Cryptohome service will process the calls in a first-in-first-out manner | 73 // Cryptohome service will process the calls in a first-in-first-out manner |
| 75 // when they are made in parallel. | 74 // when they are made in parallel. |
| 76 virtual void SetAsyncCallStatusHandlers( | 75 virtual void SetAsyncCallStatusHandlers( |
| 77 const AsyncCallStatusHandler& handler, | 76 const AsyncCallStatusHandler& handler, |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 // Create() should be used instead. | 430 // Create() should be used instead. |
| 432 CryptohomeClient(); | 431 CryptohomeClient(); |
| 433 | 432 |
| 434 private: | 433 private: |
| 435 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); | 434 DISALLOW_COPY_AND_ASSIGN(CryptohomeClient); |
| 436 }; | 435 }; |
| 437 | 436 |
| 438 } // namespace chromeos | 437 } // namespace chromeos |
| 439 | 438 |
| 440 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ | 439 #endif // CHROMEOS_DBUS_CRYPTOHOME_CLIENT_H_ |
| OLD | NEW |