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

Side by Side Diff: chrome/browser/ui/webui/chromeos/network_config_message_handler.cc

Issue 509643003: Use GetManagedProperties in InternetOptionsHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_279351_internet_options_8a
Patch Set: Feedback Created 6 years, 3 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 "chrome/browser/ui/webui/chromeos/network_config_message_handler.h" 5 #include "chrome/browser/ui/webui/chromeos/network_config_message_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Get the device properties for debugging. 193 // Get the device properties for debugging.
194 std::string device; 194 std::string device;
195 dictionary_copy->GetStringWithoutPathExpansion( 195 dictionary_copy->GetStringWithoutPathExpansion(
196 shill::kDeviceProperty, &device); 196 shill::kDeviceProperty, &device);
197 const DeviceState* device_state = 197 const DeviceState* device_state =
198 NetworkHandler::Get()->network_state_handler()->GetDeviceState(device); 198 NetworkHandler::Get()->network_state_handler()->GetDeviceState(device);
199 if (device_state) { 199 if (device_state) {
200 base::DictionaryValue* device_dictionary = 200 base::DictionaryValue* device_dictionary =
201 device_state->properties().DeepCopy(); 201 device_state->properties().DeepCopy();
202 dictionary_copy->Set(shill::kDeviceProperty, device_dictionary); 202 dictionary_copy->Set(shill::kDeviceProperty, device_dictionary);
203
204 // Convert IPConfig dictionary to a ListValue.
205 base::ListValue* ip_configs = new base::ListValue;
206 for (base::DictionaryValue::Iterator iter(device_state->ip_configs());
207 !iter.IsAtEnd(); iter.Advance()) {
208 ip_configs->Append(iter.value().DeepCopy());
209 }
210 device_dictionary->SetWithoutPathExpansion(
211 shill::kIPConfigsProperty, ip_configs);
203 } 212 }
204 213
205 base::ListValue return_arg_list; 214 base::ListValue return_arg_list;
206 return_arg_list.AppendInteger(callback_id); 215 return_arg_list.AppendInteger(callback_id);
207 return_arg_list.Append(dictionary_copy.release()); 216 return_arg_list.Append(dictionary_copy.release());
208 InvokeCallback(return_arg_list); 217 InvokeCallback(return_arg_list);
209 } 218 }
210 219
211 void NetworkConfigMessageHandler::InvokeCallback( 220 void NetworkConfigMessageHandler::InvokeCallback(
212 const base::ListValue& arg_list) const { 221 const base::ListValue& arg_list) const {
213 web_ui()->CallJavascriptFunction( 222 web_ui()->CallJavascriptFunction(
214 "networkConfig.chromeCallbackSuccess", arg_list); 223 "networkConfig.chromeCallbackSuccess", arg_list);
215 } 224 }
216 225
217 void NetworkConfigMessageHandler::ErrorCallback( 226 void NetworkConfigMessageHandler::ErrorCallback(
218 int callback_id, 227 int callback_id,
219 const std::string& error_name, 228 const std::string& error_name,
220 scoped_ptr<base::DictionaryValue> error_data) const { 229 scoped_ptr<base::DictionaryValue> error_data) const {
221 LOG(ERROR) << "NetworkConfigMessageHandler Error: " << error_name; 230 LOG(ERROR) << "NetworkConfigMessageHandler Error: " << error_name;
222 base::ListValue arg_list; 231 base::ListValue arg_list;
223 arg_list.AppendInteger(callback_id); 232 arg_list.AppendInteger(callback_id);
224 arg_list.AppendString(error_name); 233 arg_list.AppendString(error_name);
225 web_ui()->CallJavascriptFunction( 234 web_ui()->CallJavascriptFunction(
226 "networkConfig.chromeCallbackError", arg_list); 235 "networkConfig.chromeCallbackError", arg_list);
227 } 236 }
228 237
229 } // namespace chromeos 238 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698