| 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 13 matching lines...) Expand all Loading... |
| 24 const std::string& device_path() const { return device_path_; } | 24 const std::string& device_path() const { return device_path_; } |
| 25 const std::string& ip_address() const { return ip_address_; } | 25 const std::string& ip_address() const { return ip_address_; } |
| 26 ConnectionType type() const { return type_; } | 26 ConnectionType type() const { return type_; } |
| 27 bool connecting() const { return state_ == STATE_ASSOCIATION || | 27 bool connecting() const { return state_ == STATE_ASSOCIATION || |
| 28 state_ == STATE_CONFIGURATION || state_ == STATE_CARRIER; } | 28 state_ == STATE_CONFIGURATION || state_ == STATE_CARRIER; } |
| 29 bool connected() const { return state_ == STATE_READY; } | 29 bool connected() const { return state_ == STATE_READY; } |
| 30 bool connecting_or_connected() const { return connecting() || connected(); } | 30 bool connecting_or_connected() const { return connecting() || connected(); } |
| 31 bool failed() const { return state_ == STATE_FAILURE; } | 31 bool failed() const { return state_ == STATE_FAILURE; } |
| 32 ConnectionError error() const { return error_; } | 32 ConnectionError error() const { return error_; } |
| 33 | 33 |
| 34 void set_connecting(bool connecting) { state_ = STATE_CONFIGURATION; } | 34 void set_connecting(bool connecting) { state_ = (connecting ? |
| 35 void set_connected(bool connected) { state_ = STATE_READY; } | 35 STATE_ASSOCIATION : STATE_IDLE); } |
| 36 void set_connected(bool connected) { state_ = (connected ? |
| 37 STATE_READY : STATE_IDLE); } |
| 36 | 38 |
| 37 // Clear the fields. | 39 // Clear the fields. |
| 38 virtual void Clear(); | 40 virtual void Clear(); |
| 39 | 41 |
| 40 // Configure the Network from a ServiceInfo object. | 42 // Configure the Network from a ServiceInfo object. |
| 41 virtual void ConfigureFromService(const ServiceInfo& service); | 43 virtual void ConfigureFromService(const ServiceInfo& service); |
| 42 | 44 |
| 43 // Return a string representation of the state code. | 45 // Return a string representation of the state code. |
| 44 // This not translated and should be only used for debugging purposes. | 46 // This not translated and should be only used for debugging purposes. |
| 45 std::string GetStateString(); | 47 std::string GetStateString(); |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 WifiNetworkVector* remembered_wifi_networks, | 430 WifiNetworkVector* remembered_wifi_networks, |
| 429 CellularNetworkVector* remembered_ceullular_networks); | 431 CellularNetworkVector* remembered_ceullular_networks); |
| 430 | 432 |
| 431 // This methods loads the initial list of networks on startup and starts the | 433 // This methods loads the initial list of networks on startup and starts the |
| 432 // monitoring of network changes. | 434 // monitoring of network changes. |
| 433 void Init(); | 435 void Init(); |
| 434 | 436 |
| 435 // Force an update of the system info. | 437 // Force an update of the system info. |
| 436 void UpdateSystemInfo(); | 438 void UpdateSystemInfo(); |
| 437 | 439 |
| 438 // Gets the WifiNetwork with the given name. Returns whether the wifi network | 440 // Gets the WifiNetwork with the given name. Returns NULL if not found. |
| 439 // was found or not. | 441 WifiNetwork* GetWifiNetworkByName(const std::string& name); |
| 440 bool GetWifiNetworkByName(const std::string& name, WifiNetwork* wifi); | 442 |
| 443 // Gets the WifiNetwork with the given path. Returns NULL if not found. |
| 444 WifiNetwork* GetWifiNetworkByPath(const std::string& path); |
| 441 | 445 |
| 442 // Enables/disables the specified network device. | 446 // Enables/disables the specified network device. |
| 443 void EnableNetworkDeviceType(ConnectionType device, bool enable); | 447 void EnableNetworkDeviceType(ConnectionType device, bool enable); |
| 444 | 448 |
| 445 // Update the network with the SystemInfo object. | 449 // Update the network with the SystemInfo object. |
| 446 // This will notify all the Observers. | 450 // This will notify all the Observers. |
| 447 void UpdateNetworkStatus(SystemInfo* system); | 451 void UpdateNetworkStatus(SystemInfo* system); |
| 448 | 452 |
| 449 // Checks network traffic to see if there is any uploading. | 453 // Checks network traffic to see if there is any uploading. |
| 450 // If there is download traffic, then true is passed in for download. | 454 // If there is download traffic, then true is passed in for download. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 int connected_devices_; | 513 int connected_devices_; |
| 510 | 514 |
| 511 bool offline_mode_; | 515 bool offline_mode_; |
| 512 | 516 |
| 513 DISALLOW_COPY_AND_ASSIGN(NetworkLibraryImpl); | 517 DISALLOW_COPY_AND_ASSIGN(NetworkLibraryImpl); |
| 514 }; | 518 }; |
| 515 | 519 |
| 516 } // namespace chromeos | 520 } // namespace chromeos |
| 517 | 521 |
| 518 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ | 522 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ |
| OLD | NEW |