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

Side by Side Diff: chromeos/dbus/shill_third_party_vpn_driver_client.cc

Issue 1014053002: Provide warning message for setParameters (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Print only when there is a warning and fix unittest error Created 5 years, 9 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 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/shill_third_party_vpn_driver_client.h" 5 #include "chromeos/dbus/shill_third_party_vpn_driver_client.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "chromeos/dbus/shill_third_party_vpn_observer.h" 9 #include "chromeos/dbus/shill_third_party_vpn_observer.h"
10 #include "dbus/bus.h" 10 #include "dbus/bus.h"
(...skipping 26 matching lines...) Expand all
37 void AddShillThirdPartyVpnObserver( 37 void AddShillThirdPartyVpnObserver(
38 const std::string& object_path_value, 38 const std::string& object_path_value,
39 ShillThirdPartyVpnObserver* observer) override; 39 ShillThirdPartyVpnObserver* observer) override;
40 40
41 void RemoveShillThirdPartyVpnObserver( 41 void RemoveShillThirdPartyVpnObserver(
42 const std::string& object_path_value) override; 42 const std::string& object_path_value) override;
43 43
44 void SetParameters( 44 void SetParameters(
45 const std::string& object_path_value, 45 const std::string& object_path_value,
46 const base::DictionaryValue& parameters, 46 const base::DictionaryValue& parameters,
47 const base::Closure& callback, 47 const ShillClientHelper::StringCallback& callback,
48 const ShillClientHelper::ErrorCallback& error_callback) override; 48 const ShillClientHelper::ErrorCallback& error_callback) override;
49 49
50 void UpdateConnectionState( 50 void UpdateConnectionState(
51 const std::string& object_path_value, 51 const std::string& object_path_value,
52 const uint32_t connection_state, 52 const uint32_t connection_state,
53 const base::Closure& callback, 53 const base::Closure& callback,
54 const ShillClientHelper::ErrorCallback& error_callback) override; 54 const ShillClientHelper::ErrorCallback& error_callback) override;
55 55
56 void SendPacket( 56 void SendPacket(
57 const std::string& object_path_value, 57 const std::string& object_path_value,
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 bus_->RemoveObjectProxy(shill::kFlimflamServiceName, object_path, 194 bus_->RemoveObjectProxy(shill::kFlimflamServiceName, object_path,
195 base::Bind(&base::DoNothing)); 195 base::Bind(&base::DoNothing));
196 helpers_.erase(helpers_.find(object_path.value())); 196 helpers_.erase(helpers_.find(object_path.value()));
197 delete helper_info; 197 delete helper_info;
198 } 198 }
199 199
200 void ShillThirdPartyVpnDriverClientImpl::SetParameters( 200 void ShillThirdPartyVpnDriverClientImpl::SetParameters(
201 const std::string& object_path_value, 201 const std::string& object_path_value,
202 const base::DictionaryValue& parameters, 202 const base::DictionaryValue& parameters,
203 const base::Closure& callback, 203 const ShillClientHelper::StringCallback& callback,
204 const ShillClientHelper::ErrorCallback& error_callback) { 204 const ShillClientHelper::ErrorCallback& error_callback) {
205 dbus::MethodCall method_call(shill::kFlimflamThirdPartyVpnInterface, 205 dbus::MethodCall method_call(shill::kFlimflamThirdPartyVpnInterface,
206 shill::kSetParametersFunction); 206 shill::kSetParametersFunction);
207 dbus::MessageWriter writer(&method_call); 207 dbus::MessageWriter writer(&method_call);
208 dbus::MessageWriter array_writer(nullptr); 208 dbus::MessageWriter array_writer(nullptr);
209 writer.OpenArray("{ss}", &array_writer); 209 writer.OpenArray("{ss}", &array_writer);
210 for (base::DictionaryValue::Iterator it(parameters); !it.IsAtEnd(); 210 for (base::DictionaryValue::Iterator it(parameters); !it.IsAtEnd();
211 it.Advance()) { 211 it.Advance()) {
212 if (valid_keys_.find(it.key()) == valid_keys_.end()) { 212 if (valid_keys_.find(it.key()) == valid_keys_.end()) {
213 LOG(WARNING) << "Unknown key " << it.key(); 213 LOG(WARNING) << "Unknown key " << it.key();
214 continue; 214 continue;
215 } 215 }
216 std::string value; 216 std::string value;
217 if (!it.value().GetAsString(&value)) { 217 if (!it.value().GetAsString(&value)) {
218 LOG(WARNING) << "Non string value " << it.value(); 218 LOG(WARNING) << "Non string value " << it.value();
219 continue; 219 continue;
220 } 220 }
221 dbus::MessageWriter entry_writer(nullptr); 221 dbus::MessageWriter entry_writer(nullptr);
222 array_writer.OpenDictEntry(&entry_writer); 222 array_writer.OpenDictEntry(&entry_writer);
223 entry_writer.AppendString(it.key()); 223 entry_writer.AppendString(it.key());
224 entry_writer.AppendString(value); 224 entry_writer.AppendString(value);
225 array_writer.CloseContainer(&entry_writer); 225 array_writer.CloseContainer(&entry_writer);
226 } 226 }
227 writer.CloseContainer(&array_writer); 227 writer.CloseContainer(&array_writer);
228 GetHelper(object_path_value) 228 GetHelper(object_path_value)
229 ->CallVoidMethodWithErrorCallback(&method_call, callback, error_callback); 229 ->CallStringMethodWithErrorCallback(&method_call, callback,
230 error_callback);
230 } 231 }
231 232
232 void ShillThirdPartyVpnDriverClientImpl::UpdateConnectionState( 233 void ShillThirdPartyVpnDriverClientImpl::UpdateConnectionState(
233 const std::string& object_path_value, 234 const std::string& object_path_value,
234 const uint32_t connection_state, 235 const uint32_t connection_state,
235 const base::Closure& callback, 236 const base::Closure& callback,
236 const ShillClientHelper::ErrorCallback& error_callback) { 237 const ShillClientHelper::ErrorCallback& error_callback) {
237 dbus::MethodCall method_call(shill::kFlimflamThirdPartyVpnInterface, 238 dbus::MethodCall method_call(shill::kFlimflamThirdPartyVpnInterface,
238 shill::kUpdateConnectionStateFunction); 239 shill::kUpdateConnectionStateFunction);
239 dbus::MessageWriter writer(&method_call); 240 dbus::MessageWriter writer(&method_call);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 333
333 ShillThirdPartyVpnDriverClient::~ShillThirdPartyVpnDriverClient() { 334 ShillThirdPartyVpnDriverClient::~ShillThirdPartyVpnDriverClient() {
334 } 335 }
335 336
336 // static 337 // static
337 ShillThirdPartyVpnDriverClient* ShillThirdPartyVpnDriverClient::Create() { 338 ShillThirdPartyVpnDriverClient* ShillThirdPartyVpnDriverClient::Create() {
338 return new ShillThirdPartyVpnDriverClientImpl(); 339 return new ShillThirdPartyVpnDriverClientImpl();
339 } 340 }
340 341
341 } // namespace chromeos 342 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698