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 #ifndef CHROMEOS_NETWORK_DEVICE_STATE_H_ | 5 #ifndef CHROMEOS_NETWORK_DEVICE_STATE_H_ |
6 #define CHROMEOS_NETWORK_DEVICE_STATE_H_ | 6 #define CHROMEOS_NETWORK_DEVICE_STATE_H_ |
7 | 7 |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chromeos/network/managed_state.h" | 9 #include "chromeos/network/managed_state.h" |
10 #include "chromeos/network/network_util.h" | 10 #include "chromeos/network/network_util.h" |
11 | 11 |
12 namespace chromeos { | 12 namespace chromeos { |
13 | 13 |
14 // Simple class to provide device state information. Similar to NetworkState; | 14 // Simple class to provide device state information. Similar to NetworkState; |
15 // see network_state.h for usage guidelines. | 15 // see network_state.h for usage guidelines. |
16 class CHROMEOS_EXPORT DeviceState : public ManagedState { | 16 class CHROMEOS_EXPORT DeviceState : public ManagedState { |
17 public: | 17 public: |
18 typedef std::vector<CellularScanResult> CellularScanResults; | 18 typedef std::vector<CellularScanResult> CellularScanResults; |
19 | 19 |
20 explicit DeviceState(const std::string& path); | 20 explicit DeviceState(const std::string& path); |
21 virtual ~DeviceState(); | 21 virtual ~DeviceState(); |
22 | 22 |
23 // ManagedState overrides | 23 // ManagedState overrides |
24 virtual bool PropertyChanged(const std::string& key, | 24 virtual bool PropertyChanged(const std::string& key, |
25 const base::Value& value) OVERRIDE; | 25 const base::Value& value) OVERRIDE; |
26 virtual bool InitialPropertiesReceived( | 26 virtual bool InitialPropertiesReceived( |
27 const base::DictionaryValue& properties) OVERRIDE; | 27 const base::DictionaryValue& properties) OVERRIDE; |
28 | 28 |
29 void IPConfigPropertiesChanged(const std::string& ip_config_path, | |
30 const base::DictionaryValue& properties); | |
31 | |
29 // Accessors | 32 // Accessors |
30 const std::string& mac_address() const { return mac_address_; } | 33 const std::string& mac_address() const { return mac_address_; } |
31 | 34 |
32 // Returns |mac_address_| in aa:bb format. | 35 // Returns |mac_address_| in aa:bb format. |
33 std::string GetFormattedMacAddress() const; | 36 std::string GetFormattedMacAddress() const; |
34 | 37 |
35 // Cellular specific accessors | 38 // Cellular specific accessors |
36 const std::string& home_provider_id() const { return home_provider_id_; } | 39 const std::string& home_provider_id() const { return home_provider_id_; } |
37 bool allow_roaming() const { return allow_roaming_; } | 40 bool allow_roaming() const { return allow_roaming_; } |
38 bool provider_requires_roaming() const { return provider_requires_roaming_; } | 41 bool provider_requires_roaming() const { return provider_requires_roaming_; } |
39 bool support_network_scan() const { return support_network_scan_; } | 42 bool support_network_scan() const { return support_network_scan_; } |
40 bool scanning() const { return scanning_; } | 43 bool scanning() const { return scanning_; } |
41 const std::string& technology_family() const { return technology_family_; } | 44 const std::string& technology_family() const { return technology_family_; } |
42 const std::string& carrier() const { return carrier_; } | 45 const std::string& carrier() const { return carrier_; } |
43 const std::string& sim_lock_type() const { return sim_lock_type_; } | 46 const std::string& sim_lock_type() const { return sim_lock_type_; } |
44 uint32 sim_retries_left() const { return sim_retries_left_; } | 47 uint32 sim_retries_left() const { return sim_retries_left_; } |
45 bool sim_lock_enabled() const { return sim_lock_enabled_; } | 48 bool sim_lock_enabled() const { return sim_lock_enabled_; } |
46 const std::string& meid() const { return meid_; } | 49 const std::string& meid() const { return meid_; } |
47 const std::string& imei() const { return imei_; } | 50 const std::string& imei() const { return imei_; } |
48 const std::string& iccid() const { return iccid_; } | 51 const std::string& iccid() const { return iccid_; } |
49 const std::string& mdn() const { return mdn_; } | 52 const std::string& mdn() const { return mdn_; } |
50 const CellularScanResults& scan_results() const { return scan_results_; } | 53 const CellularScanResults& scan_results() const { return scan_results_; } |
51 | 54 |
52 // Do not use this. It exists temporarily for internet_options_handler.cc | 55 // Do not use this. It exists temporarily for internet_options_handler.cc |
53 // which is being deprecated. | 56 // which is being deprecated. |
54 const base::DictionaryValue& properties() const { return properties_; } | 57 const base::DictionaryValue& properties() const { return properties_; } |
58 const base::DictionaryValue& ip_configs() const { return ip_configs_; } | |
55 | 59 |
56 // Ethernet specific accessors | 60 // Ethernet specific accessors |
57 bool eap_authentication_completed() const { | 61 bool eap_authentication_completed() const { |
58 return eap_authentication_completed_; | 62 return eap_authentication_completed_; |
59 } | 63 } |
60 | 64 |
61 // Returns true if the technology family is GSM and sim_present_ is false. | 65 // Returns true if the technology family is GSM and sim_present_ is false. |
62 bool IsSimAbsent() const; | 66 bool IsSimAbsent() const; |
63 | 67 |
64 private: | 68 private: |
(...skipping 17 matching lines...) Expand all Loading... | |
82 std::string iccid_; | 86 std::string iccid_; |
83 std::string mdn_; | 87 std::string mdn_; |
84 CellularScanResults scan_results_; | 88 CellularScanResults scan_results_; |
85 | 89 |
86 // Ethernet specific properties | 90 // Ethernet specific properties |
87 bool eap_authentication_completed_; | 91 bool eap_authentication_completed_; |
88 | 92 |
89 // Keep all Device properties in a dictionary for now. See comment above. | 93 // Keep all Device properties in a dictionary for now. See comment above. |
90 base::DictionaryValue properties_; | 94 base::DictionaryValue properties_; |
91 | 95 |
96 // Dictionary of IPConfig properties, keyed by ip config path. | |
pneubeck (no reviews)
2014/05/05 21:09:28
maybe 'ip config path' -> 'IPConfig path'
stevenjb
2014/05/06 01:15:11
Done.
| |
97 base::DictionaryValue ip_configs_; | |
98 | |
92 DISALLOW_COPY_AND_ASSIGN(DeviceState); | 99 DISALLOW_COPY_AND_ASSIGN(DeviceState); |
93 }; | 100 }; |
94 | 101 |
95 } // namespace chromeos | 102 } // namespace chromeos |
96 | 103 |
97 #endif // CHROMEOS_NETWORK_DEVICE_STATE_H_ | 104 #endif // CHROMEOS_NETWORK_DEVICE_STATE_H_ |
OLD | NEW |