| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 void set_service_path(const std::string& service_path) { | 52 void set_service_path(const std::string& service_path) { |
| 53 service_path_ = service_path; } | 53 service_path_ = service_path; } |
| 54 void set_connecting(bool connecting) { state_ = (connecting ? | 54 void set_connecting(bool connecting) { state_ = (connecting ? |
| 55 STATE_ASSOCIATION : STATE_IDLE); } | 55 STATE_ASSOCIATION : STATE_IDLE); } |
| 56 void set_connected(bool connected) { state_ = (connected ? | 56 void set_connected(bool connected) { state_ = (connected ? |
| 57 STATE_READY : STATE_IDLE); } | 57 STATE_READY : STATE_IDLE); } |
| 58 | 58 |
| 59 // Clear the fields. | 59 // Clear the fields. |
| 60 virtual void Clear(); | 60 virtual void Clear(); |
| 61 | 61 |
| 62 // Configure the Network from a ServiceInfo object. | |
| 63 virtual void ConfigureFromService(const ServiceInfo& service); | |
| 64 | |
| 65 // Return a string representation of the state code. | 62 // Return a string representation of the state code. |
| 66 std::string GetStateString() const; | 63 std::string GetStateString() const; |
| 67 | 64 |
| 68 // Return a string representation of the error code. | 65 // Return a string representation of the error code. |
| 69 std::string GetErrorString() const; | 66 std::string GetErrorString() const; |
| 70 | 67 |
| 71 protected: | 68 protected: |
| 72 Network() | 69 Network() |
| 73 : type_(TYPE_UNKNOWN), | 70 : type_(TYPE_UNKNOWN), |
| 74 state_(STATE_UNKNOWN), | 71 state_(STATE_UNKNOWN), |
| 75 error_(ERROR_UNKNOWN) {} | 72 error_(ERROR_UNKNOWN) {} |
| 73 explicit Network(const Network& network); |
| 74 explicit Network(const ServiceInfo* service); |
| 76 virtual ~Network() {} | 75 virtual ~Network() {} |
| 77 | 76 |
| 78 std::string service_path_; | 77 std::string service_path_; |
| 79 std::string device_path_; | 78 std::string device_path_; |
| 80 std::string ip_address_; | 79 std::string ip_address_; |
| 81 ConnectionType type_; | 80 ConnectionType type_; |
| 82 ConnectionState state_; | 81 ConnectionState state_; |
| 83 ConnectionError error_; | 82 ConnectionError error_; |
| 84 }; | 83 }; |
| 85 | 84 |
| 86 class EthernetNetwork : public Network { | 85 class EthernetNetwork : public Network { |
| 87 public: | 86 public: |
| 88 EthernetNetwork() : Network() { | 87 EthernetNetwork() : Network() { |
| 89 type_ = TYPE_ETHERNET; | 88 type_ = TYPE_ETHERNET; |
| 90 } | 89 } |
| 90 |
| 91 explicit EthernetNetwork(const EthernetNetwork& network) |
| 92 : Network(network) { |
| 93 type_ = TYPE_ETHERNET; |
| 94 } |
| 95 |
| 96 explicit EthernetNetwork(const ServiceInfo* service) : Network(service) { |
| 97 type_ = TYPE_ETHERNET; |
| 98 } |
| 91 }; | 99 }; |
| 92 | 100 |
| 93 class WirelessNetwork : public Network { | 101 class WirelessNetwork : public Network { |
| 94 public: | 102 public: |
| 95 // WirelessNetwork are sorted by name. | 103 // WirelessNetwork are sorted by name. |
| 96 bool operator< (const WirelessNetwork& other) const { | 104 bool operator< (const WirelessNetwork& other) const { |
| 97 return name_ < other.name(); | 105 return name_ < other.name(); |
| 98 } | 106 } |
| 99 | 107 |
| 100 // We frequently want to compare networks by service path. | 108 // We frequently want to compare networks by service path. |
| 101 struct ServicePathEq { | 109 struct ServicePathEq { |
| 102 explicit ServicePathEq(const std::string& path_in) : path(path_in) {} | 110 explicit ServicePathEq(const std::string& path_in) : path(path_in) {} |
| 103 bool operator()(const WirelessNetwork& a) { | 111 bool operator()(const WirelessNetwork* a) { |
| 104 return a.service_path().compare(path) == 0; | 112 return a->service_path().compare(path) == 0; |
| 105 } | 113 } |
| 106 const std::string& path; | 114 const std::string& path; |
| 107 }; | 115 }; |
| 108 | 116 |
| 109 const std::string& name() const { return name_; } | 117 const std::string& name() const { return name_; } |
| 110 int strength() const { return strength_; } | 118 int strength() const { return strength_; } |
| 111 bool auto_connect() const { return auto_connect_; } | 119 bool auto_connect() const { return auto_connect_; } |
| 112 bool favorite() const { return favorite_; } | 120 bool favorite() const { return favorite_; } |
| 113 | 121 |
| 114 void set_name(const std::string& name) { name_ = name; } | 122 void set_name(const std::string& name) { name_ = name; } |
| 115 void set_strength(int strength) { strength_ = strength; } | 123 void set_strength(int strength) { strength_ = strength; } |
| 116 void set_auto_connect(bool auto_connect) { auto_connect_ = auto_connect; } | 124 void set_auto_connect(bool auto_connect) { auto_connect_ = auto_connect; } |
| 117 void set_favorite(bool favorite) { favorite_ = favorite; } | 125 void set_favorite(bool favorite) { favorite_ = favorite; } |
| 118 | 126 |
| 119 // Network overrides. | 127 // Network overrides. |
| 120 virtual void Clear(); | 128 virtual void Clear(); |
| 121 virtual void ConfigureFromService(const ServiceInfo& service); | |
| 122 | 129 |
| 123 protected: | 130 protected: |
| 124 WirelessNetwork() | 131 WirelessNetwork() |
| 125 : Network(), | 132 : Network(), |
| 126 strength_(0), | 133 strength_(0), |
| 127 auto_connect_(false), | 134 auto_connect_(false), |
| 128 favorite_(false) {} | 135 favorite_(false) {} |
| 136 explicit WirelessNetwork(const WirelessNetwork& network); |
| 137 explicit WirelessNetwork(const ServiceInfo* service); |
| 129 | 138 |
| 130 std::string name_; | 139 std::string name_; |
| 131 int strength_; | 140 int strength_; |
| 132 bool auto_connect_; | 141 bool auto_connect_; |
| 133 bool favorite_; | 142 bool favorite_; |
| 134 }; | 143 }; |
| 135 | 144 |
| 136 class CellularNetwork : public WirelessNetwork { | 145 class CellularNetwork : public WirelessNetwork { |
| 137 public: | 146 public: |
| 138 enum DataLeft { | 147 enum DataLeft { |
| 139 DATA_NORMAL, | 148 DATA_NORMAL, |
| 140 DATA_LOW, | 149 DATA_LOW, |
| 141 DATA_VERY_LOW, | 150 DATA_VERY_LOW, |
| 142 DATA_NONE | 151 DATA_NONE |
| 143 }; | 152 }; |
| 144 | 153 |
| 145 CellularNetwork(); | 154 CellularNetwork(); |
| 146 explicit CellularNetwork(const ServiceInfo& service) | 155 explicit CellularNetwork(const CellularNetwork& network); |
| 147 : WirelessNetwork() { | 156 explicit CellularNetwork(const ServiceInfo* service); |
| 148 ConfigureFromService(service); | |
| 149 } | |
| 150 | 157 |
| 151 // Starts device activation process. Returns false if the device state does | 158 // Starts device activation process. Returns false if the device state does |
| 152 // not permit activation. | 159 // not permit activation. |
| 153 bool StartActivation() const; | 160 bool StartActivation() const; |
| 154 void set_activation_state(ActivationState state) { | 161 void set_activation_state(ActivationState state) { |
| 155 activation_state_ = state; | 162 activation_state_ = state; |
| 156 } | 163 } |
| 157 const ActivationState activation_state() const { return activation_state_; } | 164 const ActivationState activation_state() const { return activation_state_; } |
| 158 const NetworkTechnology network_technology() const { | 165 const NetworkTechnology network_technology() const { |
| 159 return network_technology_; | 166 return network_technology_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 177 const std::string& manufacturer() const { return manufacturer_; } | 184 const std::string& manufacturer() const { return manufacturer_; } |
| 178 const std::string& firmware_revision() const { return firmware_revision_; } | 185 const std::string& firmware_revision() const { return firmware_revision_; } |
| 179 const std::string& hardware_revision() const { return hardware_revision_; } | 186 const std::string& hardware_revision() const { return hardware_revision_; } |
| 180 const std::string& last_update() const { return last_update_; } | 187 const std::string& last_update() const { return last_update_; } |
| 181 const unsigned int prl_version() const { return prl_version_; } | 188 const unsigned int prl_version() const { return prl_version_; } |
| 182 bool is_gsm() const; | 189 bool is_gsm() const; |
| 183 DataLeft data_left() const; | 190 DataLeft data_left() const; |
| 184 | 191 |
| 185 // WirelessNetwork overrides. | 192 // WirelessNetwork overrides. |
| 186 virtual void Clear(); | 193 virtual void Clear(); |
| 187 virtual void ConfigureFromService(const ServiceInfo& service); | |
| 188 | 194 |
| 189 const CellularDataPlanList& GetDataPlans() const { | 195 const CellularDataPlanList& GetDataPlans() const { |
| 190 return data_plans_; | 196 return data_plans_; |
| 191 } | 197 } |
| 192 | 198 |
| 193 void SetDataPlans(const CellularDataPlanList& data_plans) { | 199 void SetDataPlans(const CellularDataPlanList& data_plans) { |
| 194 data_plans_ = data_plans; | 200 data_plans_ = data_plans; |
| 195 } | 201 } |
| 196 // Return a string representation of network technology. | 202 // Return a string representation of network technology. |
| 197 std::string GetNetworkTechnologyString() const; | 203 std::string GetNetworkTechnologyString() const; |
| 198 // Return a string representation of activation state. | 204 // Return a string representation of activation state. |
| 199 std::string GetActivationStateString() const; | 205 std::string GetActivationStateString() const; |
| 200 // Return a string representation of roaming state. | 206 // Return a string representation of roaming state. |
| 201 std::string GetRoamingStateString() const; | 207 std::string GetRoamingStateString() const; |
| 202 | 208 |
| 203 // Return a string representation of |activation_state|. | 209 // Return a string representation of |activation_state|. |
| 204 static std::string ActivationStateToString(ActivationState activation_state); | 210 static std::string ActivationStateToString(ActivationState activation_state); |
| 205 | 211 |
| 206 protected: | 212 protected: |
| 213 |
| 207 ActivationState activation_state_; | 214 ActivationState activation_state_; |
| 208 NetworkTechnology network_technology_; | 215 NetworkTechnology network_technology_; |
| 209 NetworkRoamingState roaming_state_; | 216 NetworkRoamingState roaming_state_; |
| 210 bool restricted_pool_; | 217 bool restricted_pool_; |
| 211 std::string service_name_; | 218 std::string service_name_; |
| 212 // Carrier Info | 219 // Carrier Info |
| 213 std::string operator_name_; | 220 std::string operator_name_; |
| 214 std::string operator_code_; | 221 std::string operator_code_; |
| 215 std::string payment_url_; | 222 std::string payment_url_; |
| 216 // Device Info | 223 // Device Info |
| 217 std::string meid_; | 224 std::string meid_; |
| 218 std::string imei_; | 225 std::string imei_; |
| 219 std::string imsi_; | 226 std::string imsi_; |
| 220 std::string esn_; | 227 std::string esn_; |
| 221 std::string mdn_; | 228 std::string mdn_; |
| 222 std::string min_; | 229 std::string min_; |
| 223 std::string model_id_; | 230 std::string model_id_; |
| 224 std::string manufacturer_; | 231 std::string manufacturer_; |
| 225 std::string firmware_revision_; | 232 std::string firmware_revision_; |
| 226 std::string hardware_revision_; | 233 std::string hardware_revision_; |
| 227 std::string last_update_; | 234 std::string last_update_; |
| 228 unsigned int prl_version_; | 235 unsigned int prl_version_; |
| 229 CellularDataPlanList data_plans_; | 236 CellularDataPlanList data_plans_; |
| 230 }; | 237 }; |
| 231 | 238 |
| 232 class WifiNetwork : public WirelessNetwork { | 239 class WifiNetwork : public WirelessNetwork { |
| 233 public: | 240 public: |
| 234 WifiNetwork(); | 241 WifiNetwork(); |
| 235 explicit WifiNetwork(const ServiceInfo& service); | 242 explicit WifiNetwork(const WifiNetwork& network); |
| 243 explicit WifiNetwork(const ServiceInfo* service); |
| 236 | 244 |
| 237 bool encrypted() const { return encryption_ != SECURITY_NONE; } | 245 bool encrypted() const { return encryption_ != SECURITY_NONE; } |
| 238 ConnectionSecurity encryption() const { return encryption_; } | 246 ConnectionSecurity encryption() const { return encryption_; } |
| 239 const std::string& passphrase() const { return passphrase_; } | 247 const std::string& passphrase() const { return passphrase_; } |
| 240 const std::string& identity() const { return identity_; } | 248 const std::string& identity() const { return identity_; } |
| 241 const std::string& cert_path() const { return cert_path_; } | 249 const std::string& cert_path() const { return cert_path_; } |
| 242 | 250 |
| 243 void set_encryption(ConnectionSecurity encryption) { | 251 void set_encryption(ConnectionSecurity encryption) { |
| 244 encryption_ = encryption; | 252 encryption_ = encryption; |
| 245 } | 253 } |
| 246 void set_passphrase(const std::string& passphrase) { | 254 void set_passphrase(const std::string& passphrase) { |
| 247 passphrase_ = passphrase; | 255 passphrase_ = passphrase; |
| 248 } | 256 } |
| 249 void set_identity(const std::string& identity) { | 257 void set_identity(const std::string& identity) { |
| 250 identity_ = identity; | 258 identity_ = identity; |
| 251 } | 259 } |
| 252 void set_cert_path(const std::string& cert_path) { | 260 void set_cert_path(const std::string& cert_path) { |
| 253 cert_path_ = cert_path; | 261 cert_path_ = cert_path; |
| 254 } | 262 } |
| 255 | 263 |
| 256 // WirelessNetwork overrides. | 264 // WirelessNetwork overrides. |
| 257 virtual void Clear(); | 265 virtual void Clear(); |
| 258 virtual void ConfigureFromService(const ServiceInfo& service); | |
| 259 | 266 |
| 260 // Return a string representation of the encryption code. | 267 // Return a string representation of the encryption code. |
| 261 // This not translated and should be only used for debugging purposes. | 268 // This not translated and should be only used for debugging purposes. |
| 262 std::string GetEncryptionString(); | 269 std::string GetEncryptionString(); |
| 263 | 270 |
| 264 // Return true if cert_path_ indicates that we have loaded the certificate. | 271 // Return true if cert_path_ indicates that we have loaded the certificate. |
| 265 bool IsCertificateLoaded() const; | 272 bool IsCertificateLoaded() const; |
| 266 | 273 |
| 267 protected: | 274 protected: |
| 268 ConnectionSecurity encryption_; | 275 ConnectionSecurity encryption_; |
| 269 std::string passphrase_; | 276 std::string passphrase_; |
| 270 std::string identity_; | 277 std::string identity_; |
| 271 std::string cert_path_; | 278 std::string cert_path_; |
| 272 }; | 279 }; |
| 273 | 280 |
| 274 typedef std::vector<WifiNetwork> WifiNetworkVector; | 281 typedef std::vector<chromeos::WifiNetwork*> WifiNetworkVector; |
| 275 typedef std::vector<CellularNetwork> CellularNetworkVector; | 282 typedef std::vector<chromeos::CellularNetwork*> CellularNetworkVector; |
| 276 | 283 |
| 277 struct CellTower { | 284 struct CellTower { |
| 278 enum RadioType { | 285 enum RadioType { |
| 279 RADIOTYPE_GSM, | 286 RADIOTYPE_GSM, |
| 280 RADIOTYPE_CDMA, | 287 RADIOTYPE_CDMA, |
| 281 RADIOTYPE_WCDMA, | 288 RADIOTYPE_WCDMA, |
| 282 } radio_type; // GSM/WCDMA CDMA | 289 } radio_type; // GSM/WCDMA CDMA |
| 283 int mobile_country_code; // MCC MCC | 290 int mobile_country_code; // MCC MCC |
| 284 int mobile_network_code; // MNC SID | 291 int mobile_network_code; // MNC SID |
| 285 int location_area_code; // LAC NID | 292 int location_area_code; // LAC NID |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 }; | 355 }; |
| 349 | 356 |
| 350 virtual ~NetworkLibrary() {} | 357 virtual ~NetworkLibrary() {} |
| 351 virtual void AddObserver(Observer* observer) = 0; | 358 virtual void AddObserver(Observer* observer) = 0; |
| 352 virtual void RemoveObserver(Observer* observer) = 0; | 359 virtual void RemoveObserver(Observer* observer) = 0; |
| 353 virtual void AddProperyObserver(const char* service_path, | 360 virtual void AddProperyObserver(const char* service_path, |
| 354 PropertyObserver* observer) = 0; | 361 PropertyObserver* observer) = 0; |
| 355 virtual void RemoveProperyObserver(PropertyObserver* observer) = 0; | 362 virtual void RemoveProperyObserver(PropertyObserver* observer) = 0; |
| 356 | 363 |
| 357 // Return the active Ethernet network (or a default structure if inactive). | 364 // Return the active Ethernet network (or a default structure if inactive). |
| 358 virtual const EthernetNetwork& ethernet_network() const = 0; | 365 virtual EthernetNetwork* ethernet_network() = 0; |
| 359 virtual bool ethernet_connecting() const = 0; | 366 virtual bool ethernet_connecting() const = 0; |
| 360 virtual bool ethernet_connected() const = 0; | 367 virtual bool ethernet_connected() const = 0; |
| 361 | 368 |
| 362 // Return the active Wifi network (or a default structure if none active). | 369 // Return the active Wifi network (or a default structure if none active). |
| 363 virtual const WifiNetwork& wifi_network() const = 0; | 370 virtual WifiNetwork* wifi_network() = 0; |
| 364 virtual bool wifi_connecting() const = 0; | 371 virtual bool wifi_connecting() const = 0; |
| 365 virtual bool wifi_connected() const = 0; | 372 virtual bool wifi_connected() const = 0; |
| 366 | 373 |
| 367 // Return the active Cellular network (or a default structure if none active). | 374 // Return the active Cellular network (or a default structure if none active). |
| 368 virtual const CellularNetwork& cellular_network() const = 0; | 375 virtual CellularNetwork* cellular_network() = 0; |
| 369 virtual bool cellular_connecting() const = 0; | 376 virtual bool cellular_connecting() const = 0; |
| 370 virtual bool cellular_connected() const = 0; | 377 virtual bool cellular_connected() const = 0; |
| 371 | 378 |
| 372 // Return true if any network is currently connected. | 379 // Return true if any network is currently connected. |
| 373 virtual bool Connected() const = 0; | 380 virtual bool Connected() const = 0; |
| 374 | 381 |
| 375 // Return true if any network is currently connecting. | 382 // Return true if any network is currently connecting. |
| 376 virtual bool Connecting() const = 0; | 383 virtual bool Connecting() const = 0; |
| 377 | 384 |
| 378 // Returns the current IP address if connected. If not, returns empty string. | 385 // Returns the current IP address if connected. If not, returns empty string. |
| 379 virtual const std::string& IPAddress() const = 0; | 386 // virtual const std::string& IPAddress() const = 0; |
| 380 | 387 |
| 381 // Returns the current list of wifi networks. | 388 // Returns the current list of wifi networks. |
| 382 virtual const WifiNetworkVector& wifi_networks() const = 0; | 389 virtual const WifiNetworkVector& wifi_networks() const = 0; |
| 383 | 390 |
| 384 // Returns the list of remembered wifi networks. | 391 // Returns the list of remembered wifi networks. |
| 385 virtual const WifiNetworkVector& remembered_wifi_networks() const = 0; | 392 virtual const WifiNetworkVector& remembered_wifi_networks() const = 0; |
| 386 | 393 |
| 387 // Returns the current list of cellular networks. | 394 // Returns the current list of cellular networks. |
| 388 virtual const CellularNetworkVector& cellular_networks() const = 0; | 395 virtual const CellularNetworkVector& cellular_networks() const = 0; |
| 389 | 396 |
| 390 // Returns the list of remembered cellular networks. | |
| 391 virtual const CellularNetworkVector& remembered_cellular_networks() const = 0; | |
| 392 | |
| 393 // Search the current list of networks by path and if the network | 397 // Search the current list of networks by path and if the network |
| 394 // is available, copy the result and return true. | 398 // is available, copy the result and return true. |
| 395 virtual bool FindWifiNetworkByPath(const std::string& path, | 399 virtual WifiNetwork* FindWifiNetworkByPath(const std::string& path) = 0; |
| 396 WifiNetwork* result) const = 0; | 400 virtual CellularNetwork* FindCellularNetworkByPath( |
| 397 virtual bool FindCellularNetworkByPath(const std::string& path, | 401 const std::string& path) = 0; |
| 398 CellularNetwork* result) const = 0; | 402 |
| 399 | 403 |
| 400 // Request a scan for new wifi networks. | 404 // Request a scan for new wifi networks. |
| 401 virtual void RequestWifiScan() = 0; | 405 virtual void RequestWifiScan() = 0; |
| 402 | 406 |
| 403 // Reads out the results of the last wifi scan. These results are not | 407 // Reads out the results of the last wifi scan. These results are not |
| 404 // pre-cached in the library, so the call may block whilst the results are | 408 // pre-cached in the library, so the call may block whilst the results are |
| 405 // read over IPC. | 409 // read over IPC. |
| 406 // Returns false if an error occurred in reading the results. Note that | 410 // Returns false if an error occurred in reading the results. Note that |
| 407 // a true return code only indicates the result set was successfully read, | 411 // a true return code only indicates the result set was successfully read, |
| 408 // it does not imply a scan has successfully completed yet. | 412 // it does not imply a scan has successfully completed yet. |
| 409 virtual bool GetWifiAccessPoints(WifiAccessPointVector* result) = 0; | 413 virtual bool GetWifiAccessPoints(WifiAccessPointVector* result) = 0; |
| 410 | 414 |
| 411 // TODO(joth): Add GetCellTowers to retrieve a CellTowerVector. | 415 // TODO(joth): Add GetCellTowers to retrieve a CellTowerVector. |
| 412 | 416 |
| 413 // Force an update of the system info. | 417 // Force an update of the system info. |
| 414 virtual void UpdateSystemInfo() = 0; | 418 virtual void UpdateSystemInfo() = 0; |
| 415 | 419 |
| 416 // Connect to the specified wireless network with password. | 420 // Connect to the specified wireless network with password. |
| 417 virtual void ConnectToWifiNetwork(WifiNetwork network, | 421 virtual void ConnectToWifiNetwork(const WifiNetwork* network, |
| 418 const std::string& password, | 422 const std::string& password, |
| 419 const std::string& identity, | 423 const std::string& identity, |
| 420 const std::string& certpath) = 0; | 424 const std::string& certpath) = 0; |
| 421 | 425 |
| 422 // Connect to the specified wifi ssid with password. | 426 // Connect to the specified wifi ssid with password. |
| 423 virtual void ConnectToWifiNetwork(const std::string& ssid, | 427 virtual void ConnectToWifiNetwork(const std::string& ssid, |
| 424 const std::string& password, | 428 const std::string& password, |
| 425 const std::string& identity, | 429 const std::string& identity, |
| 426 const std::string& certpath, | 430 const std::string& certpath, |
| 427 bool auto_connect) = 0; | 431 bool auto_connect) = 0; |
| 428 | 432 |
| 429 // Connect to the specified cellular network. | 433 // Connect to the specified cellular network. |
| 430 virtual void ConnectToCellularNetwork(CellularNetwork network) = 0; | 434 virtual void ConnectToCellularNetwork(const CellularNetwork* network) = 0; |
| 431 | 435 |
| 432 // Initiates cellular data plan refresh. Plan data will be passed through | 436 // Initiates cellular data plan refresh. Plan data will be passed through |
| 433 // Network::Observer::CellularDataPlanChanged callback. | 437 // Network::Observer::CellularDataPlanChanged callback. |
| 434 virtual void RefreshCellularDataPlans(const CellularNetwork& network) = 0; | 438 virtual void RefreshCellularDataPlans(const CellularNetwork* network) = 0; |
| 435 | 439 |
| 436 // Disconnect from the specified wireless (either cellular or wifi) network. | 440 // Disconnect from the specified wireless (either cellular or wifi) network. |
| 437 virtual void DisconnectFromWirelessNetwork( | 441 virtual void DisconnectFromWirelessNetwork( |
| 438 const WirelessNetwork& network) = 0; | 442 const WirelessNetwork* network) = 0; |
| 439 | 443 |
| 440 // Save network information including passwords (wifi) and auto-connect. | 444 // Save network information including passwords (wifi) and auto-connect. |
| 441 virtual void SaveCellularNetwork(const CellularNetwork& network) = 0; | 445 virtual void SaveCellularNetwork(const CellularNetwork* network) = 0; |
| 442 virtual void SaveWifiNetwork(const WifiNetwork& network) = 0; | 446 virtual void SaveWifiNetwork(const WifiNetwork* network) = 0; |
| 443 | 447 |
| 444 // Forget the passed in wireless (either cellular or wifi) network. | 448 // Forget the wifi network corresponding to service_path. |
| 445 virtual void ForgetWirelessNetwork(const std::string& service_path) = 0; | 449 virtual void ForgetWifiNetwork(const std::string& service_path) = 0; |
| 446 | 450 |
| 447 virtual bool ethernet_available() const = 0; | 451 virtual bool ethernet_available() const = 0; |
| 448 virtual bool wifi_available() const = 0; | 452 virtual bool wifi_available() const = 0; |
| 449 virtual bool cellular_available() const = 0; | 453 virtual bool cellular_available() const = 0; |
| 450 | 454 |
| 451 virtual bool ethernet_enabled() const = 0; | 455 virtual bool ethernet_enabled() const = 0; |
| 452 virtual bool wifi_enabled() const = 0; | 456 virtual bool wifi_enabled() const = 0; |
| 453 virtual bool cellular_enabled() const = 0; | 457 virtual bool cellular_enabled() const = 0; |
| 454 | 458 |
| 455 virtual bool offline_mode() const = 0; | 459 virtual bool offline_mode() const = 0; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 479 virtual std::string GetHtmlInfo(int refresh) = 0; | 483 virtual std::string GetHtmlInfo(int refresh) = 0; |
| 480 | 484 |
| 481 // Factory function, creates a new instance and returns ownership. | 485 // Factory function, creates a new instance and returns ownership. |
| 482 // For normal usage, access the singleton via CrosLibrary::Get(). | 486 // For normal usage, access the singleton via CrosLibrary::Get(). |
| 483 static NetworkLibrary* GetImpl(bool stub); | 487 static NetworkLibrary* GetImpl(bool stub); |
| 484 }; | 488 }; |
| 485 | 489 |
| 486 } // namespace chromeos | 490 } // namespace chromeos |
| 487 | 491 |
| 488 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ | 492 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ |
| OLD | NEW |