Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(625)

Side by Side Diff: chromeos/network/network_state_handler.h

Issue 330833003: Rely on Service.Visible instead of Manager.Services (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sort services when updated, add test Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 friend class NetworkHandler; 237 friend class NetworkHandler;
238 NetworkStateHandler(); 238 NetworkStateHandler();
239 239
240 // ShillPropertyHandler::Listener overrides. 240 // ShillPropertyHandler::Listener overrides.
241 241
242 // This adds new entries to |network_list_| or |device_list_| and deletes any 242 // This adds new entries to |network_list_| or |device_list_| and deletes any
243 // entries that are no longer in the list. 243 // entries that are no longer in the list.
244 virtual void UpdateManagedList(ManagedState::ManagedType type, 244 virtual void UpdateManagedList(ManagedState::ManagedType type,
245 const base::ListValue& entries) OVERRIDE; 245 const base::ListValue& entries) OVERRIDE;
246 246
247 // Updates the visibility of entries in |network_list_|. This should not
248 // contain entries that are not in |network_list_|. Any such entries will be
249 // ignored with an error message.
250 virtual void UpdateVisibleNetworks(const base::ListValue& entries) OVERRIDE;
251
252 // The list of profiles changed (i.e. a user has logged in). Re-request 247 // The list of profiles changed (i.e. a user has logged in). Re-request
253 // properties for all services since they may have changed. 248 // properties for all services since they may have changed.
254 virtual void ProfileListChanged() OVERRIDE; 249 virtual void ProfileListChanged() OVERRIDE;
255 250
256 // Parses the properties for the network service or device. Mostly calls 251 // Parses the properties for the network service or device. Mostly calls
257 // managed->PropertyChanged(key, value) for each dictionary entry. 252 // managed->PropertyChanged(key, value) for each dictionary entry.
258 virtual void UpdateManagedStateProperties( 253 virtual void UpdateManagedStateProperties(
259 ManagedState::ManagedType type, 254 ManagedState::ManagedType type,
260 const std::string& path, 255 const std::string& path,
261 const base::DictionaryValue& properties) OVERRIDE; 256 const base::DictionaryValue& properties) OVERRIDE;
(...skipping 21 matching lines...) Expand all
283 // Called by ShillPropertyHandler when the portal check list manager property 278 // Called by ShillPropertyHandler when the portal check list manager property
284 // changes. 279 // changes.
285 virtual void CheckPortalListChanged( 280 virtual void CheckPortalListChanged(
286 const std::string& check_portal_list) OVERRIDE; 281 const std::string& check_portal_list) OVERRIDE;
287 282
288 // Called by ShillPropertyHandler when a technology list changes. 283 // Called by ShillPropertyHandler when a technology list changes.
289 virtual void TechnologyListChanged() OVERRIDE; 284 virtual void TechnologyListChanged() OVERRIDE;
290 285
291 // Called by |shill_property_handler_| when the service or device list has 286 // Called by |shill_property_handler_| when the service or device list has
292 // changed and all entries have been updated. This updates the list and 287 // changed and all entries have been updated. This updates the list and
293 // notifies observers. If |type| == TYPE_NETWORK this also calls 288 // notifies observers.
294 // CheckDefaultNetworkChanged().
295 virtual void ManagedStateListChanged( 289 virtual void ManagedStateListChanged(
296 ManagedState::ManagedType type) OVERRIDE; 290 ManagedState::ManagedType type) OVERRIDE;
297 291
298 // Called when the default network service changes. Sets default_network_path_ 292 // Called when the default network service changes. Sets default_network_path_
299 // and notifies listeners. 293 // and notifies listeners.
300 virtual void DefaultNetworkServiceChanged( 294 virtual void DefaultNetworkServiceChanged(
301 const std::string& service_path) OVERRIDE; 295 const std::string& service_path) OVERRIDE;
302 296
303 // Called after construction. Called explicitly by tests after adding 297 // Called after construction. Called explicitly by tests after adding
304 // test observers. 298 // test observers.
305 void InitShillPropertyHandler(); 299 void InitShillPropertyHandler();
306 300
307 private: 301 private:
308 typedef std::list<base::Closure> ScanCallbackList; 302 typedef std::list<base::Closure> ScanCallbackList;
309 typedef std::map<std::string, ScanCallbackList> ScanCompleteCallbackMap; 303 typedef std::map<std::string, ScanCallbackList> ScanCompleteCallbackMap;
310 typedef std::map<std::string, std::string> SpecifierGuidMap; 304 typedef std::map<std::string, std::string> SpecifierGuidMap;
311 friend class NetworkStateHandlerTest; 305 friend class NetworkStateHandlerTest;
312 FRIEND_TEST_ALL_PREFIXES(NetworkStateHandlerTest, NetworkStateHandlerStub); 306 FRIEND_TEST_ALL_PREFIXES(NetworkStateHandlerTest, NetworkStateHandlerStub);
313 307
308 // Sorts the network list. Called when any requested network is updated and
309 // after all network updates have been received.
310 void SortNetworkList();
311
312 // Updates UMA stats. Called once after all requested networks are updated.
313 void UpdateNetworkStats();
314
314 // NetworkState specific method for UpdateManagedStateProperties which 315 // NetworkState specific method for UpdateManagedStateProperties which
315 // notifies observers. 316 // notifies observers.
316 void UpdateNetworkStateProperties(NetworkState* network, 317 void UpdateNetworkStateProperties(NetworkState* network,
317 const base::DictionaryValue& properties); 318 const base::DictionaryValue& properties);
318 319
319 // Ensure a valid GUID for NetworkState. 320 // Ensure a valid GUID for NetworkState.
320 void UpdateGuid(NetworkState* network); 321 void UpdateGuid(NetworkState* network);
321 322
322 // Sends DeviceListChanged() to observers and logs an event. 323 // Sends DeviceListChanged() to observers and logs an event.
323 void NotifyDeviceListChanged(); 324 void NotifyDeviceListChanged();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 // Map of network specifiers to guids. Contains an entry for each 379 // Map of network specifiers to guids. Contains an entry for each
379 // NetworkState that is not saved in a profile. 380 // NetworkState that is not saved in a profile.
380 SpecifierGuidMap specifier_guid_map_; 381 SpecifierGuidMap specifier_guid_map_;
381 382
382 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler); 383 DISALLOW_COPY_AND_ASSIGN(NetworkStateHandler);
383 }; 384 };
384 385
385 } // namespace chromeos 386 } // namespace chromeos
386 387
387 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_ 388 #endif // CHROMEOS_NETWORK_NETWORK_STATE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698