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

Side by Side Diff: chrome/browser/chromeos/cros/network_library.h

Issue 2817036: Push change for stevenjb:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 5 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_
6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ 6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 EthernetNetwork() : Network() {} 70 EthernetNetwork() : Network() {}
71 }; 71 };
72 72
73 class WirelessNetwork : public Network { 73 class WirelessNetwork : public Network {
74 public: 74 public:
75 // WirelessNetwork are sorted by name. 75 // WirelessNetwork are sorted by name.
76 bool operator< (const WirelessNetwork& other) const { 76 bool operator< (const WirelessNetwork& other) const {
77 return name_ < other.name(); 77 return name_ < other.name();
78 } 78 }
79 79
80 // We frequently want to compare networks by service path.
81 struct ServicePathEq {
82 explicit ServicePathEq(const std::string& path_in) : path(path_in) {}
83 bool operator()(const WirelessNetwork& a) {
84 return a.service_path().compare(path) == 0;
85 }
86 const std::string& path;
87 };
88
80 const std::string& name() const { return name_; } 89 const std::string& name() const { return name_; }
81 int strength() const { return strength_; } 90 int strength() const { return strength_; }
82 bool auto_connect() const { return auto_connect_; } 91 bool auto_connect() const { return auto_connect_; }
83 92
84 void set_name(const std::string& name) { name_ = name; } 93 void set_name(const std::string& name) { name_ = name; }
85 void set_auto_connect(bool auto_connect) { auto_connect_ = auto_connect; } 94 void set_auto_connect(bool auto_connect) { auto_connect_ = auto_connect; }
86 95
87 // Network overrides. 96 // Network overrides.
88 virtual void Clear(); 97 virtual void Clear();
89 virtual void ConfigureFromService(const ServiceInfo& service); 98 virtual void ConfigureFromService(const ServiceInfo& service);
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 291
283 // Returns the list of remembered wifi networks. 292 // Returns the list of remembered wifi networks.
284 virtual const WifiNetworkVector& remembered_wifi_networks() const = 0; 293 virtual const WifiNetworkVector& remembered_wifi_networks() const = 0;
285 294
286 // Returns the current list of cellular networks. 295 // Returns the current list of cellular networks.
287 virtual const CellularNetworkVector& cellular_networks() const = 0; 296 virtual const CellularNetworkVector& cellular_networks() const = 0;
288 297
289 // Returns the list of remembered cellular networks. 298 // Returns the list of remembered cellular networks.
290 virtual const CellularNetworkVector& remembered_cellular_networks() const = 0; 299 virtual const CellularNetworkVector& remembered_cellular_networks() const = 0;
291 300
301 // Search the current list of networks by path and if the network
302 // is available, copy the result and return true.
303 virtual bool FindWifiNetworkByPath(const std::string& path,
304 WifiNetwork* result) const = 0;
305 virtual bool FindCellularNetworkByPath(const std::string& path,
306 CellularNetwork* result) const = 0;
307
292 // Request a scan for new wifi networks. 308 // Request a scan for new wifi networks.
293 virtual void RequestWifiScan() = 0; 309 virtual void RequestWifiScan() = 0;
294 310
295 // Attempt to connect to the preferred network if available and it is set up. 311 // Attempt to connect to the preferred network if available and it is set up.
296 // This call will return true if connection is started. 312 // This call will return true if connection is started.
297 // If the preferred network is not available or not setup, returns false. 313 // If the preferred network is not available or not setup, returns false.
298 // Note: For dogfood purposes, we hardcode the preferred network to Google-A. 314 // Note: For dogfood purposes, we hardcode the preferred network to Google-A.
299 virtual bool ConnectToPreferredNetworkIfAvailable() = 0; 315 virtual bool ConnectToPreferredNetworkIfAvailable() = 0;
300 316
301 // Returns true if we are currently connected to the preferred network. 317 // Returns true if we are currently connected to the preferred network.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 } 425 }
410 426
411 virtual const CellularNetworkVector& cellular_networks() const { 427 virtual const CellularNetworkVector& cellular_networks() const {
412 return cellular_networks_; 428 return cellular_networks_;
413 } 429 }
414 430
415 virtual const CellularNetworkVector& remembered_cellular_networks() const { 431 virtual const CellularNetworkVector& remembered_cellular_networks() const {
416 return remembered_cellular_networks_; 432 return remembered_cellular_networks_;
417 } 433 }
418 434
435 virtual bool FindWifiNetworkByPath(const std::string& path,
436 WifiNetwork* network) const;
437 virtual bool FindCellularNetworkByPath(const std::string& path,
438 CellularNetwork* network) const;
439
419 virtual void RequestWifiScan(); 440 virtual void RequestWifiScan();
420 virtual bool ConnectToPreferredNetworkIfAvailable(); 441 virtual bool ConnectToPreferredNetworkIfAvailable();
421 virtual bool PreferredNetworkConnected(); 442 virtual bool PreferredNetworkConnected();
422 virtual bool PreferredNetworkFailed(); 443 virtual bool PreferredNetworkFailed();
423 virtual void ConnectToWifiNetwork(WifiNetwork network, 444 virtual void ConnectToWifiNetwork(WifiNetwork network,
424 const string16& password, 445 const string16& password,
425 const string16& identity, 446 const string16& identity,
426 const string16& certpath); 447 const string16& certpath);
427 virtual void ConnectToWifiNetwork(const string16& ssid, 448 virtual void ConnectToWifiNetwork(const string16& ssid,
428 const string16& password, 449 const string16& password,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 // monitoring of network changes. 507 // monitoring of network changes.
487 void Init(); 508 void Init();
488 509
489 // Force an update of the system info. 510 // Force an update of the system info.
490 void UpdateSystemInfo(); 511 void UpdateSystemInfo();
491 512
492 // Returns the preferred wifi network. 513 // Returns the preferred wifi network.
493 WifiNetwork* GetPreferredNetwork(); 514 WifiNetwork* GetPreferredNetwork();
494 515
495 // Gets the WifiNetwork with the given name. Returns NULL if not found. 516 // Gets the WifiNetwork with the given name. Returns NULL if not found.
517 // Only used by GetPreferredNetwork() to lookup "Google" and "GoogleA" (hack)
496 WifiNetwork* GetWifiNetworkByName(const std::string& name); 518 WifiNetwork* GetWifiNetworkByName(const std::string& name);
497 519
498 // Gets the WifiNetwork with the given path. Returns NULL if not found. 520 // Gets the WirelessNetwork (WifiNetwork or CellularNetwork) by path
499 WifiNetwork* GetWifiNetworkByPath(const std::string& path); 521 template<typename T>
522 T* GetWirelessNetworkByPath(std::vector<T>& networks,
523 const std::string& path);
524 template<typename T>
525 const T* GetWirelessNetworkByPath(const std::vector<T>& networks,
526 const std::string& path) const;
500 527
501 // Enables/disables the specified network device. 528 // Enables/disables the specified network device.
502 void EnableNetworkDeviceType(ConnectionType device, bool enable); 529 void EnableNetworkDeviceType(ConnectionType device, bool enable);
503 530
504 // Update the network with the SystemInfo object. 531 // Update the network with the SystemInfo object.
505 // This will notify all the Observers. 532 // This will notify all the Observers.
506 void UpdateNetworkStatus(SystemInfo* system); 533 void UpdateNetworkStatus(SystemInfo* system);
507 534
508 // Checks network traffic to see if there is any uploading. 535 // Checks network traffic to see if there is any uploading.
509 // If there is download traffic, then true is passed in for download. 536 // If there is download traffic, then true is passed in for download.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 int connected_devices_; 595 int connected_devices_;
569 596
570 bool offline_mode_; 597 bool offline_mode_;
571 598
572 DISALLOW_COPY_AND_ASSIGN(NetworkLibraryImpl); 599 DISALLOW_COPY_AND_ASSIGN(NetworkLibraryImpl);
573 }; 600 };
574 601
575 } // namespace chromeos 602 } // namespace chromeos
576 603
577 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ 604 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/mock_network_library.h ('k') | chrome/browser/chromeos/cros/network_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698