Chromium Code Reviews| Index: chromeos/dbus/shill_third_party_vpn_driver_client.cc |
| diff --git a/chromeos/dbus/shill_third_party_vpn_driver_client.cc b/chromeos/dbus/shill_third_party_vpn_driver_client.cc |
| index c3392cd12851d9adae31cf1308b54381ea0427af..8cb3c00e82975f735aac1271719789c86eaea1a0 100644 |
| --- a/chromeos/dbus/shill_third_party_vpn_driver_client.cc |
| +++ b/chromeos/dbus/shill_third_party_vpn_driver_client.cc |
| @@ -5,8 +5,10 @@ |
| #include "chromeos/dbus/shill_third_party_vpn_driver_client.h" |
| #include <string> |
|
bartfab (slow)
2015/01/19 10:08:38
Nit: Already included by header.
pneubeck (no reviews)
2015/01/19 17:13:46
independent of the header, string is used in line
bartfab (slow)
2015/01/19 17:57:17
The way we do IWYU is to not include a header that
pneubeck (no reviews)
2015/01/19 18:04:28
Done.
|
| +#include <vector> |
|
bartfab (slow)
2015/01/19 10:08:38
Nit: Already included by header.
pneubeck (no reviews)
2015/01/19 17:13:46
independent of the header vector is used in line 2
bartfab (slow)
2015/01/19 17:57:17
The way we do IWYU is to not include a header that
pneubeck (no reviews)
2015/01/19 18:04:28
Done.
|
| #include "base/bind.h" |
| +#include "base/stl_util.h" |
| #include "chromeos/dbus/shill_third_party_vpn_observer.h" |
| #include "dbus/bus.h" |
| #include "dbus/message.h" |
| @@ -56,7 +58,7 @@ class ShillThirdPartyVpnDriverClientImpl |
| void SendPacket( |
| const std::string& object_path_value, |
| - const std::string& ip_packet, |
| + const std::vector<char>& ip_packet, |
| const base::Closure& callback, |
| const ShillClientHelper::ErrorCallback& error_callback) override; |
| @@ -245,14 +247,15 @@ void ShillThirdPartyVpnDriverClientImpl::UpdateConnectionState( |
| void ShillThirdPartyVpnDriverClientImpl::SendPacket( |
| const std::string& object_path_value, |
| - const std::string& ip_packet, |
| + const std::vector<char>& ip_packet, |
| const base::Closure& callback, |
| const ShillClientHelper::ErrorCallback& error_callback) { |
| dbus::MethodCall method_call(shill::kFlimflamThirdPartyVpnInterface, |
| shill::kSendPacketFunction); |
| dbus::MessageWriter writer(&method_call); |
| - writer.AppendArrayOfBytes(reinterpret_cast<const uint8_t*>(ip_packet.data()), |
| - ip_packet.size()); |
| + writer.AppendArrayOfBytes( |
| + reinterpret_cast<const uint8_t*>(vector_as_array(&ip_packet)), |
| + ip_packet.size()); |
| GetHelper(object_path_value) |
| ->CallVoidMethodWithErrorCallback(&method_call, callback, error_callback); |
| } |
| @@ -269,7 +272,7 @@ void ShillThirdPartyVpnDriverClientImpl::OnPacketReceived( |
| size_t length = 0; |
| if (reader.PopArrayOfBytes(&data, &length)) { |
| helper_info->observer()->OnPacketReceived( |
| - std::string(reinterpret_cast<const char*>(data), length)); |
| + std::vector<char>(data, data + length)); |
|
bartfab (slow)
2015/01/19 10:08:38
You assume that a |char| is exactly 8 bits in size
pneubeck (no reviews)
2015/01/19 17:13:46
as discussed, added a static assert
|
| } |
| } |