Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 | 155 |
| 156 // Changes the behavior of WaitForServiceToBeAvailable(). This method runs | 156 // Changes the behavior of WaitForServiceToBeAvailable(). This method runs |
| 157 // pending callbacks if is_available is true. | 157 // pending callbacks if is_available is true. |
| 158 void SetServiceIsAvailable(bool is_available); | 158 void SetServiceIsAvailable(bool is_available); |
| 159 | 159 |
| 160 // Sets the unmount result of Unmount() call. | 160 // Sets the unmount result of Unmount() call. |
| 161 void set_unmount_result(bool result) { | 161 void set_unmount_result(bool result) { |
| 162 unmount_result_= result; | 162 unmount_result_= result; |
| 163 } | 163 } |
| 164 | 164 |
| 165 // Sets the system salt which will be returned from GetSystemSalt(). By | |
|
pneubeck (no reviews)
2013/10/24 19:44:13
nit: remove one space before 'By'
satorux1
2013/10/25 02:36:02
Done.
| |
| 166 // default, GetSystemSalt() returns the value generated by | |
| 167 // GetStubSystemSalt(). | |
| 168 void set_system_salt(const std::vector<uint8>& system_salt) { | |
| 169 system_salt_ = system_salt; | |
| 170 } | |
| 171 | |
| 165 // Returns the stub system salt as raw bytes. (not as a string encoded in the | 172 // Returns the stub system salt as raw bytes. (not as a string encoded in the |
| 166 // format used by SystemSaltGetter::ConvertRawSaltToHexString()). | 173 // format used by SystemSaltGetter::ConvertRawSaltToHexString()). |
| 167 static std::vector<uint8> GetStubSystemSalt(); | 174 static std::vector<uint8> GetStubSystemSalt(); |
| 168 | 175 |
| 169 private: | 176 private: |
| 170 // Posts tasks which return fake results to the UI thread. | 177 // Posts tasks which return fake results to the UI thread. |
| 171 void ReturnAsyncMethodResult(const AsyncMethodCallback& callback, | 178 void ReturnAsyncMethodResult(const AsyncMethodCallback& callback, |
| 172 bool returns_data); | 179 bool returns_data); |
| 173 | 180 |
| 174 // This method is used to implement ReturnAsyncMethodResult. | 181 // This method is used to implement ReturnAsyncMethodResult. |
| 175 void ReturnAsyncMethodResultInternal(const AsyncMethodCallback& callback, | 182 void ReturnAsyncMethodResultInternal(const AsyncMethodCallback& callback, |
| 176 bool returns_data); | 183 bool returns_data); |
| 177 | 184 |
| 178 bool service_is_available_; | 185 bool service_is_available_; |
| 179 int async_call_id_; | 186 int async_call_id_; |
| 180 AsyncCallStatusHandler async_call_status_handler_; | 187 AsyncCallStatusHandler async_call_status_handler_; |
| 181 AsyncCallStatusWithDataHandler async_call_status_data_handler_; | 188 AsyncCallStatusWithDataHandler async_call_status_data_handler_; |
| 182 int tpm_is_ready_counter_; | 189 int tpm_is_ready_counter_; |
| 183 bool unmount_result_; | 190 bool unmount_result_; |
| 191 std::vector<uint8> system_salt_; | |
| 184 | 192 |
| 185 std::vector<WaitForServiceToBeAvailableCallback> | 193 std::vector<WaitForServiceToBeAvailableCallback> |
| 186 pending_wait_for_service_to_be_available_callbacks_; | 194 pending_wait_for_service_to_be_available_callbacks_; |
| 187 | 195 |
| 188 // A stub store for InstallAttributes, mapping an attribute name to the | 196 // A stub store for InstallAttributes, mapping an attribute name to the |
| 189 // associated data blob. Used to implement InstallAttributesSet and -Get. | 197 // associated data blob. Used to implement InstallAttributesSet and -Get. |
| 190 std::map<std::string, std::vector<uint8> > install_attrs_; | 198 std::map<std::string, std::vector<uint8> > install_attrs_; |
| 191 bool locked_; | 199 bool locked_; |
| 192 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; | 200 base::WeakPtrFactory<FakeCryptohomeClient> weak_ptr_factory_; |
| 193 | 201 |
| 194 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); | 202 DISALLOW_COPY_AND_ASSIGN(FakeCryptohomeClient); |
| 195 }; | 203 }; |
| 196 | 204 |
| 197 } // namespace chromeos | 205 } // namespace chromeos |
| 198 | 206 |
| 199 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ | 207 #endif // CHROMEOS_DBUS_FAKE_CRYPTOHOME_CLIENT_H_ |
| OLD | NEW |