| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "chromeos/dbus/easy_unlock_client.h" | 5 #include "chromeos/dbus/easy_unlock_client.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 weak_ptr_factory_.GetWeakPtr(), | 71 weak_ptr_factory_.GetWeakPtr(), |
| 72 callback)); | 72 callback)); |
| 73 } | 73 } |
| 74 | 74 |
| 75 // EasyUnlockClient override. | 75 // EasyUnlockClient override. |
| 76 virtual void CreateSecureMessage(const std::string& payload, | 76 virtual void CreateSecureMessage(const std::string& payload, |
| 77 const std::string& secret_key, | 77 const std::string& secret_key, |
| 78 const std::string& associated_data, | 78 const std::string& associated_data, |
| 79 const std::string& public_metadata, | 79 const std::string& public_metadata, |
| 80 const std::string& verification_key_id, | 80 const std::string& verification_key_id, |
| 81 const std::string& decryption_key_id, |
| 81 const std::string& encryption_type, | 82 const std::string& encryption_type, |
| 82 const std::string& signature_type, | 83 const std::string& signature_type, |
| 83 const DataCallback& callback) OVERRIDE { | 84 const DataCallback& callback) OVERRIDE { |
| 84 dbus::MethodCall method_call( | 85 dbus::MethodCall method_call( |
| 85 easy_unlock::kEasyUnlockServiceInterface, | 86 easy_unlock::kEasyUnlockServiceInterface, |
| 86 easy_unlock::kCreateSecureMessageMethod); | 87 easy_unlock::kCreateSecureMessageMethod); |
| 87 dbus::MessageWriter writer(&method_call); | 88 dbus::MessageWriter writer(&method_call); |
| 88 // NOTE: DBus expects that data sent as string is UTF-8 encoded. This is | 89 // NOTE: DBus expects that data sent as string is UTF-8 encoded. This is |
| 89 // not guaranteed here, so the method uses byte arrays. | 90 // not guaranteed here, so the method uses byte arrays. |
| 90 AppendStringAsByteArray(payload, &writer); | 91 AppendStringAsByteArray(payload, &writer); |
| 91 AppendStringAsByteArray(secret_key, &writer); | 92 AppendStringAsByteArray(secret_key, &writer); |
| 92 AppendStringAsByteArray(associated_data, &writer); | 93 AppendStringAsByteArray(associated_data, &writer); |
| 93 AppendStringAsByteArray(public_metadata, &writer); | 94 AppendStringAsByteArray(public_metadata, &writer); |
| 94 AppendStringAsByteArray(verification_key_id, &writer); | 95 AppendStringAsByteArray(verification_key_id, &writer); |
| 96 AppendStringAsByteArray(decryption_key_id, &writer); |
| 95 writer.AppendString(encryption_type); | 97 writer.AppendString(encryption_type); |
| 96 writer.AppendString(signature_type); | 98 writer.AppendString(signature_type); |
| 97 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, | 99 proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| 98 base::Bind(&EasyUnlockClientImpl::OnData, | 100 base::Bind(&EasyUnlockClientImpl::OnData, |
| 99 weak_ptr_factory_.GetWeakPtr(), | 101 weak_ptr_factory_.GetWeakPtr(), |
| 100 callback)); | 102 callback)); |
| 101 } | 103 } |
| 102 | 104 |
| 103 // EasyUnlockClient override. | 105 // EasyUnlockClient override. |
| 104 virtual void UnwrapSecureMessage(const std::string& message, | 106 virtual void UnwrapSecureMessage(const std::string& message, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 179 |
| 178 EasyUnlockClient::~EasyUnlockClient() { | 180 EasyUnlockClient::~EasyUnlockClient() { |
| 179 } | 181 } |
| 180 | 182 |
| 181 // static | 183 // static |
| 182 EasyUnlockClient* EasyUnlockClient::Create() { | 184 EasyUnlockClient* EasyUnlockClient::Create() { |
| 183 return new EasyUnlockClientImpl(); | 185 return new EasyUnlockClientImpl(); |
| 184 } | 186 } |
| 185 | 187 |
| 186 } // namespace chromeos | 188 } // namespace chromeos |
| OLD | NEW |