| 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 <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 bool RequestUpdateForNetwork(const std::string& service_path); | 155 bool RequestUpdateForNetwork(const std::string& service_path); |
| 156 | 156 |
| 157 // Request an update for all existing NetworkState entries, e.g. after | 157 // Request an update for all existing NetworkState entries, e.g. after |
| 158 // loading an ONC configuration file that may have updated one or more | 158 // loading an ONC configuration file that may have updated one or more |
| 159 // existing networks. | 159 // existing networks. |
| 160 void RequestUpdateForAllNetworks(); | 160 void RequestUpdateForAllNetworks(); |
| 161 | 161 |
| 162 // Set the user initiated connecting network. | 162 // Set the user initiated connecting network. |
| 163 void SetConnectingNetwork(const std::string& service_path); | 163 void SetConnectingNetwork(const std::string& service_path); |
| 164 | 164 |
| 165 // Set the list of devices on which portal check is enabled. |
| 166 void SetCheckPortalList(const std::string& check_portal_list); |
| 167 |
| 165 const std::string& connecting_network() const { return connecting_network_; } | 168 const std::string& connecting_network() const { return connecting_network_; } |
| 169 const std::string& check_portal_list() const { return check_portal_list_; } |
| 166 | 170 |
| 167 // Generates a DictionaryValue of all NetworkState properties. Currently | 171 // Generates a DictionaryValue of all NetworkState properties. Currently |
| 168 // provided for debugging purposes only. | 172 // provided for debugging purposes only. |
| 169 void GetNetworkStatePropertiesForTest( | 173 void GetNetworkStatePropertiesForTest( |
| 170 base::DictionaryValue* dictionary) const; | 174 base::DictionaryValue* dictionary) const; |
| 171 | 175 |
| 172 // Construct and initialize an instance for testing. | 176 // Construct and initialize an instance for testing. |
| 173 static NetworkStateHandler* InitializeForTest(); | 177 static NetworkStateHandler* InitializeForTest(); |
| 174 | 178 |
| 175 static const char kMatchTypeDefault[]; | 179 static const char kMatchTypeDefault[]; |
| 176 static const char kMatchTypeWireless[]; | 180 static const char kMatchTypeWireless[]; |
| 177 static const char kMatchTypeMobile[]; | 181 static const char kMatchTypeMobile[]; |
| 178 static const char kMatchTypeNonVirtual[]; | 182 static const char kMatchTypeNonVirtual[]; |
| 179 | 183 |
| 184 // Default set of comma separated interfaces on which to enable |
| 185 // portal checking. |
| 186 static const char kDefaultCheckPortalList[]; |
| 187 |
| 180 protected: | 188 protected: |
| 181 friend class NetworkHandler; | 189 friend class NetworkHandler; |
| 182 NetworkStateHandler(); | 190 NetworkStateHandler(); |
| 183 | 191 |
| 184 // ShillPropertyHandler::Listener overrides. | 192 // ShillPropertyHandler::Listener overrides. |
| 185 | 193 |
| 186 // This adds new entries to the managed list specified by |type| and deletes | 194 // This adds new entries to the managed list specified by |type| and deletes |
| 187 // any entries that are no longer in the list. | 195 // any entries that are no longer in the list. |
| 188 virtual void UpdateManagedList(ManagedState::ManagedType type, | 196 virtual void UpdateManagedList(ManagedState::ManagedType type, |
| 189 const base::ListValue& entries) OVERRIDE; | 197 const base::ListValue& entries) OVERRIDE; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 204 const std::string& service_path, | 212 const std::string& service_path, |
| 205 const std::string& key, | 213 const std::string& key, |
| 206 const base::Value& value) OVERRIDE; | 214 const base::Value& value) OVERRIDE; |
| 207 | 215 |
| 208 // Called by ShillPropertyHandler when a watched device property changes. | 216 // Called by ShillPropertyHandler when a watched device property changes. |
| 209 virtual void UpdateDeviceProperty( | 217 virtual void UpdateDeviceProperty( |
| 210 const std::string& device_path, | 218 const std::string& device_path, |
| 211 const std::string& key, | 219 const std::string& key, |
| 212 const base::Value& value) OVERRIDE; | 220 const base::Value& value) OVERRIDE; |
| 213 | 221 |
| 222 // Called by ShillPropertyHandler when the portal check list manager property |
| 223 // changes. |
| 224 virtual void CheckPortalListChanged( |
| 225 const std::string& check_portal_list) OVERRIDE; |
| 226 |
| 214 // Sends NetworkManagerChanged() to observers and logs an event. | 227 // Sends NetworkManagerChanged() to observers and logs an event. |
| 215 virtual void NotifyManagerPropertyChanged() OVERRIDE; | 228 virtual void NotifyManagerPropertyChanged() OVERRIDE; |
| 216 | 229 |
| 217 // Called by |shill_property_handler_| when the service or device list has | 230 // Called by |shill_property_handler_| when the service or device list has |
| 218 // changed and all entries have been updated. This updates the list and | 231 // changed and all entries have been updated. This updates the list and |
| 219 // notifies observers. If |type| == TYPE_NETWORK this also calls | 232 // notifies observers. If |type| == TYPE_NETWORK this also calls |
| 220 // CheckDefaultNetworkChanged(). | 233 // CheckDefaultNetworkChanged(). |
| 221 virtual void ManagedStateListChanged( | 234 virtual void ManagedStateListChanged( |
| 222 ManagedState::ManagedType type) OVERRIDE; | 235 ManagedState::ManagedType type) OVERRIDE; |
| 223 | 236 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 287 |
| 275 // Keeps track of the default network for notifying observers when it changes. | 288 // Keeps track of the default network for notifying observers when it changes. |
| 276 std::string default_network_path_; | 289 std::string default_network_path_; |
| 277 | 290 |
| 278 // Convenience member to track the user initiated connecting network. Set | 291 // Convenience member to track the user initiated connecting network. Set |
| 279 // externally when a connection is requested and cleared here when the state | 292 // externally when a connection is requested and cleared here when the state |
| 280 // changes to something other than Connecting (after observers are notified). | 293 // changes to something other than Connecting (after observers are notified). |
| 281 // TODO(stevenjb): Move this to NetworkConfigurationHandler. | 294 // TODO(stevenjb): Move this to NetworkConfigurationHandler. |
| 282 std::string connecting_network_; | 295 std::string connecting_network_; |
| 283 | 296 |
| 297 // List of interfaces on which portal check is enabled. |
| 298 std::string check_portal_list_; |
| 299 |
| 284 // Callbacks to run when a scan for the technology type completes. | 300 // Callbacks to run when a scan for the technology type completes. |
| 285 ScanCompleteCallbackMap scan_complete_callbacks_; | 301 ScanCompleteCallbackMap scan_complete_callbacks_; |
| 286 | 302 |
| 287 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); | 303 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); |
| 288 }; | 304 }; |
| 289 | 305 |
| 290 } // namespace chromeos | 306 } // namespace chromeos |
| 291 | 307 |
| 292 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ | 308 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ |
| OLD | NEW |