| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/network/managed_network_configuration_handler.h" | 5 #include "chromeos/network/managed_network_configuration_handler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chromeos/network/network_ui_data.h" | 9 #include "chromeos/network/network_ui_data.h" |
| 10 #include "chromeos/network/onc/onc_utils.h" | 10 #include "chromeos/network/onc/onc_utils.h" |
| 11 #include "third_party/cros_system_api/dbus/service_constants.h" | 11 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 | 14 |
| 15 ManagedNetworkConfigurationHandler::~ManagedNetworkConfigurationHandler() {} | 15 ManagedNetworkConfigurationHandler::~ManagedNetworkConfigurationHandler() {} |
| 16 | 16 |
| 17 // static | |
| 18 scoped_ptr<NetworkUIData> ManagedNetworkConfigurationHandler::GetUIData( | |
| 19 const base::DictionaryValue& shill_dictionary) { | |
| 20 std::string ui_data_blob; | |
| 21 if (shill_dictionary.GetStringWithoutPathExpansion(flimflam::kUIDataProperty, | |
| 22 &ui_data_blob) && | |
| 23 !ui_data_blob.empty()) { | |
| 24 scoped_ptr<base::DictionaryValue> ui_data_dict = | |
| 25 onc::ReadDictionaryFromJson(ui_data_blob); | |
| 26 if (ui_data_dict) | |
| 27 return make_scoped_ptr(new NetworkUIData(*ui_data_dict)); | |
| 28 else | |
| 29 LOG(ERROR) << "UIData is not a valid JSON dictionary."; | |
| 30 } | |
| 31 VLOG(2) << "JSON dictionary has no UIData blob: " << shill_dictionary; | |
| 32 return scoped_ptr<NetworkUIData>(); | |
| 33 } | |
| 34 | |
| 35 } // namespace chromeos | 17 } // namespace chromeos |
| OLD | NEW |