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

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

Issue 2819993002: [CrOS Tether] Add the notion of a tether DeviceState. (Closed)
Patch Set: Rebased. 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } 105 }
106 106
107 // Asynchronously sets the technology enabled property for |type|. Only 107 // Asynchronously sets the technology enabled property for |type|. Only
108 // NetworkTypePattern::Primitive, ::Mobile and ::Ethernet are supported. 108 // NetworkTypePattern::Primitive, ::Mobile and ::Ethernet are supported.
109 // Note: Modifies Manager state. Calls |error_callback| on failure. 109 // Note: Modifies Manager state. Calls |error_callback| on failure.
110 void SetTechnologyEnabled( 110 void SetTechnologyEnabled(
111 const NetworkTypePattern& type, 111 const NetworkTypePattern& type,
112 bool enabled, 112 bool enabled,
113 const network_handler::ErrorCallback& error_callback); 113 const network_handler::ErrorCallback& error_callback);
114 114
115 // Sets the tether technology state. Because tether networks do not represent
Ryan Hansberry 2017/04/20 01:38:35 Please refer to as "Tether" throughout documentati
Kyle Horimoto 2017/04/20 02:16:08 Done.
116 // real Shill networks, this value must be set by the tether component rather
117 // than being generated by Shill. See TetherDeviceStateManager for more
118 // details.
119 void SetTetherTechnologyState(TechnologyState technology_state);
120
121 // Sets the scanning state of the tether technology. Since tether network
122 // scans are not actually performed as part of Shill, this value must be set
123 // by the tether component.
124 void SetTetherScanState(bool is_scanning);
125
115 // Asynchronously sets the list of prohibited technologies. The accepted 126 // Asynchronously sets the list of prohibited technologies. The accepted
116 // values are the shill network technology identifiers. See also 127 // values are the shill network technology identifiers. See also
117 // chromeos::onc::Validator::ValidateGlobalNetworkConfiguration(). 128 // chromeos::onc::Validator::ValidateGlobalNetworkConfiguration().
118 void SetProhibitedTechnologies( 129 void SetProhibitedTechnologies(
119 const std::vector<std::string>& prohibited_technologies, 130 const std::vector<std::string>& prohibited_technologies,
120 const network_handler::ErrorCallback& error_callback); 131 const network_handler::ErrorCallback& error_callback);
121 132
122 // Finds and returns a device state by |device_path| or NULL if not found. 133 // Finds and returns a device state by |device_path| or NULL if not found.
123 const DeviceState* GetDeviceState(const std::string& device_path) const; 134 const DeviceState* GetDeviceState(const std::string& device_path) const;
124 135
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 // a copy of DeviceState pointers which should not be stored or used beyond 254 // a copy of DeviceState pointers which should not be stored or used beyond
244 // the scope of the calling function (i.e. they may later become invalid, but 255 // the scope of the calling function (i.e. they may later become invalid, but
245 // only on the UI thread). 256 // only on the UI thread).
246 void GetDeviceList(DeviceStateList* list) const; 257 void GetDeviceList(DeviceStateList* list) const;
247 258
248 // Like GetDeviceList() but only returns networks with matching |type|. 259 // Like GetDeviceList() but only returns networks with matching |type|.
249 void GetDeviceListByType(const NetworkTypePattern& type, 260 void GetDeviceListByType(const NetworkTypePattern& type,
250 DeviceStateList* list) const; 261 DeviceStateList* list) const;
251 262
252 // Requests a network scan. This may trigger updates to the network 263 // Requests a network scan. This may trigger updates to the network
253 // list, which will trigger the appropriate observer calls. 264 // list, which will trigger the appropriate observer calls. Note that this
265 // function does not request a tether scan.
266 // TODO(khorimoto): Add an also_scan_for_tether parameter. Tether scans should
267 // not occur during start-up, but they should occur when opening networking
268 // UI.
254 void RequestScan() const; 269 void RequestScan() const;
255 270
256 // Requests an update for an existing NetworkState, e.g. after configuring 271 // Requests an update for an existing NetworkState, e.g. after configuring
257 // a network. This is a no-op if an update request is already pending. To 272 // a network. This is a no-op if an update request is already pending. To
258 // ensure that a change is picked up, this must be called after Shill 273 // ensure that a change is picked up, this must be called after Shill
259 // acknowledged it (e.g. in the callback of a SetProperties). 274 // acknowledged it (e.g. in the callback of a SetProperties).
260 // When the properties are received, NetworkPropertiesUpdated will be 275 // When the properties are received, NetworkPropertiesUpdated will be
261 // signaled for each member of |observers_|, regardless of whether any 276 // signaled for each member of |observers_|, regardless of whether any
262 // properties actually changed. 277 // properties actually changed. Note that this is a no-op for tether networks.
278 // TODO(khorimoto): Add network update functionality for tether networks.
Ryan Hansberry 2017/04/20 01:38:35 Why will we need this for Tether?
Kyle Horimoto 2017/04/20 02:16:08 We don't actually - you're right.
263 void RequestUpdateForNetwork(const std::string& service_path); 279 void RequestUpdateForNetwork(const std::string& service_path);
264 280
265 // Informs NetworkStateHandler to notify observers that the properties for 281 // Informs NetworkStateHandler to notify observers that the properties for
266 // the network may have changed. Called e.g. when the proxy properties may 282 // the network may have changed. Called e.g. when the proxy properties may
267 // have changed. 283 // have changed.
268 void SendUpdateNotificationForNetwork(const std::string& service_path); 284 void SendUpdateNotificationForNetwork(const std::string& service_path);
269 285
270 // Clears the last_error value for the NetworkState for |service_path|. 286 // Clears the last_error value for the NetworkState for |service_path|.
271 void ClearLastErrorForNetwork(const std::string& service_path); 287 void ClearLastErrorForNetwork(const std::string& service_path);
272 288
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 // Keeps track of the default network for notifying observers when it changes. 491 // Keeps track of the default network for notifying observers when it changes.
476 std::string default_network_path_; 492 std::string default_network_path_;
477 493
478 // List of interfaces on which portal check is enabled. 494 // List of interfaces on which portal check is enabled.
479 std::string check_portal_list_; 495 std::string check_portal_list_;
480 496
481 // Map of network specifiers to guids. Contains an entry for each 497 // Map of network specifiers to guids. Contains an entry for each
482 // NetworkState that is not saved in a profile. 498 // NetworkState that is not saved in a profile.
483 SpecifierGuidMap specifier_guid_map_; 499 SpecifierGuidMap specifier_guid_map_;
484 500
501 // The state corresponding to the tether device type. Initialized to
502 // PROHIBITED; this value is changed by the tether component when it starts
503 // up.
504 TechnologyState tether_state_ = TechnologyState::TECHNOLOGY_PROHIBITED;
Ryan Hansberry 2017/04/20 01:38:35 nit: tether_technology_state_
Ryan Hansberry 2017/04/20 01:38:35 I think a better default may be unavailable.
Kyle Horimoto 2017/04/20 02:16:08 Done.
Kyle Horimoto 2017/04/20 02:16:08 No, PROHIBITED makes more sense. This should only
505
485 // Ensure that Shutdown() gets called exactly once. 506 // Ensure that Shutdown() gets called exactly once.
486 bool did_shutdown_ = false; 507 bool did_shutdown_ = false;
487 508
488 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); 509 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler);
489 }; 510 };
490 511
491 } // namespace chromeos 512 } // namespace chromeos
492 513
493 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ 514 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698