| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback.h" |
| 12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/singleton.h" | 17 #include "base/memory/singleton.h" |
| 16 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 17 #include "base/observer_list.h" | 19 #include "base/observer_list.h" |
| 18 #include "base/timer.h" | 20 #include "base/timer.h" |
| 19 #include "base/values.h" | 21 #include "base/values.h" |
| 20 #include "chrome/browser/chromeos/cros/network_constants.h" | 22 #include "chrome/browser/chromeos/cros/network_constants.h" |
| 21 #include "chromeos/network/network_ip_config.h" | 23 #include "chromeos/network/network_ip_config.h" |
| 22 #include "chromeos/network/network_ui_data.h" | 24 #include "chromeos/network/network_ui_data.h" |
| 23 #include "chromeos/network/network_util.h" | 25 #include "chromeos/network/network_util.h" |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 }; | 651 }; |
| 650 | 652 |
| 651 // Class for networks of TYPE_VPN. | 653 // Class for networks of TYPE_VPN. |
| 652 class VirtualNetwork : public Network { | 654 class VirtualNetwork : public Network { |
| 653 public: | 655 public: |
| 654 explicit VirtualNetwork(const std::string& service_path); | 656 explicit VirtualNetwork(const std::string& service_path); |
| 655 virtual ~VirtualNetwork(); | 657 virtual ~VirtualNetwork(); |
| 656 | 658 |
| 657 const std::string& server_hostname() const { return server_hostname_; } | 659 const std::string& server_hostname() const { return server_hostname_; } |
| 658 ProviderType provider_type() const { return provider_type_; } | 660 ProviderType provider_type() const { return provider_type_; } |
| 659 const std::string& ca_cert_nss() const { return ca_cert_nss_; } | 661 const std::string& ca_cert_fingerprint() const { |
| 662 return ca_cert_fingerprint_; |
| 663 } |
| 660 const std::string& psk_passphrase() const { return psk_passphrase_; } | 664 const std::string& psk_passphrase() const { return psk_passphrase_; } |
| 661 bool psk_passphrase_required() const { return psk_passphrase_required_; } | 665 bool psk_passphrase_required() const { return psk_passphrase_required_; } |
| 662 const std::string& client_cert_id() const { return client_cert_id_; } | 666 const std::string& client_cert_id() const { return client_cert_id_; } |
| 663 const std::string& username() const { return username_; } | 667 const std::string& username() const { return username_; } |
| 664 const std::string& user_passphrase() const { return user_passphrase_; } | 668 const std::string& user_passphrase() const { return user_passphrase_; } |
| 665 bool user_passphrase_required() const { return user_passphrase_required_; } | 669 bool user_passphrase_required() const { return user_passphrase_required_; } |
| 666 const std::string& group_name() const { return group_name_; } | 670 const std::string& group_name() const { return group_name_; } |
| 667 | 671 |
| 668 // Sets the well-known PKCS#11 slot and PIN for accessing certificates. | 672 // Sets the well-known PKCS#11 slot and PIN for accessing certificates. |
| 669 void SetCertificateSlotAndPin( | 673 void SetCertificateSlotAndPin( |
| 670 const std::string& slot, const std::string& pin); | 674 const std::string& slot, const std::string& pin); |
| 671 | 675 |
| 672 // Network overrides. | 676 // Network overrides. |
| 673 virtual bool RequiresUserProfile() const OVERRIDE; | 677 virtual bool RequiresUserProfile() const OVERRIDE; |
| 674 virtual void CopyCredentialsFromRemembered(Network* remembered) OVERRIDE; | 678 virtual void CopyCredentialsFromRemembered(Network* remembered) OVERRIDE; |
| 675 virtual void AttemptConnection(const base::Closure& connect) OVERRIDE; | 679 virtual void AttemptConnection(const base::Closure& connect) OVERRIDE; |
| 676 | 680 |
| 677 // Public getters. | 681 // Public getters. |
| 678 bool NeedMoreInfoToConnect() const; | 682 bool NeedMoreInfoToConnect() const; |
| 679 std::string GetProviderTypeString() const; | 683 std::string GetProviderTypeString() const; |
| 680 // Returns true if a PSK passphrase is required to connect. | 684 // Returns true if a PSK passphrase is required to connect. |
| 681 bool IsPSKPassphraseRequired() const; | 685 bool IsPSKPassphraseRequired() const; |
| 682 // Returns true if a user passphrase is required to connect. | 686 // Returns true if a user passphrase is required to connect. |
| 683 bool IsUserPassphraseRequired() const; | 687 bool IsUserPassphraseRequired() const; |
| 684 | 688 |
| 685 // Public setters. | 689 // Public setters. |
| 686 void SetCACertNSS(const std::string& ca_cert_nss); | 690 void SetCACertFingerprint(const std::string& ca_cert_fingerprint); |
| 687 void SetL2TPIPsecPSKCredentials(const std::string& psk_passphrase, | 691 void SetL2TPIPsecPSKCredentials(const std::string& psk_passphrase, |
| 688 const std::string& username, | 692 const std::string& username, |
| 689 const std::string& user_passphrase, | 693 const std::string& user_passphrase, |
| 690 const std::string& group_name); | 694 const std::string& group_name); |
| 691 void SetL2TPIPsecCertCredentials(const std::string& client_cert_id, | 695 void SetL2TPIPsecCertCredentials(const std::string& client_cert_id, |
| 692 const std::string& username, | 696 const std::string& username, |
| 693 const std::string& user_passphrase, | 697 const std::string& user_passphrase, |
| 694 const std::string& group_name); | 698 const std::string& group_name); |
| 695 void SetOpenVPNCredentials(const std::string& client_cert_id, | 699 void SetOpenVPNCredentials(const std::string& client_cert_id, |
| 696 const std::string& username, | 700 const std::string& username, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 713 // Use these functions at your peril. They are used by the various | 717 // Use these functions at your peril. They are used by the various |
| 714 // parsers to set state, and really shouldn't be used by anything else | 718 // parsers to set state, and really shouldn't be used by anything else |
| 715 // because they don't do the error checking and sending to the | 719 // because they don't do the error checking and sending to the |
| 716 // network layer that the other setters do. | 720 // network layer that the other setters do. |
| 717 void set_server_hostname(const std::string& server_hostname) { | 721 void set_server_hostname(const std::string& server_hostname) { |
| 718 server_hostname_ = server_hostname; | 722 server_hostname_ = server_hostname; |
| 719 } | 723 } |
| 720 void set_provider_type(ProviderType provider_type) { | 724 void set_provider_type(ProviderType provider_type) { |
| 721 provider_type_ = provider_type; | 725 provider_type_ = provider_type; |
| 722 } | 726 } |
| 723 void set_ca_cert_nss(const std::string& ca_cert_nss) { | 727 void set_ca_cert_fingerprint(const std::string& ca_cert_fingerprint) { |
| 724 ca_cert_nss_ = ca_cert_nss; | 728 ca_cert_fingerprint_ = ca_cert_fingerprint; |
| 725 } | 729 } |
| 726 void set_psk_passphrase(const std::string& psk_passphrase) { | 730 void set_psk_passphrase(const std::string& psk_passphrase) { |
| 727 psk_passphrase_ = psk_passphrase; | 731 psk_passphrase_ = psk_passphrase; |
| 728 } | 732 } |
| 729 void set_psk_passphrase_required(bool psk_passphrase_required) { | 733 void set_psk_passphrase_required(bool psk_passphrase_required) { |
| 730 psk_passphrase_required_ = psk_passphrase_required; | 734 psk_passphrase_required_ = psk_passphrase_required; |
| 731 } | 735 } |
| 732 void set_client_cert_id(const std::string& client_cert_id) { | 736 void set_client_cert_id(const std::string& client_cert_id) { |
| 733 client_cert_id_ = client_cert_id; | 737 client_cert_id_ = client_cert_id; |
| 734 } | 738 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 754 | 758 |
| 755 // Network overrides. | 759 // Network overrides. |
| 756 virtual void EraseCredentials() OVERRIDE; | 760 virtual void EraseCredentials() OVERRIDE; |
| 757 virtual void CalculateUniqueId() OVERRIDE; | 761 virtual void CalculateUniqueId() OVERRIDE; |
| 758 | 762 |
| 759 // VirtualNetwork private methods. | 763 // VirtualNetwork private methods. |
| 760 bool ParseProviderValue(int index, const base::Value* value); | 764 bool ParseProviderValue(int index, const base::Value* value); |
| 761 | 765 |
| 762 std::string server_hostname_; | 766 std::string server_hostname_; |
| 763 ProviderType provider_type_; | 767 ProviderType provider_type_; |
| 764 // NSS nickname for server CA certificate. | 768 std::string ca_cert_fingerprint_; |
| 765 std::string ca_cert_nss_; | |
| 766 std::string psk_passphrase_; | 769 std::string psk_passphrase_; |
| 767 bool psk_passphrase_required_; | 770 bool psk_passphrase_required_; |
| 768 // PKCS#11 ID for client certificate. | 771 // PKCS#11 ID for client certificate. |
| 769 std::string client_cert_id_; | 772 std::string client_cert_id_; |
| 770 std::string username_; | 773 std::string username_; |
| 771 std::string user_passphrase_; | 774 std::string user_passphrase_; |
| 772 bool user_passphrase_required_; | 775 bool user_passphrase_required_; |
| 773 std::string group_name_; | 776 std::string group_name_; |
| 774 | 777 |
| 775 // Weak pointer factory for wrapping pointers to this network in callbacks. | 778 // Weak pointer factory for wrapping pointers to this network in callbacks. |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 ConnectionSecurity encryption() const { return encryption_; } | 991 ConnectionSecurity encryption() const { return encryption_; } |
| 989 const std::string& passphrase() const { return passphrase_; } | 992 const std::string& passphrase() const { return passphrase_; } |
| 990 const std::string& identity() const { return identity_; } | 993 const std::string& identity() const { return identity_; } |
| 991 bool passphrase_required() const { return passphrase_required_; } | 994 bool passphrase_required() const { return passphrase_required_; } |
| 992 bool hidden_ssid() const { return hidden_ssid_; } | 995 bool hidden_ssid() const { return hidden_ssid_; } |
| 993 const std::string& bssid() const { return bssid_; } | 996 const std::string& bssid() const { return bssid_; } |
| 994 int frequency() const { return frequency_; } | 997 int frequency() const { return frequency_; } |
| 995 | 998 |
| 996 EAPMethod eap_method() const { return eap_method_; } | 999 EAPMethod eap_method() const { return eap_method_; } |
| 997 EAPPhase2Auth eap_phase_2_auth() const { return eap_phase_2_auth_; } | 1000 EAPPhase2Auth eap_phase_2_auth() const { return eap_phase_2_auth_; } |
| 998 const std::string& eap_server_ca_cert_nss_nickname() const { | 1001 const std::string& eap_server_ca_cert_fingerprint() const { |
| 999 return eap_server_ca_cert_nss_nickname_; } | 1002 return eap_server_ca_cert_fingerprint_; } |
| 1000 const std::string& eap_client_cert_pkcs11_id() const { | 1003 const std::string& eap_client_cert_pkcs11_id() const { |
| 1001 return eap_client_cert_pkcs11_id_; } | 1004 return eap_client_cert_pkcs11_id_; } |
| 1002 const bool eap_use_system_cas() const { return eap_use_system_cas_; } | 1005 const bool eap_use_system_cas() const { return eap_use_system_cas_; } |
| 1003 const std::string& eap_identity() const { return eap_identity_; } | 1006 const std::string& eap_identity() const { return eap_identity_; } |
| 1004 const std::string& eap_anonymous_identity() const { | 1007 const std::string& eap_anonymous_identity() const { |
| 1005 return eap_anonymous_identity_; | 1008 return eap_anonymous_identity_; |
| 1006 } | 1009 } |
| 1007 const std::string& eap_passphrase() const { return eap_passphrase_; } | 1010 const std::string& eap_passphrase() const { return eap_passphrase_; } |
| 1008 const bool eap_save_credentials() const { return eap_save_credentials_; } | 1011 const bool eap_save_credentials() const { return eap_save_credentials_; } |
| 1009 | 1012 |
| 1010 const std::string& GetPassphrase() const; | 1013 const std::string& GetPassphrase() const; |
| 1011 | 1014 |
| 1012 // Set property and call SetNetworkServiceProperty: | 1015 // Set property and call SetNetworkServiceProperty: |
| 1013 | 1016 |
| 1014 void SetPassphrase(const std::string& passphrase); | 1017 void SetPassphrase(const std::string& passphrase); |
| 1015 void SetIdentity(const std::string& identity); | 1018 void SetIdentity(const std::string& identity); |
| 1016 void SetHiddenSSID(bool hidden_ssid); | 1019 void SetHiddenSSID(bool hidden_ssid); |
| 1017 | 1020 |
| 1018 // 802.1x properties | 1021 // 802.1x properties |
| 1019 void SetEAPMethod(EAPMethod method); | 1022 void SetEAPMethod(EAPMethod method); |
| 1020 void SetEAPPhase2Auth(EAPPhase2Auth auth); | 1023 void SetEAPPhase2Auth(EAPPhase2Auth auth); |
| 1021 void SetEAPServerCaCertNssNickname(const std::string& nss_nickname); | 1024 void SetEAPServerCaCertFingerprint(const std::string& ca_cert_fingerprint); |
| 1022 void SetEAPClientCertPkcs11Id(const std::string& pkcs11_id); | 1025 void SetEAPClientCertPkcs11Id(const std::string& pkcs11_id); |
| 1023 void SetEAPUseSystemCAs(bool use_system_cas); | 1026 void SetEAPUseSystemCAs(bool use_system_cas); |
| 1024 void SetEAPIdentity(const std::string& identity); | 1027 void SetEAPIdentity(const std::string& identity); |
| 1025 void SetEAPAnonymousIdentity(const std::string& identity); | 1028 void SetEAPAnonymousIdentity(const std::string& identity); |
| 1026 void SetEAPPassphrase(const std::string& passphrase); | 1029 void SetEAPPassphrase(const std::string& passphrase); |
| 1027 | 1030 |
| 1028 // Sets the well-known PKCS#11 PIN for accessing certificates. | 1031 // Sets the well-known PKCS#11 PIN for accessing certificates. |
| 1029 void SetCertificatePin(const std::string& pin); | 1032 void SetCertificatePin(const std::string& pin); |
| 1030 | 1033 |
| 1031 // Network overrides. | 1034 // Network overrides. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1072 } | 1075 } |
| 1073 void set_hidden_ssid(bool hidden_ssid) { | 1076 void set_hidden_ssid(bool hidden_ssid) { |
| 1074 hidden_ssid_ = hidden_ssid; | 1077 hidden_ssid_ = hidden_ssid; |
| 1075 } | 1078 } |
| 1076 void set_bssid(const std::string& bssid) { bssid_ = bssid; } | 1079 void set_bssid(const std::string& bssid) { bssid_ = bssid; } |
| 1077 void set_frequency(int frequency) { frequency_ = frequency; } | 1080 void set_frequency(int frequency) { frequency_ = frequency; } |
| 1078 void set_eap_method(EAPMethod eap_method) { eap_method_ = eap_method; } | 1081 void set_eap_method(EAPMethod eap_method) { eap_method_ = eap_method; } |
| 1079 void set_eap_phase_2_auth(EAPPhase2Auth eap_phase_2_auth) { | 1082 void set_eap_phase_2_auth(EAPPhase2Auth eap_phase_2_auth) { |
| 1080 eap_phase_2_auth_ = eap_phase_2_auth; | 1083 eap_phase_2_auth_ = eap_phase_2_auth; |
| 1081 } | 1084 } |
| 1082 void set_eap_server_ca_cert_nss_nickname( | 1085 void set_eap_server_ca_cert_fingerprint( |
| 1083 const std::string& eap_server_ca_cert_nss_nickname) { | 1086 const std::string& eap_server_ca_cert_fingerprint) { |
| 1084 eap_server_ca_cert_nss_nickname_ = eap_server_ca_cert_nss_nickname; | 1087 eap_server_ca_cert_fingerprint_ = eap_server_ca_cert_fingerprint; |
| 1085 } | 1088 } |
| 1086 void set_eap_client_cert_pkcs11_id( | 1089 void set_eap_client_cert_pkcs11_id( |
| 1087 const std::string& eap_client_cert_pkcs11_id) { | 1090 const std::string& eap_client_cert_pkcs11_id) { |
| 1088 eap_client_cert_pkcs11_id_ = eap_client_cert_pkcs11_id; | 1091 eap_client_cert_pkcs11_id_ = eap_client_cert_pkcs11_id; |
| 1089 } | 1092 } |
| 1090 void set_eap_use_system_cas(bool eap_use_system_cas) { | 1093 void set_eap_use_system_cas(bool eap_use_system_cas) { |
| 1091 eap_use_system_cas_ = eap_use_system_cas; | 1094 eap_use_system_cas_ = eap_use_system_cas; |
| 1092 } | 1095 } |
| 1093 void set_eap_identity(const std::string& eap_identity) { | 1096 void set_eap_identity(const std::string& eap_identity) { |
| 1094 eap_identity_ = eap_identity; | 1097 eap_identity_ = eap_identity; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1119 ConnectionSecurity encryption_; | 1122 ConnectionSecurity encryption_; |
| 1120 std::string passphrase_; | 1123 std::string passphrase_; |
| 1121 bool passphrase_required_; | 1124 bool passphrase_required_; |
| 1122 std::string identity_; | 1125 std::string identity_; |
| 1123 bool hidden_ssid_; | 1126 bool hidden_ssid_; |
| 1124 std::string bssid_; | 1127 std::string bssid_; |
| 1125 int frequency_; | 1128 int frequency_; |
| 1126 | 1129 |
| 1127 EAPMethod eap_method_; | 1130 EAPMethod eap_method_; |
| 1128 EAPPhase2Auth eap_phase_2_auth_; | 1131 EAPPhase2Auth eap_phase_2_auth_; |
| 1129 std::string eap_server_ca_cert_nss_nickname_; | 1132 std::string eap_server_ca_cert_fingerprint_; |
| 1130 std::string eap_client_cert_pkcs11_id_; | 1133 std::string eap_client_cert_pkcs11_id_; |
| 1131 bool eap_use_system_cas_; | 1134 bool eap_use_system_cas_; |
| 1132 std::string eap_identity_; | 1135 std::string eap_identity_; |
| 1133 std::string eap_anonymous_identity_; | 1136 std::string eap_anonymous_identity_; |
| 1134 std::string eap_passphrase_; | 1137 std::string eap_passphrase_; |
| 1135 bool eap_save_credentials_; | 1138 bool eap_save_credentials_; |
| 1136 | 1139 |
| 1137 // Internal state (not stored in shill). | 1140 // Internal state (not stored in shill). |
| 1138 // Passphrase set by user (stored for UI). | 1141 // Passphrase set by user (stored for UI). |
| 1139 std::string user_passphrase_; | 1142 std::string user_passphrase_; |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 virtual void ConnectToVirtualNetwork(VirtualNetwork* network) = 0; | 1560 virtual void ConnectToVirtualNetwork(VirtualNetwork* network) = 0; |
| 1558 | 1561 |
| 1559 // Connect to an unconfigured network with given SSID, security, passphrase, | 1562 // Connect to an unconfigured network with given SSID, security, passphrase, |
| 1560 // and optional EAP configuration. If |security| is SECURITY_8021X, | 1563 // and optional EAP configuration. If |security| is SECURITY_8021X, |
| 1561 // |eap_config| must be provided. | 1564 // |eap_config| must be provided. |
| 1562 struct EAPConfigData { | 1565 struct EAPConfigData { |
| 1563 EAPConfigData(); | 1566 EAPConfigData(); |
| 1564 ~EAPConfigData(); | 1567 ~EAPConfigData(); |
| 1565 EAPMethod method; | 1568 EAPMethod method; |
| 1566 EAPPhase2Auth auth; | 1569 EAPPhase2Auth auth; |
| 1567 std::string server_ca_cert_nss_nickname; | 1570 std::string server_ca_cert_fingerprint; |
| 1568 bool use_system_cas; | 1571 bool use_system_cas; |
| 1569 std::string client_cert_pkcs11_id; | 1572 std::string client_cert_pkcs11_id; |
| 1570 std::string identity; | 1573 std::string identity; |
| 1571 std::string anonymous_identity; | 1574 std::string anonymous_identity; |
| 1572 }; | 1575 }; |
| 1573 virtual void ConnectToUnconfiguredWifiNetwork( | 1576 virtual void ConnectToUnconfiguredWifiNetwork( |
| 1574 const std::string& ssid, | 1577 const std::string& ssid, |
| 1575 ConnectionSecurity security, | 1578 ConnectionSecurity security, |
| 1576 const std::string& passphrase, | 1579 const std::string& passphrase, |
| 1577 const EAPConfigData* eap_config, | 1580 const EAPConfigData* eap_config, |
| 1578 bool save_credentials, | 1581 bool save_credentials, |
| 1579 bool shared) = 0; | 1582 bool shared) = 0; |
| 1580 | 1583 |
| 1581 // Connect to the specified virtual network with service name. | 1584 // Connect to the specified virtual network with service name. |
| 1582 // VPNConfigData must be provided. | 1585 // VPNConfigData must be provided. |
| 1583 struct VPNConfigData { | 1586 struct VPNConfigData { |
| 1584 VPNConfigData(); | 1587 VPNConfigData(); |
| 1585 ~VPNConfigData(); | 1588 ~VPNConfigData(); |
| 1586 std::string psk; | 1589 std::string psk; |
| 1587 std::string server_ca_cert_nss_nickname; | 1590 std::string server_ca_cert_fingerprint; |
| 1588 std::string client_cert_pkcs11_id; | 1591 std::string client_cert_pkcs11_id; |
| 1589 std::string username; | 1592 std::string username; |
| 1590 std::string user_passphrase; | 1593 std::string user_passphrase; |
| 1591 std::string otp; | 1594 std::string otp; |
| 1592 std::string group_name; | 1595 std::string group_name; |
| 1593 bool save_credentials; | 1596 bool save_credentials; |
| 1594 }; | 1597 }; |
| 1595 virtual void ConnectToUnconfiguredVirtualNetwork( | 1598 virtual void ConnectToUnconfiguredVirtualNetwork( |
| 1596 const std::string& service_name, | 1599 const std::string& service_name, |
| 1597 const std::string& server_hostname, | 1600 const std::string& server_hostname, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1659 virtual void RequestNetworkServiceProperties( | 1662 virtual void RequestNetworkServiceProperties( |
| 1660 const std::string& service_path, | 1663 const std::string& service_path, |
| 1661 const NetworkServicePropertiesCallback& callback) = 0; | 1664 const NetworkServicePropertiesCallback& callback) = 0; |
| 1662 | 1665 |
| 1663 // This will connect to a preferred network if the currently connected | 1666 // This will connect to a preferred network if the currently connected |
| 1664 // network is not preferred. This should be called when the active profile | 1667 // network is not preferred. This should be called when the active profile |
| 1665 // changes. | 1668 // changes. |
| 1666 virtual void SwitchToPreferredNetwork() = 0; | 1669 virtual void SwitchToPreferredNetwork() = 0; |
| 1667 | 1670 |
| 1668 // Load networks from an NetworkConfigurations list of ONC. | 1671 // Load networks from an NetworkConfigurations list of ONC. |
| 1669 virtual void LoadOncNetworks(const base::ListValue& network_configs, | 1672 virtual void LoadOncNetworks( |
| 1670 onc::ONCSource source) = 0; | 1673 const base::ListValue& network_configs, |
| 1674 onc::ONCSource source, |
| 1675 const base::Callback<std::string(const std::string&)>& |
| 1676 fingerprint_to_pem) = 0; |
| 1671 | 1677 |
| 1672 // This sets the active network for the network type. Note: priority order | 1678 // This sets the active network for the network type. Note: priority order |
| 1673 // is unchanged (i.e. if a wifi network is set to active, but an ethernet | 1679 // is unchanged (i.e. if a wifi network is set to active, but an ethernet |
| 1674 // network is still active, active_network() will still return the ethernet | 1680 // network is still active, active_network() will still return the ethernet |
| 1675 // network). Other networks of the same type will become inactive. | 1681 // network). Other networks of the same type will become inactive. |
| 1676 // Used for testing. | 1682 // Used for testing. |
| 1677 virtual bool SetActiveNetwork(ConnectionType type, | 1683 virtual bool SetActiveNetwork(ConnectionType type, |
| 1678 const std::string& service_path) = 0; | 1684 const std::string& service_path) = 0; |
| 1679 | 1685 |
| 1680 // Factory function, creates a new instance and returns ownership. | 1686 // Factory function, creates a new instance and returns ownership. |
| 1681 // For normal usage, access the singleton via CrosLibrary::Get(). | 1687 // For normal usage, access the singleton via CrosLibrary::Get(). |
| 1682 static NetworkLibrary* GetImpl(bool stub); | 1688 static NetworkLibrary* GetImpl(bool stub); |
| 1683 }; | 1689 }; |
| 1684 | 1690 |
| 1685 } // namespace chromeos | 1691 } // namespace chromeos |
| 1686 | 1692 |
| 1687 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ | 1693 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ |
| OLD | NEW |