| OLD | NEW |
| 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 // Search the current list of networks by path and if the network | 301 // Search the current list of networks by path and if the network |
| 302 // is available, copy the result and return true. | 302 // is available, copy the result and return true. |
| 303 virtual bool FindWifiNetworkByPath(const std::string& path, | 303 virtual bool FindWifiNetworkByPath(const std::string& path, |
| 304 WifiNetwork* result) const = 0; | 304 WifiNetwork* result) const = 0; |
| 305 virtual bool FindCellularNetworkByPath(const std::string& path, | 305 virtual bool FindCellularNetworkByPath(const std::string& path, |
| 306 CellularNetwork* result) const = 0; | 306 CellularNetwork* result) const = 0; |
| 307 | 307 |
| 308 // Request a scan for new wifi networks. | 308 // Request a scan for new wifi networks. |
| 309 virtual void RequestWifiScan() = 0; | 309 virtual void RequestWifiScan() = 0; |
| 310 | 310 |
| 311 // Force an update of the system info. |
| 312 virtual void UpdateSystemInfo() = 0; |
| 313 |
| 311 // Attempt to connect to the preferred network if available and it is set up. | 314 // Attempt to connect to the preferred network if available and it is set up. |
| 312 // This call will return true if connection is started. | 315 // This call will return true if connection is started. |
| 313 // If the preferred network is not available or not setup, returns false. | 316 // If the preferred network is not available or not setup, returns false. |
| 314 // Note: For dogfood purposes, we hardcode the preferred network to Google-A. | 317 // Note: For dogfood purposes, we hardcode the preferred network to Google-A. |
| 315 virtual bool ConnectToPreferredNetworkIfAvailable() = 0; | 318 virtual bool ConnectToPreferredNetworkIfAvailable() = 0; |
| 316 | 319 |
| 317 // Returns true if we are currently connected to the preferred network. | 320 // Returns true if we are currently connected to the preferred network. |
| 318 virtual bool PreferredNetworkConnected() = 0; | 321 virtual bool PreferredNetworkConnected() = 0; |
| 319 | 322 |
| 320 // Returns true if we failed to connect to the preferred network. | 323 // Returns true if we failed to connect to the preferred network. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 477 | 480 |
| 478 virtual bool offline_mode() const { return offline_mode_; } | 481 virtual bool offline_mode() const { return offline_mode_; } |
| 479 | 482 |
| 480 virtual void EnableEthernetNetworkDevice(bool enable); | 483 virtual void EnableEthernetNetworkDevice(bool enable); |
| 481 virtual void EnableWifiNetworkDevice(bool enable); | 484 virtual void EnableWifiNetworkDevice(bool enable); |
| 482 virtual void EnableCellularNetworkDevice(bool enable); | 485 virtual void EnableCellularNetworkDevice(bool enable); |
| 483 virtual void EnableOfflineMode(bool enable); | 486 virtual void EnableOfflineMode(bool enable); |
| 484 virtual NetworkIPConfigVector GetIPConfigs(const std::string& device_path); | 487 virtual NetworkIPConfigVector GetIPConfigs(const std::string& device_path); |
| 485 virtual std::string GetHtmlInfo(int refresh); | 488 virtual std::string GetHtmlInfo(int refresh); |
| 486 | 489 |
| 490 virtual void UpdateSystemInfo(); |
| 491 |
| 487 private: | 492 private: |
| 488 | 493 |
| 489 // This method is called when there's a change in network status. | 494 // This method is called when there's a change in network status. |
| 490 // This method is called on a background thread. | 495 // This method is called on a background thread. |
| 491 static void NetworkStatusChangedHandler(void* object); | 496 static void NetworkStatusChangedHandler(void* object); |
| 492 | 497 |
| 493 // This parses SystemInfo into: | 498 // This parses SystemInfo into: |
| 494 // - an EthernetNetwork | 499 // - an EthernetNetwork |
| 495 // - a WifiNetworkVector of wifi networks | 500 // - a WifiNetworkVector of wifi networks |
| 496 // - a CellularNetworkVector of cellular networks. | 501 // - a CellularNetworkVector of cellular networks. |
| 497 // - a WifiNetworkVector of remembered wifi networks | 502 // - a WifiNetworkVector of remembered wifi networks |
| 498 // - a CellularNetworkVector of remembered cellular networks. | 503 // - a CellularNetworkVector of remembered cellular networks. |
| 499 static void ParseSystem(SystemInfo* system, | 504 static void ParseSystem(SystemInfo* system, |
| 500 EthernetNetwork* ethernet, | 505 EthernetNetwork* ethernet, |
| 501 WifiNetworkVector* wifi_networks, | 506 WifiNetworkVector* wifi_networks, |
| 502 CellularNetworkVector* ceullular_networks, | 507 CellularNetworkVector* ceullular_networks, |
| 503 WifiNetworkVector* remembered_wifi_networks, | 508 WifiNetworkVector* remembered_wifi_networks, |
| 504 CellularNetworkVector* remembered_ceullular_networks); | 509 CellularNetworkVector* remembered_ceullular_networks); |
| 505 | 510 |
| 506 // This methods loads the initial list of networks on startup and starts the | 511 // This methods loads the initial list of networks on startup and starts the |
| 507 // monitoring of network changes. | 512 // monitoring of network changes. |
| 508 void Init(); | 513 void Init(); |
| 509 | 514 |
| 510 // Force an update of the system info. | |
| 511 void UpdateSystemInfo(); | |
| 512 | |
| 513 // Returns the preferred wifi network. | 515 // Returns the preferred wifi network. |
| 514 WifiNetwork* GetPreferredNetwork(); | 516 WifiNetwork* GetPreferredNetwork(); |
| 515 | 517 |
| 516 // Gets the WifiNetwork with the given name. Returns NULL if not found. | 518 // Gets the WifiNetwork with the given name. Returns NULL if not found. |
| 517 // Only used by GetPreferredNetwork() to lookup "Google" and "GoogleA" (hack) | 519 // Only used by GetPreferredNetwork() to lookup "Google" and "GoogleA" (hack) |
| 518 WifiNetwork* GetWifiNetworkByName(const std::string& name); | 520 WifiNetwork* GetWifiNetworkByName(const std::string& name); |
| 519 | 521 |
| 520 // Gets the WirelessNetwork (WifiNetwork or CellularNetwork) by path | 522 // Gets the WirelessNetwork (WifiNetwork or CellularNetwork) by path |
| 521 template<typename T> | 523 template<typename T> |
| 522 T* GetWirelessNetworkByPath(std::vector<T>& networks, | 524 T* GetWirelessNetworkByPath(std::vector<T>& networks, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 int connected_devices_; | 597 int connected_devices_; |
| 596 | 598 |
| 597 bool offline_mode_; | 599 bool offline_mode_; |
| 598 | 600 |
| 599 DISALLOW_COPY_AND_ASSIGN(NetworkLibraryImpl); | 601 DISALLOW_COPY_AND_ASSIGN(NetworkLibraryImpl); |
| 600 }; | 602 }; |
| 601 | 603 |
| 602 } // namespace chromeos | 604 } // namespace chromeos |
| 603 | 605 |
| 604 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ | 606 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ |
| OLD | NEW |