OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/chromeos/cros/network_library.h" | 5 #include "chrome/browser/chromeos/cros/network_library.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 423 |
424 // Helper class to cache maps of strings to enums. | 424 // Helper class to cache maps of strings to enums. |
425 template <typename Type> | 425 template <typename Type> |
426 class StringToEnum { | 426 class StringToEnum { |
427 public: | 427 public: |
428 struct Pair { | 428 struct Pair { |
429 const char* key; | 429 const char* key; |
430 const Type value; | 430 const Type value; |
431 }; | 431 }; |
432 | 432 |
433 explicit StringToEnum(const Pair* list, size_t num_entries, Type unknown) | 433 StringToEnum(const Pair* list, size_t num_entries, Type unknown) |
434 : unknown_value_(unknown) { | 434 : unknown_value_(unknown) { |
435 for (size_t i = 0; i < num_entries; ++i, ++list) | 435 for (size_t i = 0; i < num_entries; ++i, ++list) |
436 enum_map_[list->key] = list->value; | 436 enum_map_[list->key] = list->value; |
437 } | 437 } |
438 | 438 |
439 Type Get(const std::string& type) const { | 439 Type Get(const std::string& type) const { |
440 EnumMapConstIter iter = enum_map_.find(type); | 440 EnumMapConstIter iter = enum_map_.find(type); |
441 if (iter != enum_map_.end()) | 441 if (iter != enum_map_.end()) |
442 return iter->second; | 442 return iter->second; |
443 return unknown_value_; | 443 return unknown_value_; |
(...skipping 2244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2688 typedef ObserverList<NetworkDeviceObserver> NetworkDeviceObserverList; | 2688 typedef ObserverList<NetworkDeviceObserver> NetworkDeviceObserverList; |
2689 typedef std::map<std::string, NetworkDeviceObserverList*> | 2689 typedef std::map<std::string, NetworkDeviceObserverList*> |
2690 NetworkDeviceObserverMap; | 2690 NetworkDeviceObserverMap; |
2691 | 2691 |
2692 typedef std::map<std::string, Network*> NetworkMap; | 2692 typedef std::map<std::string, Network*> NetworkMap; |
2693 typedef std::map<std::string, int> PriorityMap; | 2693 typedef std::map<std::string, int> PriorityMap; |
2694 typedef std::map<std::string, NetworkDevice*> NetworkDeviceMap; | 2694 typedef std::map<std::string, NetworkDevice*> NetworkDeviceMap; |
2695 typedef std::map<std::string, CellularDataPlanVector*> CellularDataPlanMap; | 2695 typedef std::map<std::string, CellularDataPlanVector*> CellularDataPlanMap; |
2696 | 2696 |
2697 struct NetworkProfile { | 2697 struct NetworkProfile { |
2698 explicit NetworkProfile(const std::string& p, NetworkProfileType t) | 2698 NetworkProfile(const std::string& p, NetworkProfileType t) |
2699 : path(p), type(t) {} | 2699 : path(p), type(t) {} |
2700 std::string path; | 2700 std::string path; |
2701 NetworkProfileType type; | 2701 NetworkProfileType type; |
2702 typedef std::set<std::string> ServiceList; | 2702 typedef std::set<std::string> ServiceList; |
2703 ServiceList services; | 2703 ServiceList services; |
2704 }; | 2704 }; |
2705 typedef std::list<NetworkProfile> NetworkProfileList; | 2705 typedef std::list<NetworkProfile> NetworkProfileList; |
2706 | 2706 |
2707 struct ConnectData { | 2707 struct ConnectData { |
2708 ConnectionSecurity security; | 2708 ConnectionSecurity security; |
(...skipping 3082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5791 return network_library; | 5791 return network_library; |
5792 } | 5792 } |
5793 | 5793 |
5794 ///////////////////////////////////////////////////////////////////////////// | 5794 ///////////////////////////////////////////////////////////////////////////// |
5795 | 5795 |
5796 } // namespace chromeos | 5796 } // namespace chromeos |
5797 | 5797 |
5798 // Allows InvokeLater without adding refcounting. This class is a Singleton and | 5798 // Allows InvokeLater without adding refcounting. This class is a Singleton and |
5799 // won't be deleted until it's last InvokeLater is run. | 5799 // won't be deleted until it's last InvokeLater is run. |
5800 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); | 5800 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::NetworkLibraryImplBase); |
OLD | NEW |