| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | |
| 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 | |
| 126 // Asynchronously sets the list of prohibited technologies. The accepted | 115 // Asynchronously sets the list of prohibited technologies. The accepted |
| 127 // values are the shill network technology identifiers. See also | 116 // values are the shill network technology identifiers. See also |
| 128 // chromeos::onc::Validator::ValidateGlobalNetworkConfiguration(). | 117 // chromeos::onc::Validator::ValidateGlobalNetworkConfiguration(). |
| 129 void SetProhibitedTechnologies( | 118 void SetProhibitedTechnologies( |
| 130 const std::vector<std::string>& prohibited_technologies, | 119 const std::vector<std::string>& prohibited_technologies, |
| 131 const network_handler::ErrorCallback& error_callback); | 120 const network_handler::ErrorCallback& error_callback); |
| 132 | 121 |
| 133 // Finds and returns a device state by |device_path| or NULL if not found. | 122 // Finds and returns a device state by |device_path| or NULL if not found. |
| 134 const DeviceState* GetDeviceState(const std::string& device_path) const; | 123 const DeviceState* GetDeviceState(const std::string& device_path) const; |
| 135 | 124 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 // a copy of DeviceState pointers which should not be stored or used beyond | 243 // a copy of DeviceState pointers which should not be stored or used beyond |
| 255 // the scope of the calling function (i.e. they may later become invalid, but | 244 // the scope of the calling function (i.e. they may later become invalid, but |
| 256 // only on the UI thread). | 245 // only on the UI thread). |
| 257 void GetDeviceList(DeviceStateList* list) const; | 246 void GetDeviceList(DeviceStateList* list) const; |
| 258 | 247 |
| 259 // Like GetDeviceList() but only returns networks with matching |type|. | 248 // Like GetDeviceList() but only returns networks with matching |type|. |
| 260 void GetDeviceListByType(const NetworkTypePattern& type, | 249 void GetDeviceListByType(const NetworkTypePattern& type, |
| 261 DeviceStateList* list) const; | 250 DeviceStateList* list) const; |
| 262 | 251 |
| 263 // Requests a network scan. This may trigger updates to the network | 252 // Requests a network scan. This may trigger updates to the network |
| 264 // list, which will trigger the appropriate observer calls. Note that this | 253 // list, which will trigger the appropriate observer calls. |
| 265 // function does not request a tether scan. | |
| 266 // TODO(khorimoto): Add ability to request a tether scan as well. | |
| 267 void RequestScan() const; | 254 void RequestScan() const; |
| 268 | 255 |
| 269 // Requests an update for an existing NetworkState, e.g. after configuring | 256 // Requests an update for an existing NetworkState, e.g. after configuring |
| 270 // a network. This is a no-op if an update request is already pending. To | 257 // a network. This is a no-op if an update request is already pending. To |
| 271 // ensure that a change is picked up, this must be called after Shill | 258 // ensure that a change is picked up, this must be called after Shill |
| 272 // acknowledged it (e.g. in the callback of a SetProperties). | 259 // acknowledged it (e.g. in the callback of a SetProperties). |
| 273 // When the properties are received, NetworkPropertiesUpdated will be | 260 // When the properties are received, NetworkPropertiesUpdated will be |
| 274 // signaled for each member of |observers_|, regardless of whether any | 261 // signaled for each member of |observers_|, regardless of whether any |
| 275 // properties actually changed. Note that this is a no-op for Tether networks. | 262 // properties actually changed. |
| 276 void RequestUpdateForNetwork(const std::string& service_path); | 263 void RequestUpdateForNetwork(const std::string& service_path); |
| 277 | 264 |
| 278 // Informs NetworkStateHandler to notify observers that the properties for | 265 // Informs NetworkStateHandler to notify observers that the properties for |
| 279 // the network may have changed. Called e.g. when the proxy properties may | 266 // the network may have changed. Called e.g. when the proxy properties may |
| 280 // have changed. | 267 // have changed. |
| 281 void SendUpdateNotificationForNetwork(const std::string& service_path); | 268 void SendUpdateNotificationForNetwork(const std::string& service_path); |
| 282 | 269 |
| 283 // Clears the last_error value for the NetworkState for |service_path|. | 270 // Clears the last_error value for the NetworkState for |service_path|. |
| 284 void ClearLastErrorForNetwork(const std::string& service_path); | 271 void ClearLastErrorForNetwork(const std::string& service_path); |
| 285 | 272 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 // invalid, but only on the UI thread). | 445 // invalid, but only on the UI thread). |
| 459 // NOTE: See AddTetherNetworkState for more information about Tether networks. | 446 // NOTE: See AddTetherNetworkState for more information about Tether networks. |
| 460 void GetTetherNetworkList(int limit, NetworkStateList* list); | 447 void GetTetherNetworkList(int limit, NetworkStateList* list); |
| 461 | 448 |
| 462 // Set the connection_state of a Tether NetworkState corresponding to the | 449 // Set the connection_state of a Tether NetworkState corresponding to the |
| 463 // provided |guid|. | 450 // provided |guid|. |
| 464 void SetTetherNetworkStateConnectionState( | 451 void SetTetherNetworkStateConnectionState( |
| 465 const std::string& guid, | 452 const std::string& guid, |
| 466 const std::string& connection_state); | 453 const std::string& connection_state); |
| 467 | 454 |
| 468 // Ensures that the Tether DeviceState is present in |device_list_| if | |
| 469 // |tether_technology_state_| is not TECHNOLOGY_UNAVAILABLE and ensures that | |
| 470 // it is not present in |device_list_| if it is TECHNOLOGY_UNAVAILABLE. | |
| 471 void EnsureTetherDeviceState(); | |
| 472 | |
| 473 // Shill property handler instance, owned by this class. | 455 // Shill property handler instance, owned by this class. |
| 474 std::unique_ptr<internal::ShillPropertyHandler> shill_property_handler_; | 456 std::unique_ptr<internal::ShillPropertyHandler> shill_property_handler_; |
| 475 | 457 |
| 476 // Observer list | 458 // Observer list |
| 477 base::ObserverList<NetworkStateHandlerObserver, true> observers_; | 459 base::ObserverList<NetworkStateHandlerObserver, true> observers_; |
| 478 | 460 |
| 479 // List of managed network states | 461 // List of managed network states |
| 480 ManagedStateList network_list_; | 462 ManagedStateList network_list_; |
| 481 | 463 |
| 482 // List of managed Tether network states, which exist separately from | 464 // List of managed Tether network states, which exist separately from |
| (...skipping 10 matching lines...) Expand all Loading... |
| 493 // Keeps track of the default network for notifying observers when it changes. | 475 // Keeps track of the default network for notifying observers when it changes. |
| 494 std::string default_network_path_; | 476 std::string default_network_path_; |
| 495 | 477 |
| 496 // List of interfaces on which portal check is enabled. | 478 // List of interfaces on which portal check is enabled. |
| 497 std::string check_portal_list_; | 479 std::string check_portal_list_; |
| 498 | 480 |
| 499 // Map of network specifiers to guids. Contains an entry for each | 481 // Map of network specifiers to guids. Contains an entry for each |
| 500 // NetworkState that is not saved in a profile. | 482 // NetworkState that is not saved in a profile. |
| 501 SpecifierGuidMap specifier_guid_map_; | 483 SpecifierGuidMap specifier_guid_map_; |
| 502 | 484 |
| 503 // The state corresponding to the tether device type. This value is managed by | |
| 504 // the tether component. | |
| 505 TechnologyState tether_technology_state_ = | |
| 506 TechnologyState::TECHNOLOGY_UNAVAILABLE; | |
| 507 | |
| 508 // Ensure that Shutdown() gets called exactly once. | 485 // Ensure that Shutdown() gets called exactly once. |
| 509 bool did_shutdown_ = false; | 486 bool did_shutdown_ = false; |
| 510 | 487 |
| 511 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); | 488 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); |
| 512 }; | 489 }; |
| 513 | 490 |
| 514 } // namespace chromeos | 491 } // namespace chromeos |
| 515 | 492 |
| 516 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ | 493 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ |
| OLD | NEW |