Roll src/third_party/WebKit b41a10f:afd8afd (svn 202201:202202)
[chromium-blink-merge.git] / chromeos / network / device_state.h
blob6542ff78d2ea370d31f89cde5a591b6f1dca91b5
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
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_NETWORK_DEVICE_STATE_H_
6 #define CHROMEOS_NETWORK_DEVICE_STATE_H_
8 #include "base/values.h"
9 #include "chromeos/network/managed_state.h"
10 #include "chromeos/network/network_util.h"
12 namespace chromeos {
14 // Simple class to provide device state information. Similar to NetworkState;
15 // see network_state.h for usage guidelines.
16 class CHROMEOS_EXPORT DeviceState : public ManagedState {
17 public:
18 typedef std::vector<CellularScanResult> CellularScanResults;
20 explicit DeviceState(const std::string& path);
21 ~DeviceState() override;
23 // ManagedState overrides
24 bool PropertyChanged(const std::string& key,
25 const base::Value& value) override;
26 bool InitialPropertiesReceived(
27 const base::DictionaryValue& properties) override;
29 void IPConfigPropertiesChanged(const std::string& ip_config_path,
30 const base::DictionaryValue& properties);
32 // Accessors
33 const std::string& mac_address() const { return mac_address_; }
34 bool scanning() const { return scanning_; }
36 // Cellular specific accessors
37 const std::string& home_provider_id() const { return home_provider_id_; }
38 bool allow_roaming() const { return allow_roaming_; }
39 bool provider_requires_roaming() const { return provider_requires_roaming_; }
40 bool support_network_scan() const { return support_network_scan_; }
41 const std::string& technology_family() const { return technology_family_; }
42 const std::string& carrier() const { return carrier_; }
43 const std::string& sim_lock_type() const { return sim_lock_type_; }
44 uint32 sim_retries_left() const { return sim_retries_left_; }
45 const std::string& meid() const { return meid_; }
46 const std::string& imei() const { return imei_; }
47 const std::string& iccid() const { return iccid_; }
48 const std::string& mdn() const { return mdn_; }
49 const CellularScanResults& scan_results() const { return scan_results_; }
51 // |ip_configs_| is kept up to date by NetworkStateHandler.
52 const base::DictionaryValue& ip_configs() const { return ip_configs_; }
54 // Do not use this. It exists temporarily for internet_options_handler.cc
55 // which is being deprecated.
56 const base::DictionaryValue& properties() const { return properties_; }
58 // Ethernet specific accessors
59 bool eap_authentication_completed() const {
60 return eap_authentication_completed_;
63 // Returns true if the technology family is GSM and sim_present_ is false.
64 bool IsSimAbsent() const;
66 private:
67 // Common Device Properties
68 std::string mac_address_;
70 // Cellular specific properties
71 std::string home_provider_id_;
72 bool allow_roaming_;
73 bool provider_requires_roaming_;
74 bool support_network_scan_;
75 bool scanning_;
76 std::string technology_family_;
77 std::string carrier_;
78 std::string sim_lock_type_;
79 uint32 sim_retries_left_;
80 bool sim_present_;
81 std::string meid_;
82 std::string imei_;
83 std::string iccid_;
84 std::string mdn_;
85 CellularScanResults scan_results_;
87 // Ethernet specific properties
88 bool eap_authentication_completed_;
90 // Keep all Device properties in a dictionary for now. See comment above.
91 base::DictionaryValue properties_;
93 // Dictionary of IPConfig properties, keyed by IpConfig path.
94 base::DictionaryValue ip_configs_;
96 DISALLOW_COPY_AND_ASSIGN(DeviceState);
99 } // namespace chromeos
101 #endif // CHROMEOS_NETWORK_DEVICE_STATE_H_