Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: chromeos/dbus/fake_cryptohome_client.h

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_FAKE_CRYPTOHOME_CLIENT_H_ 5 #ifndef CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_
6 #define CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ 6 #define CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "chromeos/dbus/cryptohome_client.h" 12 #include "chromeos/dbus/cryptohome_client.h"
13 13
14 namespace chromeos { 14 namespace chromeos {
15 15
16 class CHROMEOS_EXPORT FakeCryptohomeClient : public CryptohomeClient { 16 class CHROMEOS_EXPORT FakeCryptohomeClient : public CryptohomeClient {
17 public: 17 public:
18 FakeCryptohomeClient(); 18 FakeCryptohomeClient();
19 ~FakeCryptohomeClient() override; 19 ~FakeCryptohomeClient() override;
20 20
21 void Init(dbus::Bus* bus) override; 21 void Init(dbus::Bus* bus) override;
22 void SetAsyncCallStatusHandlers( 22 void SetAsyncCallStatusHandlers(
23 const AsyncCallStatusHandler& handler, 23 const AsyncCallStatusHandler& handler,
24 const AsyncCallStatusWithDataHandler& data_handler) override; 24 const AsyncCallStatusWithDataHandler& data_handler) override;
25 void ResetAsyncCallStatusHandlers() override; 25 void ResetAsyncCallStatusHandlers() override;
26 void WaitForServiceToBeAvailable( 26 void WaitForServiceToBeAvailable(
27 const WaitForServiceToBeAvailableCallback& callback) override; 27 const WaitForServiceToBeAvailableCallback& callback) override;
28 void IsMounted(const BoolDBusMethodCallback& callback) override; 28 void IsMounted(const BoolDBusMethodCallback& callback) override;
29 bool Unmount(bool* success) override; 29 bool Unmount(bool* success) override;
30 void AsyncCheckKey(const std::string& username, 30 void AsyncCheckKey(const user_manager::UserID& user_id,
31 const std::string& key, 31 const std::string& key,
32 const AsyncMethodCallback& callback) override; 32 const AsyncMethodCallback& callback) override;
33 void AsyncMigrateKey(const std::string& username, 33 void AsyncMigrateKey(const user_manager::UserID& user_id,
34 const std::string& from_key, 34 const std::string& from_key,
35 const std::string& to_key, 35 const std::string& to_key,
36 const AsyncMethodCallback& callback) override; 36 const AsyncMethodCallback& callback) override;
37 void AsyncRemove(const std::string& username, 37 void AsyncRemove(const user_manager::UserID& user_id,
38 const AsyncMethodCallback& callback) override; 38 const AsyncMethodCallback& callback) override;
39 void GetSystemSalt(const GetSystemSaltCallback& callback) override; 39 void GetSystemSalt(const GetSystemSaltCallback& callback) override;
40 void GetSanitizedUsername(const std::string& username, 40 void GetSanitizedUsername(const user_manager::UserID& user_id,
41 const StringDBusMethodCallback& callback) override; 41 const StringDBusMethodCallback& callback) override;
42 std::string BlockingGetSanitizedUsername( 42 std::string BlockingGetSanitizedUsername(
43 const std::string& username) override; 43 const user_manager::UserID& user_id) override;
44 void AsyncMount(const std::string& username, 44 void AsyncMount(const user_manager::UserID& user_id,
45 const std::string& key, 45 const std::string& key,
46 int flags, 46 int flags,
47 const AsyncMethodCallback& callback) override; 47 const AsyncMethodCallback& callback) override;
48 void AsyncAddKey(const std::string& username, 48 void AsyncAddKey(const user_manager::UserID& user_id,
49 const std::string& key, 49 const std::string& key,
50 const std::string& new_key, 50 const std::string& new_key,
51 const AsyncMethodCallback& callback) override; 51 const AsyncMethodCallback& callback) override;
52 void AsyncMountGuest(const AsyncMethodCallback& callback) override; 52 void AsyncMountGuest(const AsyncMethodCallback& callback) override;
53 void AsyncMountPublic(const std::string& public_mount_id, 53 void AsyncMountPublic(const std::string& public_mount_id,
54 int flags, 54 int flags,
55 const AsyncMethodCallback& callback) override; 55 const AsyncMethodCallback& callback) override;
56 void TpmIsReady(const BoolDBusMethodCallback& callback) override; 56 void TpmIsReady(const BoolDBusMethodCallback& callback) override;
57 void TpmIsEnabled(const BoolDBusMethodCallback& callback) override; 57 void TpmIsEnabled(const BoolDBusMethodCallback& callback) override;
58 bool CallTpmIsEnabledAndBlock(bool* enabled) override; 58 bool CallTpmIsEnabledAndBlock(bool* enabled) override;
59 void TpmGetPassword(const StringDBusMethodCallback& callback) override; 59 void TpmGetPassword(const StringDBusMethodCallback& callback) override;
60 void TpmIsOwned(const BoolDBusMethodCallback& callback) override; 60 void TpmIsOwned(const BoolDBusMethodCallback& callback) override;
61 bool CallTpmIsOwnedAndBlock(bool* owned) override; 61 bool CallTpmIsOwnedAndBlock(bool* owned) override;
62 void TpmIsBeingOwned(const BoolDBusMethodCallback& callback) override; 62 void TpmIsBeingOwned(const BoolDBusMethodCallback& callback) override;
63 bool CallTpmIsBeingOwnedAndBlock(bool* owning) override; 63 bool CallTpmIsBeingOwnedAndBlock(bool* owning) override;
64 void TpmCanAttemptOwnership(const VoidDBusMethodCallback& callback) override; 64 void TpmCanAttemptOwnership(const VoidDBusMethodCallback& callback) override;
65 void TpmClearStoredPassword(const VoidDBusMethodCallback& callback) override; 65 void TpmClearStoredPassword(const VoidDBusMethodCallback& callback) override;
66 bool CallTpmClearStoredPasswordAndBlock() override; 66 bool CallTpmClearStoredPasswordAndBlock() override;
67 void Pkcs11IsTpmTokenReady(const BoolDBusMethodCallback& callback) override; 67 void Pkcs11IsTpmTokenReady(const BoolDBusMethodCallback& callback) override;
68 void Pkcs11GetTpmTokenInfo( 68 void Pkcs11GetTpmTokenInfo(
69 const Pkcs11GetTpmTokenInfoCallback& callback) override; 69 const Pkcs11GetTpmTokenInfoCallback& callback) override;
70 void Pkcs11GetTpmTokenInfoForUser( 70 void Pkcs11GetTpmTokenInfoForUser(
71 const std::string& username, 71 const user_manager::UserID& user_id,
72 const Pkcs11GetTpmTokenInfoCallback& callback) override; 72 const Pkcs11GetTpmTokenInfoCallback& callback) override;
73 bool InstallAttributesGet(const std::string& name, 73 bool InstallAttributesGet(const std::string& name,
74 std::vector<uint8>* value, 74 std::vector<uint8>* value,
75 bool* successful) override; 75 bool* successful) override;
76 bool InstallAttributesSet(const std::string& name, 76 bool InstallAttributesSet(const std::string& name,
77 const std::vector<uint8>& value, 77 const std::vector<uint8>& value,
78 bool* successful) override; 78 bool* successful) override;
79 bool InstallAttributesFinalize(bool* successful) override; 79 bool InstallAttributesFinalize(bool* successful) override;
80 void InstallAttributesIsReady( 80 void InstallAttributesIsReady(
81 const BoolDBusMethodCallback& callback) override; 81 const BoolDBusMethodCallback& callback) override;
82 bool InstallAttributesIsInvalid(bool* is_invalid) override; 82 bool InstallAttributesIsInvalid(bool* is_invalid) override;
83 bool InstallAttributesIsFirstInstall(bool* is_first_install) override; 83 bool InstallAttributesIsFirstInstall(bool* is_first_install) override;
84 void TpmAttestationIsPrepared( 84 void TpmAttestationIsPrepared(
85 const BoolDBusMethodCallback& callback) override; 85 const BoolDBusMethodCallback& callback) override;
86 void TpmAttestationIsEnrolled( 86 void TpmAttestationIsEnrolled(
87 const BoolDBusMethodCallback& callback) override; 87 const BoolDBusMethodCallback& callback) override;
88 void AsyncTpmAttestationCreateEnrollRequest( 88 void AsyncTpmAttestationCreateEnrollRequest(
89 chromeos::attestation::PrivacyCAType pca_type, 89 chromeos::attestation::PrivacyCAType pca_type,
90 const AsyncMethodCallback& callback) override; 90 const AsyncMethodCallback& callback) override;
91 void AsyncTpmAttestationEnroll(chromeos::attestation::PrivacyCAType pca_type, 91 void AsyncTpmAttestationEnroll(chromeos::attestation::PrivacyCAType pca_type,
92 const std::string& pca_response, 92 const std::string& pca_response,
93 const AsyncMethodCallback& callback) override; 93 const AsyncMethodCallback& callback) override;
94 void AsyncTpmAttestationCreateCertRequest( 94 void AsyncTpmAttestationCreateCertRequest(
95 chromeos::attestation::PrivacyCAType pca_type, 95 chromeos::attestation::PrivacyCAType pca_type,
96 attestation::AttestationCertificateProfile certificate_profile, 96 attestation::AttestationCertificateProfile certificate_profile,
97 const std::string& user_id, 97 const user_manager::UserID& user_id,
98 const std::string& request_origin, 98 const std::string& request_origin,
99 const AsyncMethodCallback& callback) override; 99 const AsyncMethodCallback& callback) override;
100 void AsyncTpmAttestationFinishCertRequest( 100 void AsyncTpmAttestationFinishCertRequest(
101 const std::string& pca_response, 101 const std::string& pca_response,
102 attestation::AttestationKeyType key_type, 102 attestation::AttestationKeyType key_type,
103 const std::string& user_id, 103 const user_manager::UserID& user_id,
104 const std::string& key_name, 104 const std::string& key_name,
105 const AsyncMethodCallback& callback) override; 105 const AsyncMethodCallback& callback) override;
106 void TpmAttestationDoesKeyExist( 106 void TpmAttestationDoesKeyExist(
107 attestation::AttestationKeyType key_type, 107 attestation::AttestationKeyType key_type,
108 const std::string& user_id, 108 const user_manager::UserID& user_id,
109 const std::string& key_name, 109 const std::string& key_name,
110 const BoolDBusMethodCallback& callback) override; 110 const BoolDBusMethodCallback& callback) override;
111 void TpmAttestationGetCertificate( 111 void TpmAttestationGetCertificate(
112 attestation::AttestationKeyType key_type, 112 attestation::AttestationKeyType key_type,
113 const std::string& user_id, 113 const user_manager::UserID& user_id,
114 const std::string& key_name, 114 const std::string& key_name,
115 const DataMethodCallback& callback) override; 115 const DataMethodCallback& callback) override;
116 void TpmAttestationGetPublicKey(attestation::AttestationKeyType key_type, 116 void TpmAttestationGetPublicKey(attestation::AttestationKeyType key_type,
117 const std::string& user_id, 117 const user_manager::UserID& user_id,
118 const std::string& key_name, 118 const std::string& key_name,
119 const DataMethodCallback& callback) override; 119 const DataMethodCallback& callback) override;
120 void TpmAttestationRegisterKey(attestation::AttestationKeyType key_type, 120 void TpmAttestationRegisterKey(attestation::AttestationKeyType key_type,
121 const std::string& user_id, 121 const user_manager::UserID& user_id,
122 const std::string& key_name, 122 const std::string& key_name,
123 const AsyncMethodCallback& callback) override; 123 const AsyncMethodCallback& callback) override;
124 void TpmAttestationSignEnterpriseChallenge( 124 void TpmAttestationSignEnterpriseChallenge(
125 attestation::AttestationKeyType key_type, 125 attestation::AttestationKeyType key_type,
126 const std::string& user_id, 126 const user_manager::UserID& user_id,
127 const std::string& key_name, 127 const std::string& key_name,
128 const std::string& domain, 128 const std::string& domain,
129 const std::string& device_id, 129 const std::string& device_id,
130 attestation::AttestationChallengeOptions options, 130 attestation::AttestationChallengeOptions options,
131 const std::string& challenge, 131 const std::string& challenge,
132 const AsyncMethodCallback& callback) override; 132 const AsyncMethodCallback& callback) override;
133 void TpmAttestationSignSimpleChallenge( 133 void TpmAttestationSignSimpleChallenge(
134 attestation::AttestationKeyType key_type, 134 attestation::AttestationKeyType key_type,
135 const std::string& user_id, 135 const user_manager::UserID& user_id,
136 const std::string& key_name, 136 const std::string& key_name,
137 const std::string& challenge, 137 const std::string& challenge,
138 const AsyncMethodCallback& callback) override; 138 const AsyncMethodCallback& callback) override;
139 void TpmAttestationGetKeyPayload(attestation::AttestationKeyType key_type, 139 void TpmAttestationGetKeyPayload(attestation::AttestationKeyType key_type,
140 const std::string& user_id, 140 const user_manager::UserID& user_id,
141 const std::string& key_name, 141 const std::string& key_name,
142 const DataMethodCallback& callback) override; 142 const DataMethodCallback& callback) override;
143 void TpmAttestationSetKeyPayload( 143 void TpmAttestationSetKeyPayload(
144 attestation::AttestationKeyType key_type, 144 attestation::AttestationKeyType key_type,
145 const std::string& user_id, 145 const user_manager::UserID& user_id,
146 const std::string& key_name, 146 const std::string& key_name,
147 const std::string& payload, 147 const std::string& payload,
148 const BoolDBusMethodCallback& callback) override; 148 const BoolDBusMethodCallback& callback) override;
149 void TpmAttestationDeleteKeys( 149 void TpmAttestationDeleteKeys(
150 attestation::AttestationKeyType key_type, 150 attestation::AttestationKeyType key_type,
151 const std::string& user_id, 151 const user_manager::UserID& user_id,
152 const std::string& key_prefix, 152 const std::string& key_prefix,
153 const BoolDBusMethodCallback& callback) override; 153 const BoolDBusMethodCallback& callback) override;
154 void GetKeyDataEx(const cryptohome::AccountIdentifier& id, 154 void GetKeyDataEx(const cryptohome::AccountIdentifier& id,
155 const cryptohome::AuthorizationRequest& auth, 155 const cryptohome::AuthorizationRequest& auth,
156 const cryptohome::GetKeyDataRequest& request, 156 const cryptohome::GetKeyDataRequest& request,
157 const ProtobufMethodCallback& callback) override; 157 const ProtobufMethodCallback& callback) override;
158 void CheckKeyEx(const cryptohome::AccountIdentifier& id, 158 void CheckKeyEx(const cryptohome::AccountIdentifier& id,
159 const cryptohome::AuthorizationRequest& auth, 159 const cryptohome::AuthorizationRequest& auth,
160 const cryptohome::CheckKeyRequest& request, 160 const cryptohome::CheckKeyRequest& request,
161 const ProtobufMethodCallback& callback) override; 161 const ProtobufMethodCallback& callback) override;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 std::map<std::string, std::vector<uint8> > install_attrs_; 231 std::map<std::string, std::vector<uint8> > install_attrs_;
232 bool locked_; 232 bool locked_;
233 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; 233 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_;
234 234
235 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); 235 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient);
236 }; 236 };
237 237
238 } // namespace chromeos 238 } // namespace chromeos
239 239
240 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ 240 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698