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

Side by Side Diff: chromeos/network/onc/onc_translation_tables.cc

Issue 2818593003: [CrOS Tether] Add tether network properties (battery percentage, carrier, and signal strength) to t… (Closed)
Patch Set: Ran git cl format. Created 3 years, 8 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
« no previous file with comments | « chromeos/network/onc/onc_signature.cc ('k') | chromeos/network/onc/onc_translator_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/onc/onc_translation_tables.h" 5 #include "chromeos/network/onc/onc_translation_tables.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chromeos/network/network_type_pattern.h"
11 #include "chromeos/network/tether_constants.h"
10 #include "components/onc/onc_constants.h" 12 #include "components/onc/onc_constants.h"
11 #include "third_party/cros_system_api/dbus/service_constants.h" 13 #include "third_party/cros_system_api/dbus/service_constants.h"
12 14
13 namespace chromeos { 15 namespace chromeos {
14 namespace onc { 16 namespace onc {
15 17
16 // CertificatePattern is converted with function CreateUIData(...) to UIData 18 // CertificatePattern is converted with function CreateUIData(...) to UIData
17 // stored in Shill. 19 // stored in Shill.
18 20
19 namespace { 21 namespace {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 {::onc::verify_x509::kType, shill::kOpenVPNVerifyX509TypeProperty}, 104 {::onc::verify_x509::kType, shill::kOpenVPNVerifyX509TypeProperty},
103 {NULL}}; 105 {NULL}};
104 106
105 const FieldTranslationEntry vpn_fields[] = { 107 const FieldTranslationEntry vpn_fields[] = {
106 {::onc::vpn::kAutoConnect, shill::kAutoConnectProperty}, 108 {::onc::vpn::kAutoConnect, shill::kAutoConnectProperty},
107 // These fields are converted during translation, see onc_translator_*. 109 // These fields are converted during translation, see onc_translator_*.
108 // { ::onc::vpn::kHost, shill::kProviderHostProperty}, 110 // { ::onc::vpn::kHost, shill::kProviderHostProperty},
109 // { ::onc::vpn::kType, shill::kProviderTypeProperty }, 111 // { ::onc::vpn::kType, shill::kProviderTypeProperty },
110 {NULL}}; 112 {NULL}};
111 113
114 const FieldTranslationEntry tether_fields[] = {
115 {::onc::tether::kBatteryPercentage, kTetherBatteryPercentage},
116 {::onc::tether::kCarrier, kTetherCarrier},
117 {::onc::tether::kSignalStrength, kTetherSignalStrength},
118 {NULL}};
119
112 const FieldTranslationEntry wifi_fields[] = { 120 const FieldTranslationEntry wifi_fields[] = {
113 {::onc::wifi::kAutoConnect, shill::kAutoConnectProperty}, 121 {::onc::wifi::kAutoConnect, shill::kAutoConnectProperty},
114 {::onc::wifi::kBSSID, shill::kWifiBSsid}, 122 {::onc::wifi::kBSSID, shill::kWifiBSsid},
115 // This dictionary is converted during translation, see onc_translator_*. 123 // This dictionary is converted during translation, see onc_translator_*.
116 // { ::onc::wifi::kEAP, shill::kEap*}, 124 // { ::onc::wifi::kEAP, shill::kEap*},
117 {::onc::wifi::kFrequency, shill::kWifiFrequency}, 125 {::onc::wifi::kFrequency, shill::kWifiFrequency},
118 {::onc::wifi::kFrequencyList, shill::kWifiFrequencyListProperty}, 126 {::onc::wifi::kFrequencyList, shill::kWifiFrequencyListProperty},
119 {::onc::wifi::kHexSSID, shill::kWifiHexSsid}, 127 {::onc::wifi::kHexSSID, shill::kWifiHexSsid},
120 {::onc::wifi::kHiddenSSID, shill::kWifiHiddenSsid}, 128 {::onc::wifi::kHiddenSSID, shill::kWifiHiddenSsid},
121 {::onc::wifi::kPassphrase, shill::kPassphraseProperty}, 129 {::onc::wifi::kPassphrase, shill::kPassphraseProperty},
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 }; 240 };
233 241
234 const OncValueTranslationEntry onc_value_translation_table[] = { 242 const OncValueTranslationEntry onc_value_translation_table[] = {
235 {&kEAPSignature, eap_fields}, 243 {&kEAPSignature, eap_fields},
236 {&kIPsecSignature, ipsec_fields}, 244 {&kIPsecSignature, ipsec_fields},
237 {&kL2TPSignature, l2tp_fields}, 245 {&kL2TPSignature, l2tp_fields},
238 {&kXAUTHSignature, xauth_fields}, 246 {&kXAUTHSignature, xauth_fields},
239 {&kOpenVPNSignature, openvpn_fields}, 247 {&kOpenVPNSignature, openvpn_fields},
240 {&kVerifyX509Signature, verify_x509_fields}, 248 {&kVerifyX509Signature, verify_x509_fields},
241 {&kVPNSignature, vpn_fields}, 249 {&kVPNSignature, vpn_fields},
250 {&kTetherSignature, tether_fields},
242 {&kWiFiSignature, wifi_fields}, 251 {&kWiFiSignature, wifi_fields},
243 {&kWiFiWithStateSignature, wifi_fields}, 252 {&kWiFiWithStateSignature, wifi_fields},
244 {&kWiMAXSignature, wimax_fields}, 253 {&kWiMAXSignature, wimax_fields},
245 {&kWiMAXWithStateSignature, wimax_fields}, 254 {&kWiMAXWithStateSignature, wimax_fields},
246 {&kCellularApnSignature, cellular_apn_fields}, 255 {&kCellularApnSignature, cellular_apn_fields},
247 {&kCellularFoundNetworkSignature, cellular_found_network_fields}, 256 {&kCellularFoundNetworkSignature, cellular_found_network_fields},
248 {&kCellularPaymentPortalSignature, cellular_payment_portal_fields}, 257 {&kCellularPaymentPortalSignature, cellular_payment_portal_fields},
249 {&kCellularProviderSignature, cellular_provider_fields}, 258 {&kCellularProviderSignature, cellular_provider_fields},
250 {&kSIMLockStatusSignature, sim_lock_status_fields}, 259 {&kSIMLockStatusSignature, sim_lock_status_fields},
251 {&kCellularSignature, cellular_fields}, 260 {&kCellularSignature, cellular_fields},
(...skipping 24 matching lines...) Expand all
276 } // namespace 285 } // namespace
277 286
278 const StringTranslationEntry kNetworkTypeTable[] = { 287 const StringTranslationEntry kNetworkTypeTable[] = {
279 // This mapping is ensured in the translation code. 288 // This mapping is ensured in the translation code.
280 // { network_type::kEthernet, shill::kTypeEthernet }, 289 // { network_type::kEthernet, shill::kTypeEthernet },
281 // { network_type::kEthernet, shill::kTypeEthernetEap }, 290 // { network_type::kEthernet, shill::kTypeEthernetEap },
282 {::onc::network_type::kWiFi, shill::kTypeWifi}, 291 {::onc::network_type::kWiFi, shill::kTypeWifi},
283 {::onc::network_type::kWimax, shill::kTypeWimax}, 292 {::onc::network_type::kWimax, shill::kTypeWimax},
284 {::onc::network_type::kCellular, shill::kTypeCellular}, 293 {::onc::network_type::kCellular, shill::kTypeCellular},
285 {::onc::network_type::kVPN, shill::kTypeVPN}, 294 {::onc::network_type::kVPN, shill::kTypeVPN},
295 {::onc::network_type::kTether, kTypeTether},
286 {NULL}}; 296 {NULL}};
287 297
288 const StringTranslationEntry kVPNTypeTable[] = { 298 const StringTranslationEntry kVPNTypeTable[] = {
289 {::onc::vpn::kTypeL2TP_IPsec, shill::kProviderL2tpIpsec}, 299 {::onc::vpn::kTypeL2TP_IPsec, shill::kProviderL2tpIpsec},
290 {::onc::vpn::kOpenVPN, shill::kProviderOpenVpn}, 300 {::onc::vpn::kOpenVPN, shill::kProviderOpenVpn},
291 {::onc::vpn::kThirdPartyVpn, shill::kProviderThirdPartyVpn}, 301 {::onc::vpn::kThirdPartyVpn, shill::kProviderThirdPartyVpn},
292 {NULL}}; 302 {NULL}};
293 303
294 const StringTranslationEntry kWiFiSecurityTable[] = { 304 const StringTranslationEntry kWiFiSecurityTable[] = {
295 {::onc::wifi::kSecurityNone, shill::kSecurityNone}, 305 {::onc::wifi::kSecurityNone, shill::kSecurityNone},
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 continue; 449 continue;
440 *onc_value = table[i].onc_value; 450 *onc_value = table[i].onc_value;
441 return true; 451 return true;
442 } 452 }
443 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC"; 453 LOG(ERROR) << "Value '" << shill_value << "' cannot be translated to ONC";
444 return false; 454 return false;
445 } 455 }
446 456
447 } // namespace onc 457 } // namespace onc
448 } // namespace chromeos 458 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_signature.cc ('k') | chromeos/network/onc/onc_translator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698