| 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 |
| 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 Loading... |
| 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 ability to request a tether scan as well. |
| 254 void RequestScan() const; | 267 void RequestScan() const; |
| 255 | 268 |
| 256 // Requests an update for an existing NetworkState, e.g. after configuring | 269 // 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 | 270 // 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 | 271 // ensure that a change is picked up, this must be called after Shill |
| 259 // acknowledged it (e.g. in the callback of a SetProperties). | 272 // acknowledged it (e.g. in the callback of a SetProperties). |
| 260 // When the properties are received, NetworkPropertiesUpdated will be | 273 // When the properties are received, NetworkPropertiesUpdated will be |
| 261 // signaled for each member of |observers_|, regardless of whether any | 274 // signaled for each member of |observers_|, regardless of whether any |
| 262 // properties actually changed. | 275 // properties actually changed. Note that this is a no-op for Tether networks. |
| 263 void RequestUpdateForNetwork(const std::string& service_path); | 276 void RequestUpdateForNetwork(const std::string& service_path); |
| 264 | 277 |
| 265 // Informs NetworkStateHandler to notify observers that the properties for | 278 // Informs NetworkStateHandler to notify observers that the properties for |
| 266 // the network may have changed. Called e.g. when the proxy properties may | 279 // the network may have changed. Called e.g. when the proxy properties may |
| 267 // have changed. | 280 // have changed. |
| 268 void SendUpdateNotificationForNetwork(const std::string& service_path); | 281 void SendUpdateNotificationForNetwork(const std::string& service_path); |
| 269 | 282 |
| 270 // Clears the last_error value for the NetworkState for |service_path|. | 283 // Clears the last_error value for the NetworkState for |service_path|. |
| 271 void ClearLastErrorForNetwork(const std::string& service_path); | 284 void ClearLastErrorForNetwork(const std::string& service_path); |
| 272 | 285 |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 // invalid, but only on the UI thread). | 458 // invalid, but only on the UI thread). |
| 446 // NOTE: See AddTetherNetworkState for more information about Tether networks. | 459 // NOTE: See AddTetherNetworkState for more information about Tether networks. |
| 447 void GetTetherNetworkList(int limit, NetworkStateList* list); | 460 void GetTetherNetworkList(int limit, NetworkStateList* list); |
| 448 | 461 |
| 449 // Set the connection_state of a Tether NetworkState corresponding to the | 462 // Set the connection_state of a Tether NetworkState corresponding to the |
| 450 // provided |guid|. | 463 // provided |guid|. |
| 451 void SetTetherNetworkStateConnectionState( | 464 void SetTetherNetworkStateConnectionState( |
| 452 const std::string& guid, | 465 const std::string& guid, |
| 453 const std::string& connection_state); | 466 const std::string& connection_state); |
| 454 | 467 |
| 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 |
| 455 // Shill property handler instance, owned by this class. | 473 // Shill property handler instance, owned by this class. |
| 456 std::unique_ptr<internal::ShillPropertyHandler> shill_property_handler_; | 474 std::unique_ptr<internal::ShillPropertyHandler> shill_property_handler_; |
| 457 | 475 |
| 458 // Observer list | 476 // Observer list |
| 459 base::ObserverList<NetworkStateHandlerObserver, true> observers_; | 477 base::ObserverList<NetworkStateHandlerObserver, true> observers_; |
| 460 | 478 |
| 461 // List of managed network states | 479 // List of managed network states |
| 462 ManagedStateList network_list_; | 480 ManagedStateList network_list_; |
| 463 | 481 |
| 464 // List of managed Tether network states, which exist separately from | 482 // List of managed Tether network states, which exist separately from |
| (...skipping 10 matching lines...) Expand all Loading... |
| 475 // Keeps track of the default network for notifying observers when it changes. | 493 // Keeps track of the default network for notifying observers when it changes. |
| 476 std::string default_network_path_; | 494 std::string default_network_path_; |
| 477 | 495 |
| 478 // List of interfaces on which portal check is enabled. | 496 // List of interfaces on which portal check is enabled. |
| 479 std::string check_portal_list_; | 497 std::string check_portal_list_; |
| 480 | 498 |
| 481 // Map of network specifiers to guids. Contains an entry for each | 499 // Map of network specifiers to guids. Contains an entry for each |
| 482 // NetworkState that is not saved in a profile. | 500 // NetworkState that is not saved in a profile. |
| 483 SpecifierGuidMap specifier_guid_map_; | 501 SpecifierGuidMap specifier_guid_map_; |
| 484 | 502 |
| 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 |
| 485 // Ensure that Shutdown() gets called exactly once. | 508 // Ensure that Shutdown() gets called exactly once. |
| 486 bool did_shutdown_ = false; | 509 bool did_shutdown_ = false; |
| 487 | 510 |
| 488 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); | 511 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); |
| 489 }; | 512 }; |
| 490 | 513 |
| 491 } // namespace chromeos | 514 } // namespace chromeos |
| 492 | 515 |
| 493 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ | 516 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ |
| OLD | NEW |