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_NETWORK_STATE_H_ | 5 #ifndef CHROMEOS_NETWORK_NETWORK_STATE_H_ |
6 #define CHROMEOS_NETWORK_NETWORK_STATE_H_ | 6 #define CHROMEOS_NETWORK_NETWORK_STATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
| 11 #include "base/values.h" |
11 #include "chromeos/network/managed_state.h" | 12 #include "chromeos/network/managed_state.h" |
12 | 13 |
13 namespace base { | |
14 class DictionaryValue; | |
15 } | |
16 | |
17 namespace chromeos { | 14 namespace chromeos { |
18 | 15 |
19 // Simple class to provide network state information about a network service. | 16 // Simple class to provide network state information about a network service. |
20 // This class should always be passed as a const* and should never be held | 17 // This class should always be passed as a const* and should never be held |
21 // on to. Store network_state->path() (defined in ManagedState) instead and | 18 // on to. Store network_state->path() (defined in ManagedState) instead and |
22 // call NetworkStateHandler::GetNetworkState(path) to retrieve the state for | 19 // call NetworkStateHandler::GetNetworkState(path) to retrieve the state for |
23 // the network. | 20 // the network. |
24 class CHROMEOS_EXPORT NetworkState : public ManagedState { | 21 class CHROMEOS_EXPORT NetworkState : public ManagedState { |
25 public: | 22 public: |
26 explicit NetworkState(const std::string& path); | 23 explicit NetworkState(const std::string& path); |
(...skipping 11 matching lines...) Expand all Loading... |
38 void GetProperties(base::DictionaryValue* dictionary) const; | 35 void GetProperties(base::DictionaryValue* dictionary) const; |
39 | 36 |
40 // Accessors | 37 // Accessors |
41 const std::string& security() const { return security_; } | 38 const std::string& security() const { return security_; } |
42 const std::string& ip_address() const { return ip_address_; } | 39 const std::string& ip_address() const { return ip_address_; } |
43 const std::vector<std::string>& dns_servers() const { return dns_servers_; } | 40 const std::vector<std::string>& dns_servers() const { return dns_servers_; } |
44 const std::string& device_path() const { return device_path_; } | 41 const std::string& device_path() const { return device_path_; } |
45 const std::string& guid() const { return guid_; } | 42 const std::string& guid() const { return guid_; } |
46 const std::string& connection_state() const { return connection_state_; } | 43 const std::string& connection_state() const { return connection_state_; } |
47 const std::string& profile_path() const { return profile_path_; } | 44 const std::string& profile_path() const { return profile_path_; } |
48 const std::string& proxy_config() const { return proxy_config_; } | |
49 const std::string& error() const { return error_; } | 45 const std::string& error() const { return error_; } |
50 bool auto_connect() const { return auto_connect_; } | 46 bool auto_connect() const { return auto_connect_; } |
51 bool favorite() const { return favorite_; } | 47 bool favorite() const { return favorite_; } |
52 int priority() const { return priority_; } | 48 int priority() const { return priority_; } |
| 49 const base::DictionaryValue& proxy_config() const { return proxy_config_; } |
53 // Wireless property accessors | 50 // Wireless property accessors |
54 int signal_strength() const { return signal_strength_; } | 51 int signal_strength() const { return signal_strength_; } |
55 bool connectable() const { return connectable_; } | 52 bool connectable() const { return connectable_; } |
56 // Wifi property accessors | 53 // Wifi property accessors |
57 bool passphrase_required() const { return passphrase_required_; } | 54 bool passphrase_required() const { return passphrase_required_; } |
58 // Cellular property accessors | 55 // Cellular property accessors |
59 const std::string& technology() const { return technology_; } | 56 const std::string& technology() const { return technology_; } |
60 const std::string& activation_state() const { return activation_state_; } | 57 const std::string& activation_state() const { return activation_state_; } |
61 const std::string& roaming() const { return roaming_; } | 58 const std::string& roaming() const { return roaming_; } |
62 bool activate_over_non_cellular_networks() const { | 59 bool activate_over_non_cellular_networks() const { |
(...skipping 29 matching lines...) Expand all Loading... |
92 void set_dns_servers(const std::vector<std::string>& dns_servers) { | 89 void set_dns_servers(const std::vector<std::string>& dns_servers) { |
93 dns_servers_ = dns_servers; | 90 dns_servers_ = dns_servers; |
94 } | 91 } |
95 | 92 |
96 // Common Network Service properties | 93 // Common Network Service properties |
97 std::string security_; | 94 std::string security_; |
98 std::string device_path_; | 95 std::string device_path_; |
99 std::string guid_; | 96 std::string guid_; |
100 std::string connection_state_; | 97 std::string connection_state_; |
101 std::string profile_path_; | 98 std::string profile_path_; |
102 std::string proxy_config_; | |
103 std::string error_; | 99 std::string error_; |
104 bool auto_connect_; | 100 bool auto_connect_; |
105 bool favorite_; | 101 bool favorite_; |
106 int priority_; | 102 int priority_; |
| 103 // TODO(pneubeck): Remove this property once NetworkConfigurationHandler |
| 104 // provides proxy configuration. crbug/241775 |
| 105 base::DictionaryValue proxy_config_; |
107 // IPConfig properties. | 106 // IPConfig properties. |
108 // Note: These do not correspond to actual Shill.Service properties | 107 // Note: These do not correspond to actual Shill.Service properties |
109 // but are derived from the service's corresponding IPConfig object. | 108 // but are derived from the service's corresponding IPConfig object. |
110 std::string ip_address_; | 109 std::string ip_address_; |
111 std::vector<std::string> dns_servers_; | 110 std::vector<std::string> dns_servers_; |
112 // Wireless properties | 111 // Wireless properties |
113 int signal_strength_; | 112 int signal_strength_; |
114 bool connectable_; | 113 bool connectable_; |
115 // Wifi properties | 114 // Wifi properties |
116 std::string hex_ssid_; | 115 std::string hex_ssid_; |
117 std::string country_code_; | 116 std::string country_code_; |
118 bool passphrase_required_; | 117 bool passphrase_required_; |
119 // Cellular properties | 118 // Cellular properties |
120 std::string technology_; | 119 std::string technology_; |
121 std::string activation_state_; | 120 std::string activation_state_; |
122 std::string roaming_; | 121 std::string roaming_; |
123 bool activate_over_non_cellular_networks_; | 122 bool activate_over_non_cellular_networks_; |
124 bool cellular_out_of_credits_; | 123 bool cellular_out_of_credits_; |
125 | 124 |
126 DISALLOW_COPY_AND_ASSIGN(NetworkState); | 125 DISALLOW_COPY_AND_ASSIGN(NetworkState); |
127 }; | 126 }; |
128 | 127 |
129 } // namespace chromeos | 128 } // namespace chromeos |
130 | 129 |
131 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ | 130 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ |
OLD | NEW |