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

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

Issue 2852693004: [CrOS Tether] Create HostScanCache, which caches scan results and inserts them into the network sta… (Closed)
Patch Set: Fixed comment, added tests for TestHostResponseRecorder::Observer. Created 3 years, 7 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
212 // NOTE: only GetNetworkStateFromGuid is supported to fetch "tether"
213 // NetworkStates.
214 void AddTetherNetworkState(const std::string& guid, 212 void AddTetherNetworkState(const std::string& guid,
215 const std::string& name, 213 const std::string& name,
216 const std::string& carrier, 214 const std::string& carrier,
217 int battery_percentage, 215 int battery_percentage,
218 int signal_strength); 216 int signal_strength,
217 bool has_connected_to_host);
Ryan Hansberry 2017/04/28 22:31:04 Please explain this argument in the documentation,
Kyle Horimoto 2017/04/28 22:45:04 Changed the description. We talked about this nam
219 218
220 // Updates the tether properties (carrier, battery percentage, and signal 219 // Updates the tether properties (carrier, battery percentage, and signal
221 // strength) for a network which has already been added via 220 // strength) for a network which has already been added via
222 // AddTetherNetworkState. Returns whether the update was successful. 221 // AddTetherNetworkState. Returns whether the update was successful.
223 bool UpdateTetherNetworkProperties(const std::string& guid, 222 bool UpdateTetherNetworkProperties(const std::string& guid,
224 const std::string& carrier, 223 const std::string& carrier,
225 int battery_percentage, 224 int battery_percentage,
226 int signal_strength); 225 int signal_strength);
227 226
227 // Updates the HasConnectedToHost property of the Tether network with GUID
228 // |guid| to true. If no network with GUID |guid| is registered or if the
229 // network is registered and its HasConnectedToHost value was already true,
Ryan Hansberry 2017/04/28 22:31:04 I assume this shouldn't be camel-case and should b
Kyle Horimoto 2017/04/28 22:45:04 I named it that way because this is the name of th
230 // this function does nothing. Returns whether the value was actually changed.
231 bool SetTetherNetworkHasConnectedToHost(const std::string& guid);
232
228 // Remove a Tether NetworkState, using the same |guid| passed to 233 // Remove a Tether NetworkState, using the same |guid| passed to
229 // AddTetherNetworkState. 234 // AddTetherNetworkState(). If no network with GUI |guid| is registered, this
230 void RemoveTetherNetworkState(const std::string& guid); 235 // function does nothing. Returns whether the network was actually removed.
236 bool RemoveTetherNetworkState(const std::string& guid);
231 237
232 // Inform NetworkStateHandler that the provided Tether network with the 238 // Inform NetworkStateHandler that the provided Tether network with the
233 // provided guid |tether_network_guid| is associated with the Wi-Fi network 239 // 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 240 // 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 241 // 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). 242 // false if the association failed (e.g., one or both networks don't exist).
237 bool AssociateTetherNetworkStateWithWifiNetwork( 243 bool AssociateTetherNetworkStateWithWifiNetwork(
238 const std::string& tether_network_guid, 244 const std::string& tether_network_guid,
239 const std::string& wifi_network_guid); 245 const std::string& wifi_network_guid);
240 246
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 513
508 // Ensure that Shutdown() gets called exactly once. 514 // Ensure that Shutdown() gets called exactly once.
509 bool did_shutdown_ = false; 515 bool did_shutdown_ = false;
510 516
511 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); 517 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler);
512 }; 518 };
513 519
514 } // namespace chromeos 520 } // namespace chromeos
515 521
516 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ 522 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698