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

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

Issue 873713004: Introduce NetworkState::is_captive_portal() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 11 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
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>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 // so cache them to avoid excessively complex client code. 69 // so cache them to avoid excessively complex client code.
70 const std::string& ip_address() const { return ip_address_; } 70 const std::string& ip_address() const { return ip_address_; }
71 const std::string& gateway() const { return gateway_; } 71 const std::string& gateway() const { return gateway_; }
72 const std::vector<std::string>& dns_servers() const { return dns_servers_; } 72 const std::vector<std::string>& dns_servers() const { return dns_servers_; }
73 const GURL& web_proxy_auto_discovery_url() const { 73 const GURL& web_proxy_auto_discovery_url() const {
74 return web_proxy_auto_discovery_url_; 74 return web_proxy_auto_discovery_url_;
75 } 75 }
76 76
77 // Wireless property accessors 77 // Wireless property accessors
78 bool connectable() const { return connectable_; } 78 bool connectable() const { return connectable_; }
79 bool is_captive_portal() const { return is_captive_portal_; }
79 int signal_strength() const { return signal_strength_; } 80 int signal_strength() const { return signal_strength_; }
80 81
81 // Wifi property accessors 82 // Wifi property accessors
82 const std::string& eap_method() const { return eap_method_; } 83 const std::string& eap_method() const { return eap_method_; }
83 const std::vector<uint8_t>& raw_ssid() const { return raw_ssid_; } 84 const std::vector<uint8_t>& raw_ssid() const { return raw_ssid_; }
84 85
85 // Cellular property accessors 86 // Cellular property accessors
86 const std::string& network_technology() const { 87 const std::string& network_technology() const {
87 return network_technology_; 88 return network_technology_;
88 } 89 }
(...skipping 20 matching lines...) Expand all
109 std::string GetNetmask() const; 110 std::string GetNetmask() const;
110 111
111 // Returns a specifier for identifying this network in the absence of a GUID. 112 // Returns a specifier for identifying this network in the absence of a GUID.
112 // This should only be used by NetworkStateHandler for keeping track of 113 // This should only be used by NetworkStateHandler for keeping track of
113 // GUIDs assigned to unsaved networks. 114 // GUIDs assigned to unsaved networks.
114 std::string GetSpecifier() const; 115 std::string GetSpecifier() const;
115 116
116 // Set the GUID. Called exclusively by NetworkStateHandler. 117 // Set the GUID. Called exclusively by NetworkStateHandler.
117 void SetGuid(const std::string& guid); 118 void SetGuid(const std::string& guid);
118 119
119 // Helpers (used e.g. when a state or error is cached) 120 // Helpers (used e.g. when a state, error, or shill dictionary is cached)
120 static bool StateIsConnected(const std::string& connection_state); 121 static bool StateIsConnected(const std::string& connection_state);
121 static bool StateIsConnecting(const std::string& connection_state); 122 static bool StateIsConnecting(const std::string& connection_state);
123 static bool NetworkStateIsCaptivePortal(
124 const base::DictionaryValue& shill_properties);
122 static bool ErrorIsValid(const std::string& error); 125 static bool ErrorIsValid(const std::string& error);
123 126
124 private: 127 private:
125 friend class MobileActivatorTest; 128 friend class MobileActivatorTest;
126 friend class NetworkStateHandler; 129 friend class NetworkStateHandler;
127 friend class NetworkChangeNotifierChromeosUpdateTest; 130 friend class NetworkChangeNotifierChromeosUpdateTest;
128 131
129 // Updates |name_| from WiFi.HexSSID if provided, and validates |name_|. 132 // Updates |name_| from WiFi.HexSSID if provided, and validates |name_|.
130 // Returns true if |name_| changes. 133 // Returns true if |name_| changes.
131 bool UpdateName(const base::DictionaryValue& properties); 134 bool UpdateName(const base::DictionaryValue& properties);
132 135
133 // Set to true if the network is a member of Manager.Services. 136 // Set to true if the network is a member of Manager.Services.
134 bool visible_; 137 bool visible_;
135 138
136 // Network Service properties. Avoid adding any additional properties here. 139 // Network Service properties. Avoid adding any additional properties here.
137 // Instead use NetworkConfigurationHandler::GetProperties() to asynchronously 140 // Instead use NetworkConfigurationHandler::GetProperties() to asynchronously
138 // request properties from Shill. 141 // request properties from Shill.
139 std::string security_class_; 142 std::string security_class_;
140 std::string eap_method_; // Needed for WiFi EAP networks 143 std::string eap_method_; // Needed for WiFi EAP networks
141 std::string device_path_; 144 std::string device_path_;
142 std::string guid_; 145 std::string guid_;
143 std::string connection_state_; 146 std::string connection_state_;
144 std::string profile_path_; 147 std::string profile_path_;
145 std::vector<uint8_t> raw_ssid_; // Unknown encoding. Not necessarily UTF-8. 148 std::vector<uint8_t> raw_ssid_; // Unknown encoding. Not necessarily UTF-8.
146 bool connectable_;
147 149
148 // Reflects the current Shill Service.Error property. This might get cleared 150 // Reflects the current Shill Service.Error property. This might get cleared
149 // by Shill shortly after a failure. 151 // by Shill shortly after a failure.
150 std::string error_; 152 std::string error_;
151 153
152 // Last non empty Service.Error property. Cleared by NetworkConnectionHandler 154 // Last non empty Service.Error property. Cleared by NetworkConnectionHandler
153 // when a connection attempt is initiated. 155 // when a connection attempt is initiated.
154 std::string last_error_; 156 std::string last_error_;
155 157
156 // IPConfig properties. 158 // IPConfig properties.
157 // Note: These do not correspond to actual Shill.Service properties 159 // Note: These do not correspond to actual Shill.Service properties
158 // but are derived from the service's corresponding IPConfig object. 160 // but are derived from the service's corresponding IPConfig object.
159 std::string ip_address_; 161 std::string ip_address_;
160 std::string gateway_; 162 std::string gateway_;
161 std::vector<std::string> dns_servers_; 163 std::vector<std::string> dns_servers_;
162 int prefix_length_; // Used by GetNetmask() 164 int prefix_length_; // Used by GetNetmask()
163 GURL web_proxy_auto_discovery_url_; 165 GURL web_proxy_auto_discovery_url_;
164 166
165 // Wireless properties, used for icons and Connect logic. 167 // Wireless properties, used for icons and Connect logic.
168 bool connectable_;
pneubeck (no reviews) 2015/01/24 10:06:56 is this a pure wireless state? i guessed it would
stevenjb 2015/01/26 20:16:30 Hmm, interesting point. I moved this to match the
169 bool is_captive_portal_;
166 int signal_strength_; 170 int signal_strength_;
167 171
168 // Cellular properties, used for icons, Connect, and Activation. 172 // Cellular properties, used for icons, Connect, and Activation.
169 std::string network_technology_; 173 std::string network_technology_;
170 std::string activation_type_; 174 std::string activation_type_;
171 std::string activation_state_; 175 std::string activation_state_;
172 std::string roaming_; 176 std::string roaming_;
173 std::string payment_url_; 177 std::string payment_url_;
174 bool cellular_out_of_credits_; 178 bool cellular_out_of_credits_;
175 179
176 // TODO(pneubeck): Remove this once (Managed)NetworkConfigurationHandler 180 // TODO(pneubeck): Remove this once (Managed)NetworkConfigurationHandler
177 // provides proxy configuration. crbug.com/241775 181 // provides proxy configuration. crbug.com/241775
178 base::DictionaryValue proxy_config_; 182 base::DictionaryValue proxy_config_;
179 183
180 DISALLOW_COPY_AND_ASSIGN(NetworkState); 184 DISALLOW_COPY_AND_ASSIGN(NetworkState);
181 }; 185 };
182 186
183 } // namespace chromeos 187 } // namespace chromeos
184 188
185 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ 189 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698