| 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_SHILL_PROPERTY_HANDLER_H_ | 5 #ifndef CHROMEOS_NETWORK_SHILL_PROPERTY_HANDLER_H_ |
| 6 #define CHROMEOS_NETWORK_SHILL_PROPERTY_HANDLER_H_ | 6 #define CHROMEOS_NETWORK_SHILL_PROPERTY_HANDLER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // This class must not outlive the ShillManagerClient instance. | 39 // This class must not outlive the ShillManagerClient instance. |
| 40 class CHROMEOS_EXPORT ShillPropertyHandler | 40 class CHROMEOS_EXPORT ShillPropertyHandler |
| 41 : public ShillPropertyChangedObserver, | 41 : public ShillPropertyChangedObserver, |
| 42 public base::SupportsWeakPtr<ShillPropertyHandler> { | 42 public base::SupportsWeakPtr<ShillPropertyHandler> { |
| 43 public: | 43 public: |
| 44 typedef std::map<std::string, ShillPropertyObserver*> | 44 typedef std::map<std::string, ShillPropertyObserver*> |
| 45 ShillPropertyObserverMap; | 45 ShillPropertyObserverMap; |
| 46 | 46 |
| 47 class CHROMEOS_EXPORT Listener { | 47 class CHROMEOS_EXPORT Listener { |
| 48 public: | 48 public: |
| 49 // Called when the entries in a managed list have changed. | 49 // Called when the entries in the device list have changed. |
| 50 virtual void UpdateManagedList(ManagedState::ManagedType type, | 50 virtual void UpdateManagedDevices(const base::ListValue& entries) = 0; |
| 51 const base::ListValue& entries) = 0; | 51 |
| 52 // Called when the entries in the service list have changed. If |
| 53 // |complete_list| is true then |entries| represent the complete list of |
| 54 // network services, otherwise it includes just the visible services. |
| 55 virtual void UpdateManagedNetworks(const base::ListValue& entries, |
| 56 bool complete_list) = 0; |
| 52 | 57 |
| 53 // Called when the properties for a managed state have changed. | 58 // Called when the properties for a managed state have changed. |
| 54 virtual void UpdateManagedStateProperties( | 59 virtual void UpdateManagedStateProperties( |
| 55 ManagedState::ManagedType type, | 60 ManagedState::ManagedType type, |
| 56 const std::string& path, | 61 const std::string& path, |
| 57 const base::DictionaryValue& properties) = 0; | 62 const base::DictionaryValue& properties) = 0; |
| 58 | 63 |
| 59 // Called when the list of profiles changes. | 64 // Called when the list of profiles changes. |
| 60 virtual void ProfileListChanged() = 0; | 65 virtual void ProfileListChanged() = 0; |
| 61 | 66 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 154 |
| 150 // Notifies the listener when a ManagedStateList has changed and all pending | 155 // Notifies the listener when a ManagedStateList has changed and all pending |
| 151 // updates have been received. |key| can either identify the list that | 156 // updates have been received. |key| can either identify the list that |
| 152 // has changed or an empty string if multiple lists may have changed. | 157 // has changed or an empty string if multiple lists may have changed. |
| 153 void CheckPendingStateListUpdates(const std::string& key); | 158 void CheckPendingStateListUpdates(const std::string& key); |
| 154 | 159 |
| 155 // Called form OnPropertyChanged() and ManagerPropertiesCallback(). | 160 // Called form OnPropertyChanged() and ManagerPropertiesCallback(). |
| 156 void ManagerPropertyChanged(const std::string& key, | 161 void ManagerPropertyChanged(const std::string& key, |
| 157 const base::Value& value); | 162 const base::Value& value); |
| 158 | 163 |
| 159 // Requests properties for new entries in the list for |type| as follows: | 164 // Requests properties for new entries in the list for |type|. |
| 160 // * Any new Device objects for MANAGED_TYPE_DEVICE | |
| 161 // * Any new Service objects for MANAGED_TYPE_NETWORK | |
| 162 // * Additional new Service objects for MANAGED_TYPE_FAVORITE that were not | |
| 163 // requested for MANAGED_TYPE_NETWORK (i.e. only request objects once). | |
| 164 // For this to avoid duplicate requests, this must be called with | |
| 165 // MANAGED_TYPE_NETWORK before MANAGED_TYPE_FAVORITE. | |
| 166 void UpdateProperties(ManagedState::ManagedType type, | 165 void UpdateProperties(ManagedState::ManagedType type, |
| 167 const base::ListValue& entries); | 166 const base::ListValue& entries); |
| 168 | 167 |
| 169 // Updates the Shill property observers to observe any entries for |type|. | 168 // Updates the Shill property observers to observe any entries for |type|. |
| 170 void UpdateObserved(ManagedState::ManagedType type, | 169 void UpdateObserved(ManagedState::ManagedType type, |
| 171 const base::ListValue& entries); | 170 const base::ListValue& entries); |
| 172 | 171 |
| 173 | 172 |
| 174 // Sets |*_technologies_| to contain only entries in |technologies|. | 173 // Sets |*_technologies_| to contain only entries in |technologies|. |
| 175 void UpdateAvailableTechnologies(const base::ListValue& technologies); | 174 void UpdateAvailableTechnologies(const base::ListValue& technologies); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 226 |
| 228 // Pending update list for each managed state type | 227 // Pending update list for each managed state type |
| 229 TypeRequestMap pending_updates_; | 228 TypeRequestMap pending_updates_; |
| 230 | 229 |
| 231 // List of states for which properties have been requested, for each managed | 230 // List of states for which properties have been requested, for each managed |
| 232 // state type | 231 // state type |
| 233 TypeRequestMap requested_updates_; | 232 TypeRequestMap requested_updates_; |
| 234 | 233 |
| 235 // List of network services with Shill property changed observers | 234 // List of network services with Shill property changed observers |
| 236 ShillPropertyObserverMap observed_networks_; | 235 ShillPropertyObserverMap observed_networks_; |
| 236 size_t new_observed_networks_; |
| 237 | 237 |
| 238 // List of network devices with Shill property changed observers | 238 // List of network devices with Shill property changed observers |
| 239 ShillPropertyObserverMap observed_devices_; | 239 ShillPropertyObserverMap observed_devices_; |
| 240 | 240 |
| 241 // Lists of available / enabled / uninitialized technologies | 241 // Lists of available / enabled / uninitialized technologies |
| 242 std::set<std::string> available_technologies_; | 242 std::set<std::string> available_technologies_; |
| 243 std::set<std::string> enabled_technologies_; | 243 std::set<std::string> enabled_technologies_; |
| 244 std::set<std::string> enabling_technologies_; | 244 std::set<std::string> enabling_technologies_; |
| 245 std::set<std::string> uninitialized_technologies_; | 245 std::set<std::string> uninitialized_technologies_; |
| 246 | 246 |
| 247 DISALLOW_COPY_AND_ASSIGN(ShillPropertyHandler); | 247 DISALLOW_COPY_AND_ASSIGN(ShillPropertyHandler); |
| 248 }; | 248 }; |
| 249 | 249 |
| 250 } // namespace internal | 250 } // namespace internal |
| 251 } // namespace chromeos | 251 } // namespace chromeos |
| 252 | 252 |
| 253 #endif // CHROMEOS_NETWORK_SHILL_PROPERTY_HANDLER_H_ | 253 #endif // CHROMEOS_NETWORK_SHILL_PROPERTY_HANDLER_H_ |
| OLD | NEW |