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

Side by Side Diff: chromeos/network/network_state.h

Issue 2819383002: [CrOS Tether] Update NetworkState to include tether properties and integrate into NetworkStateHandl… (Closed)
Patch Set: stevenjb@ comment. 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/network_connect_unittest.cc ('k') | chromeos/network/network_state.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 #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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/gtest_prod_util.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/values.h" 15 #include "base/values.h"
15 #include "chromeos/network/managed_state.h" 16 #include "chromeos/network/managed_state.h"
16 #include "components/onc/onc_constants.h" 17 #include "components/onc/onc_constants.h"
17 #include "url/gurl.h" 18 #include "url/gurl.h"
18 19
19 namespace base { 20 namespace base {
20 class DictionaryValue; 21 class DictionaryValue;
21 class Value; 22 class Value;
22 } 23 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // so cache them to avoid excessively complex client code. 73 // so cache them to avoid excessively complex client code.
73 const std::string& ip_address() const { return ip_address_; } 74 const std::string& ip_address() const { return ip_address_; }
74 const std::string& gateway() const { return gateway_; } 75 const std::string& gateway() const { return gateway_; }
75 const std::vector<std::string>& dns_servers() const { return dns_servers_; } 76 const std::vector<std::string>& dns_servers() const { return dns_servers_; }
76 const GURL& web_proxy_auto_discovery_url() const { 77 const GURL& web_proxy_auto_discovery_url() const {
77 return web_proxy_auto_discovery_url_; 78 return web_proxy_auto_discovery_url_;
78 } 79 }
79 80
80 // Wireless property accessors 81 // Wireless property accessors
81 bool connectable() const { return connectable_; } 82 bool connectable() const { return connectable_; }
83 void set_connectable(bool connectable) { connectable_ = connectable; }
82 bool is_captive_portal() const { return is_captive_portal_; } 84 bool is_captive_portal() const { return is_captive_portal_; }
83 int signal_strength() const { return signal_strength_; } 85 int signal_strength() const { return signal_strength_; }
86 void set_signal_strength(int signal_strength) {
87 signal_strength_ = signal_strength;
88 }
84 89
85 // Wifi property accessors 90 // Wifi property accessors
86 const std::string& eap_method() const { return eap_method_; } 91 const std::string& eap_method() const { return eap_method_; }
87 const std::vector<uint8_t>& raw_ssid() const { return raw_ssid_; } 92 const std::vector<uint8_t>& raw_ssid() const { return raw_ssid_; }
88 93
89 // Cellular property accessors 94 // Cellular property accessors
90 const std::string& network_technology() const { 95 const std::string& network_technology() const {
91 return network_technology_; 96 return network_technology_;
92 } 97 }
93 const std::string& activation_type() const { return activation_type_; } 98 const std::string& activation_type() const { return activation_type_; }
94 const std::string& activation_state() const { return activation_state_; } 99 const std::string& activation_state() const { return activation_state_; }
95 const std::string& roaming() const { return roaming_; } 100 const std::string& roaming() const { return roaming_; }
96 const std::string& payment_url() const { return payment_url_; } 101 const std::string& payment_url() const { return payment_url_; }
97 bool cellular_out_of_credits() const { return cellular_out_of_credits_; } 102 bool cellular_out_of_credits() const { return cellular_out_of_credits_; }
98 103
99 // VPN property accessors 104 // VPN property accessors
100 const std::string& vpn_provider_type() const { return vpn_provider_type_; } 105 const std::string& vpn_provider_type() const { return vpn_provider_type_; }
101 const std::string& third_party_vpn_provider_extension_id() const { 106 const std::string& third_party_vpn_provider_extension_id() const {
102 return third_party_vpn_provider_extension_id_; 107 return third_party_vpn_provider_extension_id_;
103 } 108 }
104 109
110 // Tether accessors and setters.
111 int battery_percentage() const { return battery_percentage_; }
112 void set_battery_percentage(int battery_percentage) {
113 battery_percentage_ = battery_percentage;
114 }
115 const std::string& carrier() const { return carrier_; }
116 void set_carrier(const std::string& carrier) { carrier_ = carrier; }
105 const std::string& tether_guid() const { return tether_guid_; } 117 const std::string& tether_guid() const { return tether_guid_; }
106 void set_tether_guid(const std::string& guid) { tether_guid_ = guid; } 118 void set_tether_guid(const std::string& guid) { tether_guid_ = guid; }
107 119
108 // Returns true if the network securty is WEP_8021x (Dynamic WEP) 120 // Returns true if the network securty is WEP_8021x (Dynamic WEP)
109 bool IsDynamicWep() const; 121 bool IsDynamicWep() const;
110 122
111 // Returns true if |connection_state_| is a connected/connecting state. 123 // Returns true if |connection_state_| is a connected/connecting state.
112 bool IsConnectedState() const; 124 bool IsConnectedState() const;
113 bool IsConnectingState() const; 125 bool IsConnectingState() const;
114 126
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 static bool StateIsConnected(const std::string& connection_state); 158 static bool StateIsConnected(const std::string& connection_state);
147 static bool StateIsConnecting(const std::string& connection_state); 159 static bool StateIsConnecting(const std::string& connection_state);
148 static bool NetworkStateIsCaptivePortal( 160 static bool NetworkStateIsCaptivePortal(
149 const base::DictionaryValue& shill_properties); 161 const base::DictionaryValue& shill_properties);
150 static bool ErrorIsValid(const std::string& error); 162 static bool ErrorIsValid(const std::string& error);
151 163
152 private: 164 private:
153 friend class MobileActivatorTest; 165 friend class MobileActivatorTest;
154 friend class NetworkStateHandler; 166 friend class NetworkStateHandler;
155 friend class NetworkChangeNotifierChromeosUpdateTest; 167 friend class NetworkChangeNotifierChromeosUpdateTest;
168 FRIEND_TEST_ALL_PREFIXES(NetworkStateTest, TetherProperties);
156 169
157 // Updates |name_| from WiFi.HexSSID if provided, and validates |name_|. 170 // Updates |name_| from WiFi.HexSSID if provided, and validates |name_|.
158 // Returns true if |name_| changes. 171 // Returns true if |name_| changes.
159 bool UpdateName(const base::DictionaryValue& properties); 172 bool UpdateName(const base::DictionaryValue& properties);
160 173
161 // Set to true if the network is a member of Manager.Services. 174 // Set to true if the network is a member of Manager.Services.
162 bool visible_ = false; 175 bool visible_ = false;
163 176
164 // Network Service properties. Avoid adding any additional properties here. 177 // Network Service properties. Avoid adding any additional properties here.
165 // Instead use NetworkConfigurationHandler::GetProperties() to asynchronously 178 // Instead use NetworkConfigurationHandler::GetProperties() to asynchronously
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 std::string activation_state_; 219 std::string activation_state_;
207 std::string roaming_; 220 std::string roaming_;
208 std::string payment_url_; 221 std::string payment_url_;
209 bool cellular_out_of_credits_ = false; 222 bool cellular_out_of_credits_ = false;
210 223
211 // VPN properties, used to construct the display name and to show the correct 224 // VPN properties, used to construct the display name and to show the correct
212 // configuration dialog. 225 // configuration dialog.
213 std::string vpn_provider_type_; 226 std::string vpn_provider_type_;
214 std::string third_party_vpn_provider_extension_id_; 227 std::string third_party_vpn_provider_extension_id_;
215 228
229 // Tether properties.
230 std::string carrier_;
231 int battery_percentage_;
232
216 // TODO(pneubeck): Remove this once (Managed)NetworkConfigurationHandler 233 // TODO(pneubeck): Remove this once (Managed)NetworkConfigurationHandler
217 // provides proxy configuration. crbug.com/241775 234 // provides proxy configuration. crbug.com/241775
218 base::DictionaryValue proxy_config_; 235 base::DictionaryValue proxy_config_;
219 236
220 DISALLOW_COPY_AND_ASSIGN(NetworkState); 237 DISALLOW_COPY_AND_ASSIGN(NetworkState);
221 }; 238 };
222 239
223 } // namespace chromeos 240 } // namespace chromeos
224 241
225 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ 242 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_
OLDNEW
« no previous file with comments | « chromeos/network/network_connect_unittest.cc ('k') | chromeos/network/network_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698