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_HANDLER_H_ | 5 #ifndef CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ |
6 #define CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ | 6 #define CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 bool configured_only) const; | 201 bool configured_only) const; |
202 | 202 |
203 // Finds and returns the NetworkState associated with |guid| or NULL if not | 203 // Finds and returns the NetworkState associated with |guid| or NULL if not |
204 // found. This returns all entries (IsInProfile() may be true or false). | 204 // found. This returns all entries (IsInProfile() may be true or false). |
205 const NetworkState* GetNetworkStateFromGuid(const std::string& guid) const; | 205 const NetworkState* GetNetworkStateFromGuid(const std::string& guid) const; |
206 | 206 |
207 // Creates a Tether NetworkState that has no underlying shill type or | 207 // Creates a Tether NetworkState that has no underlying shill type or |
208 // service. When initially created, it does not actually represent a real | 208 // service. When initially created, it does not actually represent a real |
209 // network. The |guid| provided must be non-empty. If a network with |guid| | 209 // network. The |guid| provided must be non-empty. If a network with |guid| |
210 // already exists, this method will do nothing. Use the provided |guid| to | 210 // already exists, this method will do nothing. Use the provided |guid| to |
211 // refer to and fetch this NetworkState in the future. | 211 // refer to and fetch this NetworkState in the future. Note that the |
212 // NOTE: only GetNetworkStateFromGuid is supported to fetch "tether" | 212 // |has_connected_to_host| parameter refers to whether the current device has |
213 // NetworkStates. | 213 // already connected to the tether host device providing this Tether network |
214 // in the past. | |
214 void AddTetherNetworkState(const std::string& guid, | 215 void AddTetherNetworkState(const std::string& guid, |
215 const std::string& name, | 216 const std::string& name, |
216 const std::string& carrier, | 217 const std::string& carrier, |
217 int battery_percentage, | 218 int battery_percentage, |
218 int signal_strength); | 219 int signal_strength, |
220 bool has_connected_to_host); | |
219 | 221 |
220 // Updates the tether properties (carrier, battery percentage, and signal | 222 // Updates the tether properties (carrier, battery percentage, and signal |
221 // strength) for a network which has already been added via | 223 // strength) for a network which has already been added via |
222 // AddTetherNetworkState. Returns whether the update was successful. | 224 // AddTetherNetworkState. Returns whether the update was successful. |
223 bool UpdateTetherNetworkProperties(const std::string& guid, | 225 bool UpdateTetherNetworkProperties(const std::string& guid, |
224 const std::string& carrier, | 226 const std::string& carrier, |
225 int battery_percentage, | 227 int battery_percentage, |
226 int signal_strength); | 228 int signal_strength); |
227 | 229 |
230 // Updates the whether the Tether network with GUID |guid| has connected to | |
stevenjb
2017/05/01 16:11:31
s/the whether/whether/
Kyle Horimoto
2017/05/01 16:56:27
Done.
| |
231 // the host device before, setting the value to true. Note that there is no | |
232 // way to change this value back to false. If no network with GUID |guid| is | |
233 // registered or if the network is registered and its HasConnectedToHost value | |
234 // was already true, this function does nothing. Returns whether the value was | |
235 // actually changed. | |
236 bool SetTetherNetworkHasConnectedToHost(const std::string& guid); | |
237 | |
228 // Remove a Tether NetworkState, using the same |guid| passed to | 238 // Remove a Tether NetworkState, using the same |guid| passed to |
229 // AddTetherNetworkState. | 239 // AddTetherNetworkState(). If no network with GUI |guid| is registered, this |
stevenjb
2017/05/01 16:11:31
s/GUI/GUID/ or 'id' or just 'with |guid|'
Kyle Horimoto
2017/05/01 16:56:27
Done.
| |
230 void RemoveTetherNetworkState(const std::string& guid); | 240 // function does nothing. Returns whether the network was actually removed. |
241 bool RemoveTetherNetworkState(const std::string& guid); | |
231 | 242 |
232 // Inform NetworkStateHandler that the provided Tether network with the | 243 // Inform NetworkStateHandler that the provided Tether network with the |
233 // provided guid |tether_network_guid| is associated with the Wi-Fi network | 244 // provided guid |tether_network_guid| is associated with the Wi-Fi network |
234 // with the provided guid |wifi_network_guid|. This Wi-Fi network can now be | 245 // with the provided guid |wifi_network_guid|. This Wi-Fi network can now be |
235 // hidden in the UI, and the Tether network will act as its proxy. Returns | 246 // hidden in the UI, and the Tether network will act as its proxy. Returns |
236 // false if the association failed (e.g., one or both networks don't exist). | 247 // false if the association failed (e.g., one or both networks don't exist). |
237 bool AssociateTetherNetworkStateWithWifiNetwork( | 248 bool AssociateTetherNetworkStateWithWifiNetwork( |
238 const std::string& tether_network_guid, | 249 const std::string& tether_network_guid, |
239 const std::string& wifi_network_guid); | 250 const std::string& wifi_network_guid); |
240 | 251 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
507 | 518 |
508 // Ensure that Shutdown() gets called exactly once. | 519 // Ensure that Shutdown() gets called exactly once. |
509 bool did_shutdown_ = false; | 520 bool did_shutdown_ = false; |
510 | 521 |
511 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); | 522 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); |
512 }; | 523 }; |
513 | 524 |
514 } // namespace chromeos | 525 } // namespace chromeos |
515 | 526 |
516 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ | 527 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ |
OLD | NEW |