| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 const std::string& device_path() const { return device_path_; } | 23 const std::string& device_path() const { return device_path_; } |
| 24 const std::string& ip_address() const { return ip_address_; } | 24 const std::string& ip_address() const { return ip_address_; } |
| 25 ConnectionType type() const { return type_; } | 25 ConnectionType type() const { return type_; } |
| 26 ConnectionState connection_state() const { return state_; } | 26 ConnectionState connection_state() const { return state_; } |
| 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 ConnectionState state() const { return state_; } |
| 33 | 34 |
| 34 void set_service_path(const std::string& service_path) { | 35 void set_service_path(const std::string& service_path) { |
| 35 service_path_ = service_path; } | 36 service_path_ = service_path; } |
| 36 void set_connecting(bool connecting) { state_ = (connecting ? | 37 void set_connecting(bool connecting) { state_ = (connecting ? |
| 37 STATE_ASSOCIATION : STATE_IDLE); } | 38 STATE_ASSOCIATION : STATE_IDLE); } |
| 38 void set_connected(bool connected) { state_ = (connected ? | 39 void set_connected(bool connected) { state_ = (connected ? |
| 39 STATE_READY : STATE_IDLE); } | 40 STATE_READY : STATE_IDLE); } |
| 40 | 41 |
| 41 // Clear the fields. | 42 // Clear the fields. |
| 42 virtual void Clear(); | 43 virtual void Clear(); |
| 43 | 44 |
| 44 // Configure the Network from a ServiceInfo object. | 45 // Configure the Network from a ServiceInfo object. |
| 45 virtual void ConfigureFromService(const ServiceInfo& service); | 46 virtual void ConfigureFromService(const ServiceInfo& service); |
| 46 | 47 |
| 47 // Return a string representation of the state code. | 48 // Return a string representation of the state code. |
| 48 // This not translated and should be only used for debugging purposes. | |
| 49 std::string GetStateString() const; | 49 std::string GetStateString() const; |
| 50 | 50 |
| 51 // Return a string representation of the error code. | 51 // Return a string representation of the error code. |
| 52 // This not translated and should be only used for debugging purposes. | |
| 53 std::string GetErrorString() const; | 52 std::string GetErrorString() const; |
| 54 | 53 |
| 55 protected: | 54 protected: |
| 56 Network() | 55 Network() |
| 57 : type_(TYPE_UNKNOWN), | 56 : type_(TYPE_UNKNOWN), |
| 58 state_(STATE_UNKNOWN), | 57 state_(STATE_UNKNOWN), |
| 59 error_(ERROR_UNKNOWN) {} | 58 error_(ERROR_UNKNOWN) {} |
| 60 virtual ~Network() {} | 59 virtual ~Network() {} |
| 61 | 60 |
| 62 std::string service_path_; | 61 std::string service_path_; |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 virtual std::string GetHtmlInfo(int refresh) = 0; | 417 virtual std::string GetHtmlInfo(int refresh) = 0; |
| 419 | 418 |
| 420 // Factory function, creates a new instance and returns ownership. | 419 // Factory function, creates a new instance and returns ownership. |
| 421 // For normal usage, access the singleton via CrosLibrary::Get(). | 420 // For normal usage, access the singleton via CrosLibrary::Get(). |
| 422 static NetworkLibrary* GetImpl(bool stub); | 421 static NetworkLibrary* GetImpl(bool stub); |
| 423 }; | 422 }; |
| 424 | 423 |
| 425 } // namespace chromeos | 424 } // namespace chromeos |
| 426 | 425 |
| 427 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ | 426 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ |
| OLD | NEW |