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

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

Issue 2819383002: [CrOS Tether] Update NetworkState to include tether properties and integrate into NetworkStateHandl… (Closed)
Patch Set: Update TODOs. 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
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_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
201 // found. This returns all entries (IsInProfile() may be true or false). 201 // found. This returns all entries (IsInProfile() may be true or false).
202 const NetworkState* GetNetworkStateFromGuid(const std::string& guid) const; 202 const NetworkState* GetNetworkStateFromGuid(const std::string& guid) const;
203 203
204 // Creates a Tether NetworkState that has no underlying shill type or 204 // Creates a Tether NetworkState that has no underlying shill type or
205 // service. When initially created, it does not actually represent a real 205 // service. When initially created, it does not actually represent a real
206 // network. The |guid| provided must be non-empty. If a network with |guid| 206 // network. The |guid| provided must be non-empty. If a network with |guid|
207 // already exists, this method will do nothing. Use the provided |guid| to 207 // already exists, this method will do nothing. Use the provided |guid| to
208 // refer to and fetch this NetworkState in the future. 208 // refer to and fetch this NetworkState in the future.
209 // NOTE: only GetNetworkStateFromGuid is supported to fetch "tether" 209 // NOTE: only GetNetworkStateFromGuid is supported to fetch "tether"
210 // NetworkStates. 210 // NetworkStates.
211 void AddTetherNetworkState(const std::string& guid, const std::string& name); 211 void AddTetherNetworkState(const std::string& guid,
212 const std::string& name,
213 const std::string& carrier,
214 int battery_percentage,
215 int signal_strength);
216
217 // Updates the tether properties (carrier, battery percentage, and signal
218 // strength) for a network which has already been added via
219 // AddTetherNetworkState. Returns whether the update was successful.
220 bool UpdateTetherNetworkProperties(const std::string& guid,
221 const std::string& carrier,
222 int battery_percentage,
223 int signal_strength);
212 224
213 // Remove a Tether NetworkState, using the same |guid| passed to 225 // Remove a Tether NetworkState, using the same |guid| passed to
214 // AddTetherNetworkState. 226 // AddTetherNetworkState.
215 void RemoveTetherNetworkState(const std::string& guid); 227 void RemoveTetherNetworkState(const std::string& guid);
216 228
217 // Inform NetworkStateHandler that the provided Tether network with the 229 // Inform NetworkStateHandler that the provided Tether network with the
218 // provided guid |tether_guid| is associated with the Wi-Fi network with the 230 // provided guid |tether_network_guid| is associated with the Wi-Fi network
219 // provided guid |wifi_ssid|. This Wi-Fi network can now be hidden in the UI, 231 // with the provided guid |wifi_network_guid|. This Wi-Fi network can now be
220 // and the Tether network will act as its proxy. Returns false if the 232 // hidden in the UI, and the Tether network will act as its proxy. Returns
221 // association failed (e.g. one or both networks don't exist). 233 // false if the association failed (e.g., one or both networks don't exist).
222 bool AssociateTetherNetworkStateWithWifiNetwork( 234 bool AssociateTetherNetworkStateWithWifiNetwork(
223 const std::string& tether_network_guid, 235 const std::string& tether_network_guid,
224 const std::string& wifi_network_ssid); 236 const std::string& wifi_network_guid);
225 237
226 // Set the connection_state of the Tether NetworkState corresponding to the 238 // Set the connection_state of the Tether NetworkState corresponding to the
227 // provided |guid| to "Disconnected". This will be reflected in the UI. 239 // provided |guid| to "Disconnected". This will be reflected in the UI.
228 void SetTetherNetworkStateDisconnected(const std::string& guid); 240 void SetTetherNetworkStateDisconnected(const std::string& guid);
229 241
230 // Set the connection_state of the Tether NetworkState corresponding to the 242 // Set the connection_state of the Tether NetworkState corresponding to the
231 // provided |guid| to "Connecting". This will be reflected in the UI. 243 // provided |guid| to "Connecting". This will be reflected in the UI.
232 void SetTetherNetworkStateConnecting(const std::string& guid); 244 void SetTetherNetworkStateConnecting(const std::string& guid);
233 245
234 // Set the connection_state of the Tether NetworkState corresponding to the 246 // Set the connection_state of the Tether NetworkState corresponding to the
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 void NotifyScanCompleted(const DeviceState* device); 439 void NotifyScanCompleted(const DeviceState* device);
428 440
429 // Returns one technology type for |type|. This technology will be the 441 // Returns one technology type for |type|. This technology will be the
430 // highest priority technology in the type pattern. 442 // highest priority technology in the type pattern.
431 std::string GetTechnologyForType(const NetworkTypePattern& type) const; 443 std::string GetTechnologyForType(const NetworkTypePattern& type) const;
432 444
433 // Returns all the technology types for |type|. 445 // Returns all the technology types for |type|.
434 std::vector<std::string> GetTechnologiesForType( 446 std::vector<std::string> GetTechnologiesForType(
435 const NetworkTypePattern& type) const; 447 const NetworkTypePattern& type) const;
436 448
449 // Set the connection_state of a Tether NetworkState corresponding to the
450 // provided |guid|.
451 void SetTetherNetworkStateConnectionState(
452 const std::string& guid,
453 const std::string& connection_state);
454
437 // Shill property handler instance, owned by this class. 455 // Shill property handler instance, owned by this class.
438 std::unique_ptr<internal::ShillPropertyHandler> shill_property_handler_; 456 std::unique_ptr<internal::ShillPropertyHandler> shill_property_handler_;
439 457
440 // Observer list 458 // Observer list
441 base::ObserverList<NetworkStateHandlerObserver, true> observers_; 459 base::ObserverList<NetworkStateHandlerObserver, true> observers_;
442 460
443 // List of managed network states 461 // List of managed network states
444 ManagedStateList network_list_; 462 ManagedStateList network_list_;
445 463
446 // List of managed Tether network states, which exist separately from 464 // List of managed Tether network states, which exist separately from
(...skipping 13 matching lines...) Expand all
460 // List of interfaces on which portal check is enabled. 478 // List of interfaces on which portal check is enabled.
461 std::string check_portal_list_; 479 std::string check_portal_list_;
462 480
463 // Map of network specifiers to guids. Contains an entry for each 481 // Map of network specifiers to guids. Contains an entry for each
464 // NetworkState that is not saved in a profile. 482 // NetworkState that is not saved in a profile.
465 SpecifierGuidMap specifier_guid_map_; 483 SpecifierGuidMap specifier_guid_map_;
466 484
467 // Ensure that Shutdown() gets called exactly once. 485 // Ensure that Shutdown() gets called exactly once.
468 bool did_shutdown_ = false; 486 bool did_shutdown_ = false;
469 487
470 // Set the |connection_state| of a Tether NetworkState corresponding to the
471 // provided |guid|.
472 void SetTetherNetworkStateConnectionState(
473 const std::string& guid,
474 const std::string& connection_state);
475
476 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); 488 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler);
477 }; 489 };
478 490
479 } // namespace chromeos 491 } // namespace chromeos
480 492
481 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ 493 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698