OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ipconfig_client.h" | 5 #include "chromeos/dbus/shill_ipconfig_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 const dbus::ObjectPath& ipconfig_path, | 109 const dbus::ObjectPath& ipconfig_path, |
110 const std::string& name, | 110 const std::string& name, |
111 const base::Value& value, | 111 const base::Value& value, |
112 const VoidDBusMethodCallback& callback) { | 112 const VoidDBusMethodCallback& callback) { |
113 dbus::MethodCall method_call(shill::kFlimflamIPConfigInterface, | 113 dbus::MethodCall method_call(shill::kFlimflamIPConfigInterface, |
114 shill::kSetPropertyFunction); | 114 shill::kSetPropertyFunction); |
115 dbus::MessageWriter writer(&method_call); | 115 dbus::MessageWriter writer(&method_call); |
116 writer.AppendString(name); | 116 writer.AppendString(name); |
117 // IPConfig supports writing basic type and string array properties. | 117 // IPConfig supports writing basic type and string array properties. |
118 switch (value.GetType()) { | 118 switch (value.GetType()) { |
119 case base::Value::TYPE_LIST: { | 119 case base::Value::Type::LIST: { |
120 const base::ListValue* list_value = NULL; | 120 const base::ListValue* list_value = NULL; |
121 value.GetAsList(&list_value); | 121 value.GetAsList(&list_value); |
122 dbus::MessageWriter variant_writer(NULL); | 122 dbus::MessageWriter variant_writer(NULL); |
123 writer.OpenVariant("as", &variant_writer); | 123 writer.OpenVariant("as", &variant_writer); |
124 dbus::MessageWriter array_writer(NULL); | 124 dbus::MessageWriter array_writer(NULL); |
125 variant_writer.OpenArray("s", &array_writer); | 125 variant_writer.OpenArray("s", &array_writer); |
126 for (base::ListValue::const_iterator it = list_value->begin(); | 126 for (base::ListValue::const_iterator it = list_value->begin(); |
127 it != list_value->end(); | 127 it != list_value->end(); |
128 ++it) { | 128 ++it) { |
129 DLOG_IF(ERROR, (*it)->GetType() != base::Value::TYPE_STRING) | 129 DLOG_IF(ERROR, (*it)->GetType() != base::Value::Type::STRING) |
130 << "Unexpected type " << (*it)->GetType(); | 130 << "Unexpected type " << (*it)->GetType(); |
131 std::string str; | 131 std::string str; |
132 (*it)->GetAsString(&str); | 132 (*it)->GetAsString(&str); |
133 array_writer.AppendString(str); | 133 array_writer.AppendString(str); |
134 } | 134 } |
135 variant_writer.CloseContainer(&array_writer); | 135 variant_writer.CloseContainer(&array_writer); |
136 writer.CloseContainer(&variant_writer); | 136 writer.CloseContainer(&variant_writer); |
137 } | 137 } |
138 case base::Value::TYPE_BOOLEAN: | 138 case base::Value::Type::BOOLEAN: |
139 case base::Value::TYPE_INTEGER: | 139 case base::Value::Type::INTEGER: |
140 case base::Value::TYPE_DOUBLE: | 140 case base::Value::Type::DOUBLE: |
141 case base::Value::TYPE_STRING: | 141 case base::Value::Type::STRING: |
142 dbus::AppendBasicTypeValueDataAsVariant(&writer, value); | 142 dbus::AppendBasicTypeValueDataAsVariant(&writer, value); |
143 break; | 143 break; |
144 default: | 144 default: |
145 DLOG(ERROR) << "Unexpected type " << value.GetType(); | 145 DLOG(ERROR) << "Unexpected type " << value.GetType(); |
146 } | 146 } |
147 GetHelper(ipconfig_path)->CallVoidMethod(&method_call, callback); | 147 GetHelper(ipconfig_path)->CallVoidMethod(&method_call, callback); |
148 } | 148 } |
149 | 149 |
150 void ShillIPConfigClientImpl::ClearProperty( | 150 void ShillIPConfigClientImpl::ClearProperty( |
151 const dbus::ObjectPath& ipconfig_path, | 151 const dbus::ObjectPath& ipconfig_path, |
(...skipping 24 matching lines...) Expand all Loading... |
176 ShillIPConfigClient::ShillIPConfigClient() {} | 176 ShillIPConfigClient::ShillIPConfigClient() {} |
177 | 177 |
178 ShillIPConfigClient::~ShillIPConfigClient() {} | 178 ShillIPConfigClient::~ShillIPConfigClient() {} |
179 | 179 |
180 // static | 180 // static |
181 ShillIPConfigClient* ShillIPConfigClient::Create() { | 181 ShillIPConfigClient* ShillIPConfigClient::Create() { |
182 return new ShillIPConfigClientImpl(); | 182 return new ShillIPConfigClientImpl(); |
183 } | 183 } |
184 | 184 |
185 } // namespace chromeos | 185 } // namespace chromeos |
OLD | NEW |