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/network/network_util.h" | 5 #include "chromeos/network/network_util.h" |
6 | 6 |
7 #include "base/strings/string_tokenizer.h" | 7 #include "base/strings/string_tokenizer.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "chromeos/network/network_state.h" |
| 10 #include "chromeos/network/network_state_handler.h" |
| 11 #include "chromeos/network/onc/onc_signature.h" |
| 12 #include "chromeos/network/onc/onc_translator.h" |
| 13 #include "chromeos/network/shill_property_util.h" |
9 #include "third_party/cros_system_api/dbus/service_constants.h" | 14 #include "third_party/cros_system_api/dbus/service_constants.h" |
10 | 15 |
11 namespace chromeos { | 16 namespace chromeos { |
12 | 17 |
13 WifiAccessPoint::WifiAccessPoint() | 18 WifiAccessPoint::WifiAccessPoint() |
14 : signal_strength(0), | 19 : signal_strength(0), |
15 signal_to_noise(0), | 20 signal_to_noise(0), |
16 channel(0) { | 21 channel(0) { |
17 } | 22 } |
18 | 23 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 &scan_result.long_name); | 120 &scan_result.long_name); |
116 dict->GetStringWithoutPathExpansion(shill::kShortNameProperty, | 121 dict->GetStringWithoutPathExpansion(shill::kShortNameProperty, |
117 &scan_result.short_name); | 122 &scan_result.short_name); |
118 dict->GetStringWithoutPathExpansion(shill::kTechnologyProperty, | 123 dict->GetStringWithoutPathExpansion(shill::kTechnologyProperty, |
119 &scan_result.technology); | 124 &scan_result.technology); |
120 scan_results->push_back(scan_result); | 125 scan_results->push_back(scan_result); |
121 } | 126 } |
122 return true; | 127 return true; |
123 } | 128 } |
124 | 129 |
| 130 scoped_ptr<base::ListValue> TranslateNetworkListToONC( |
| 131 NetworkTypePattern pattern) { |
| 132 NetworkStateHandler::NetworkStateList network_states; |
| 133 NetworkHandler::Get()->network_state_handler()->GetNetworkListByType( |
| 134 pattern, &network_states); |
| 135 |
| 136 scoped_ptr<base::ListValue> network_properties_list(new base::ListValue); |
| 137 for (NetworkStateHandler::NetworkStateList::iterator it = |
| 138 network_states.begin(); |
| 139 it != network_states.end(); |
| 140 ++it) { |
| 141 base::DictionaryValue shill_dictionary; |
| 142 (*it)->GetStateProperties(&shill_dictionary); |
| 143 |
| 144 scoped_ptr<base::DictionaryValue> onc_network_part = |
| 145 TranslateShillServiceToONCPart( |
| 146 shill_dictionary, &onc::kNetworkWithStateSignature); |
| 147 network_properties_list->Append(onc_network_part.release()); |
| 148 } |
| 149 return network_properties_list.Pass(); |
| 150 } |
| 151 |
125 } // namespace network_util | 152 } // namespace network_util |
126 } // namespace chromeos | 153 } // namespace chromeos |
OLD | NEW |