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> |
| 9 #include <vector> |
| 10 |
8 #include "chromeos/network/managed_state.h" | 11 #include "chromeos/network/managed_state.h" |
9 | 12 |
10 namespace base { | 13 namespace base { |
11 class DictionaryValue; | 14 class DictionaryValue; |
12 } | 15 } |
13 | 16 |
14 namespace chromeos { | 17 namespace chromeos { |
15 | 18 |
16 // Simple class to provide network state information about a network service. | 19 // Simple class to provide network state information about a network service. |
17 // This class should always be passed as a const* and should never be held | 20 // This class should always be passed as a const* and should never be held |
(...skipping 11 matching lines...) Expand all Loading... |
29 const base::Value& value) OVERRIDE; | 32 const base::Value& value) OVERRIDE; |
30 | 33 |
31 // Fills |dictionary| with the state properties. All the properties that are | 34 // Fills |dictionary| with the state properties. All the properties that are |
32 // accepted by PropertyChanged are stored in |dictionary|, no other values are | 35 // accepted by PropertyChanged are stored in |dictionary|, no other values are |
33 // stored. | 36 // stored. |
34 void GetProperties(base::DictionaryValue* dictionary) const; | 37 void GetProperties(base::DictionaryValue* dictionary) const; |
35 | 38 |
36 // Accessors | 39 // Accessors |
37 const std::string& security() const { return security_; } | 40 const std::string& security() const { return security_; } |
38 const std::string& ip_address() const { return ip_address_; } | 41 const std::string& ip_address() const { return ip_address_; } |
| 42 const std::vector<std::string>& dns_servers() const { return dns_servers_; } |
39 const std::string& device_path() const { return device_path_; } | 43 const std::string& device_path() const { return device_path_; } |
40 const std::string& guid() const { return guid_; } | 44 const std::string& guid() const { return guid_; } |
41 const std::string& connection_state() const { return connection_state_; } | 45 const std::string& connection_state() const { return connection_state_; } |
42 const std::string& error() const { return error_; } | 46 const std::string& error() const { return error_; } |
43 // Wireless property accessors | 47 // Wireless property accessors |
44 int signal_strength() const { return signal_strength_; } | 48 int signal_strength() const { return signal_strength_; } |
45 // Cellular property accessors | 49 // Cellular property accessors |
46 const std::string& technology() const { return technology_; } | 50 const std::string& technology() const { return technology_; } |
47 const std::string& activation_state() const { return activation_state_; } | 51 const std::string& activation_state() const { return activation_state_; } |
48 const std::string& roaming() const { return roaming_; } | 52 const std::string& roaming() const { return roaming_; } |
(...skipping 10 matching lines...) Expand all Loading... |
59 static bool StateIsConnecting(const std::string& connection_state); | 63 static bool StateIsConnecting(const std::string& connection_state); |
60 | 64 |
61 private: | 65 private: |
62 friend class NetworkStateHandler; | 66 friend class NetworkStateHandler; |
63 friend class NetworkChangeNotifierChromeosUpdateTest; | 67 friend class NetworkChangeNotifierChromeosUpdateTest; |
64 | 68 |
65 // Called by NetworkStateHandler when the ip config changes. | 69 // Called by NetworkStateHandler when the ip config changes. |
66 void set_ip_address(const std::string& ip_address) { | 70 void set_ip_address(const std::string& ip_address) { |
67 ip_address_ = ip_address; | 71 ip_address_ = ip_address; |
68 } | 72 } |
| 73 void set_dns_servers(const std::vector<std::string>& dns_servers) { |
| 74 dns_servers_ = dns_servers; |
| 75 } |
69 | 76 |
70 // Common Network Service properties | 77 // Common Network Service properties |
71 std::string security_; | 78 std::string security_; |
72 std::string device_path_; | 79 std::string device_path_; |
73 std::string guid_; | 80 std::string guid_; |
74 std::string ip_address_; | |
75 std::string connection_state_; | 81 std::string connection_state_; |
76 std::string error_; | 82 std::string error_; |
| 83 // IPConfig properties. |
| 84 // Note: These do not correspond to actual Shill.Service properties |
| 85 // but are derived from the service's corresponding IPConfig object. |
| 86 std::string ip_address_; |
| 87 std::vector<std::string> dns_servers_; |
77 // Wireless properties | 88 // Wireless properties |
78 int signal_strength_; | 89 int signal_strength_; |
79 // Cellular properties | 90 // Cellular properties |
80 std::string technology_; | 91 std::string technology_; |
81 std::string activation_state_; | 92 std::string activation_state_; |
82 std::string roaming_; | 93 std::string roaming_; |
83 bool activate_over_non_cellular_networks_; | 94 bool activate_over_non_cellular_networks_; |
84 bool cellular_out_of_credits_; | 95 bool cellular_out_of_credits_; |
85 | 96 |
86 DISALLOW_COPY_AND_ASSIGN(NetworkState); | 97 DISALLOW_COPY_AND_ASSIGN(NetworkState); |
87 }; | 98 }; |
88 | 99 |
89 } // namespace chromeos | 100 } // namespace chromeos |
90 | 101 |
91 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ | 102 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ |
OLD | NEW |