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/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chromeos/network/network_state.h" | 10 #include "chromeos/network/network_state.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 base::DictionaryValue shill_dictionary; | 146 base::DictionaryValue shill_dictionary; |
147 network->GetStateProperties(&shill_dictionary); | 147 network->GetStateProperties(&shill_dictionary); |
148 | 148 |
149 scoped_ptr<base::DictionaryValue> onc_dictionary = | 149 scoped_ptr<base::DictionaryValue> onc_dictionary = |
150 TranslateShillServiceToONCPart(shill_dictionary, | 150 TranslateShillServiceToONCPart(shill_dictionary, |
151 ::onc::ONC_SOURCE_UNKNOWN, | 151 ::onc::ONC_SOURCE_UNKNOWN, |
152 &onc::kNetworkWithStateSignature); | 152 &onc::kNetworkWithStateSignature); |
153 return onc_dictionary.Pass(); | 153 return onc_dictionary.Pass(); |
154 } | 154 } |
155 | 155 |
| 156 scoped_ptr<base::DictionaryValue> TranslateNetworkConfigurationStateToONC( |
| 157 const NetworkState* network) { |
| 158 // Get just the configuraiton properties from the NetworkState. |
| 159 base::DictionaryValue shill_dictionary; |
| 160 network->GetConfigurationStateProperties(&shill_dictionary); |
| 161 |
| 162 scoped_ptr<base::DictionaryValue> onc_dictionary = |
| 163 TranslateShillServiceToONCPart(shill_dictionary, |
| 164 ::onc::ONC_SOURCE_UNKNOWN, |
| 165 &onc::kNetworkWithStateSignature); |
| 166 return onc_dictionary.Pass(); |
| 167 } |
| 168 |
156 scoped_ptr<base::ListValue> TranslateNetworkListToONC( | 169 scoped_ptr<base::ListValue> TranslateNetworkListToONC( |
157 NetworkTypePattern pattern, | 170 NetworkTypePattern pattern, |
158 bool configured_only, | 171 bool configured_only, |
159 bool visible_only, | 172 bool visible_only, |
160 int limit, | 173 int limit, |
161 bool debugging_properties) { | 174 bool debugging_properties) { |
162 NetworkStateHandler::NetworkStateList network_states; | 175 NetworkStateHandler::NetworkStateList network_states; |
163 NetworkHandler::Get()->network_state_handler()->GetNetworkListByType( | 176 NetworkHandler::Get()->network_state_handler()->GetNetworkListByType( |
164 pattern, configured_only, visible_only, limit, &network_states); | 177 pattern, configured_only, visible_only, limit, &network_states); |
165 | 178 |
(...skipping 20 matching lines...) Expand all Loading... |
186 std::string TranslateONCTypeToShill(const std::string& onc_type) { | 199 std::string TranslateONCTypeToShill(const std::string& onc_type) { |
187 if (onc_type == ::onc::network_type::kEthernet) | 200 if (onc_type == ::onc::network_type::kEthernet) |
188 return shill::kTypeEthernet; | 201 return shill::kTypeEthernet; |
189 std::string shill_type; | 202 std::string shill_type; |
190 onc::TranslateStringToShill(onc::kNetworkTypeTable, onc_type, &shill_type); | 203 onc::TranslateStringToShill(onc::kNetworkTypeTable, onc_type, &shill_type); |
191 return shill_type; | 204 return shill_type; |
192 } | 205 } |
193 | 206 |
194 } // namespace network_util | 207 } // namespace network_util |
195 } // namespace chromeos | 208 } // namespace chromeos |
OLD | NEW |