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

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: 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // Get the device properties for debugging. 199 // Get the device properties for debugging.
200 std::string device; 200 std::string device;
201 dictionary_copy->GetStringWithoutPathExpansion( 201 dictionary_copy->GetStringWithoutPathExpansion(
202 shill::kDeviceProperty, &device); 202 shill::kDeviceProperty, &device);
203 const DeviceState* device_state = 203 const DeviceState* device_state =
204 NetworkHandler::Get()->network_state_handler()->GetDeviceState(device); 204 NetworkHandler::Get()->network_state_handler()->GetDeviceState(device);
205 if (device_state) { 205 if (device_state) {
206 base::DictionaryValue* device_dictionary = 206 base::DictionaryValue* device_dictionary =
207 device_state->properties().DeepCopy(); 207 device_state->properties().DeepCopy();
208 dictionary_copy->Set(shill::kDeviceProperty, device_dictionary); 208 dictionary_copy->Set(shill::kDeviceProperty, device_dictionary);
209
210 // Convert IPConfig dictionary to a ListValue.
211 base::ListValue* ip_configs = new base::ListValue;
212 for (base::DictionaryValue::Iterator iter(device_state->ip_configs());
213 !iter.IsAtEnd(); iter.Advance()) {
214 ip_configs->Append(iter.value().DeepCopy());
215 }
216 device_dictionary->SetWithoutPathExpansion(
217 shill::kIPConfigsProperty, ip_configs);
209 } 218 }
210 219
211 base::ListValue return_arg_list; 220 base::ListValue return_arg_list;
212 return_arg_list.AppendInteger(callback_id); 221 return_arg_list.AppendInteger(callback_id);
213 return_arg_list.Append(dictionary_copy.release()); 222 return_arg_list.Append(dictionary_copy.release());
214 InvokeCallback(return_arg_list); 223 InvokeCallback(return_arg_list);
215 } 224 }
216 225
217 void NetworkConfigMessageHandler::InvokeCallback( 226 void NetworkConfigMessageHandler::InvokeCallback(
218 const base::ListValue& arg_list) const { 227 const base::ListValue& arg_list) const {
219 web_ui()->CallJavascriptFunction( 228 web_ui()->CallJavascriptFunction(
220 "networkConfig.chromeCallbackSuccess", arg_list); 229 "networkConfig.chromeCallbackSuccess", arg_list);
221 } 230 }
222 231
223 void NetworkConfigMessageHandler::ErrorCallback( 232 void NetworkConfigMessageHandler::ErrorCallback(
224 int callback_id, 233 int callback_id,
225 const std::string& error_name, 234 const std::string& error_name,
226 scoped_ptr<base::DictionaryValue> error_data) const { 235 scoped_ptr<base::DictionaryValue> error_data) const {
227 LOG(ERROR) << "NetworkConfigMessageHandler Error: " << error_name; 236 LOG(ERROR) << "NetworkConfigMessageHandler Error: " << error_name;
228 base::ListValue arg_list; 237 base::ListValue arg_list;
229 arg_list.AppendInteger(callback_id); 238 arg_list.AppendInteger(callback_id);
230 arg_list.AppendString(error_name); 239 arg_list.AppendString(error_name);
231 web_ui()->CallJavascriptFunction( 240 web_ui()->CallJavascriptFunction(
232 "networkConfig.chromeCallbackError", arg_list); 241 "networkConfig.chromeCallbackError", arg_list);
233 } 242 }
234 243
235 } // namespace chromeos 244 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698