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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 TECHNOLOGY_UNAVAILABLE, | 74 TECHNOLOGY_UNAVAILABLE, |
75 TECHNOLOGY_AVAILABLE, | 75 TECHNOLOGY_AVAILABLE, |
76 TECHNOLOGY_UNINITIALIZED, | 76 TECHNOLOGY_UNINITIALIZED, |
77 TECHNOLOGY_ENABLING, | 77 TECHNOLOGY_ENABLING, |
78 TECHNOLOGY_ENABLED, | 78 TECHNOLOGY_ENABLED, |
79 TECHNOLOGY_PROHIBITED | 79 TECHNOLOGY_PROHIBITED |
80 }; | 80 }; |
81 | 81 |
82 ~NetworkStateHandler() override; | 82 ~NetworkStateHandler() override; |
83 | 83 |
| 84 // Called just before destruction to give observers a chance to remove |
| 85 // themselves and disable any networking. |
| 86 void Shutdown(); |
| 87 |
84 // Add/remove observers. | 88 // Add/remove observers. |
85 void AddObserver(NetworkStateHandlerObserver* observer, | 89 void AddObserver(NetworkStateHandlerObserver* observer, |
86 const tracked_objects::Location& from_here); | 90 const tracked_objects::Location& from_here); |
87 void RemoveObserver(NetworkStateHandlerObserver* observer, | 91 void RemoveObserver(NetworkStateHandlerObserver* observer, |
88 const tracked_objects::Location& from_here); | 92 const tracked_objects::Location& from_here); |
89 | 93 |
90 // Returns the state for technology |type|. Only | 94 // Returns the state for technology |type|. Only |
91 // NetworkTypePattern::Primitive, ::Mobile and ::Ethernet are supported. | 95 // NetworkTypePattern::Primitive, ::Mobile and ::Ethernet are supported. |
92 TechnologyState GetTechnologyState(const NetworkTypePattern& type) const; | 96 TechnologyState GetTechnologyState(const NetworkTypePattern& type) const; |
93 bool IsTechnologyAvailable(const NetworkTypePattern& type) const { | 97 bool IsTechnologyAvailable(const NetworkTypePattern& type) const { |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 std::string GetTechnologyForType(const NetworkTypePattern& type) const; | 371 std::string GetTechnologyForType(const NetworkTypePattern& type) const; |
368 | 372 |
369 // Returns all the technology types for |type|. | 373 // Returns all the technology types for |type|. |
370 ScopedVector<std::string> GetTechnologiesForType( | 374 ScopedVector<std::string> GetTechnologiesForType( |
371 const NetworkTypePattern& type) const; | 375 const NetworkTypePattern& type) const; |
372 | 376 |
373 // Shill property handler instance, owned by this class. | 377 // Shill property handler instance, owned by this class. |
374 scoped_ptr<internal::ShillPropertyHandler> shill_property_handler_; | 378 scoped_ptr<internal::ShillPropertyHandler> shill_property_handler_; |
375 | 379 |
376 // Observer list | 380 // Observer list |
377 base::ObserverList<NetworkStateHandlerObserver> observers_; | 381 base::ObserverList<NetworkStateHandlerObserver, true> observers_; |
378 | 382 |
379 // List of managed network states | 383 // List of managed network states |
380 ManagedStateList network_list_; | 384 ManagedStateList network_list_; |
381 | 385 |
382 // Set to true when the network list is sorted, cleared when network updates | 386 // Set to true when the network list is sorted, cleared when network updates |
383 // arrive. Used to trigger sorting when needed. | 387 // arrive. Used to trigger sorting when needed. |
384 bool network_list_sorted_; | 388 bool network_list_sorted_ = false; |
385 | 389 |
386 // List of managed device states | 390 // List of managed device states |
387 ManagedStateList device_list_; | 391 ManagedStateList device_list_; |
388 | 392 |
389 // Keeps track of the default network for notifying observers when it changes. | 393 // Keeps track of the default network for notifying observers when it changes. |
390 std::string default_network_path_; | 394 std::string default_network_path_; |
391 | 395 |
392 // List of interfaces on which portal check is enabled. | 396 // List of interfaces on which portal check is enabled. |
393 std::string check_portal_list_; | 397 std::string check_portal_list_; |
394 | 398 |
395 // Map of network specifiers to guids. Contains an entry for each | 399 // Map of network specifiers to guids. Contains an entry for each |
396 // NetworkState that is not saved in a profile. | 400 // NetworkState that is not saved in a profile. |
397 SpecifierGuidMap specifier_guid_map_; | 401 SpecifierGuidMap specifier_guid_map_; |
398 | 402 |
| 403 // Ensure that Shutdown() gets called exactly once. |
| 404 bool did_shutdown_ = false; |
| 405 |
399 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); | 406 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); |
400 }; | 407 }; |
401 | 408 |
402 } // namespace chromeos | 409 } // namespace chromeos |
403 | 410 |
404 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ | 411 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ |
OLD | NEW |