Index: chrome/browser/chromeos/options/vpn_config_view.h |
diff --git a/chrome/browser/chromeos/options/vpn_config_view.h b/chrome/browser/chromeos/options/vpn_config_view.h |
index cb5f7cec1a82a5c9eced12ca6ae6a8415362d8bf..24c1a5ae5b284678a842e734cd00995172847595 100644 |
--- a/chrome/browser/chromeos/options/vpn_config_view.h |
+++ b/chrome/browser/chromeos/options/vpn_config_view.h |
@@ -18,13 +18,20 @@ |
#include "ui/views/controls/textfield/textfield_controller.h" |
#include "ui/views/view.h" |
+namespace base { |
+class DictionaryValue; |
+} |
+ |
namespace views { |
class Checkbox; |
+class GridLayout; |
class Label; |
} |
namespace chromeos { |
+class NetworkState; |
+ |
namespace internal { |
class ProviderTypeComboboxModel; |
class VpnServerCACertComboboxModel; |
@@ -38,8 +45,7 @@ class VPNConfigView : public ChildNetworkConfigView, |
public views::ComboboxListener, |
public CertLibrary::Observer { |
public: |
- VPNConfigView(NetworkConfigView* parent, VirtualNetwork* vpn); |
- explicit VPNConfigView(NetworkConfigView* parent); |
+ VPNConfigView(NetworkConfigView* parent, const std::string& service_path); |
virtual ~VPNConfigView(); |
// views::TextfieldController: |
@@ -68,7 +74,17 @@ class VPNConfigView : public ChildNetworkConfigView, |
private: |
// Initializes data members and create UI controls. |
- void Init(VirtualNetwork* vpn); |
+ void Init(); |
+ |
+ // Callback to initialize fields from uncached network properties. |
+ void InitFromProperties(const std::string& service_path, |
+ const base::DictionaryValue& dictionary); |
+ void ParseUIProperties(const NetworkState* vpn); |
+ void GetPropertiesError(const std::string& error_name, |
+ scoped_ptr<base::DictionaryValue> error_data); |
+ |
+ // Helper function to set configurable properties. |
+ void SetConfigProperties(base::DictionaryValue* properties); |
// Set and update all control values. |
void Refresh(); |
@@ -81,9 +97,6 @@ class VPNConfigView : public ChildNetworkConfigView, |
// Update state of the Login button. |
void UpdateCanLogin(); |
- // Returns true if the provider type requires a user certificate. |
- bool UserCertRequired() const; |
- |
// Returns true if there is at least one user certificate installed. |
bool HaveUserCerts() const; |
@@ -109,22 +122,21 @@ class VPNConfigView : public ChildNetworkConfigView, |
const std::string GetServerCACertPEM() const; |
const std::string GetUserCertID() const; |
bool GetSaveCredentials() const; |
+ int GetProviderTypeIndex() const; |
+ std::string GetProviderTypeString() const; |
// Parses a VPN UI |property| from the given |network|. |key| is the property |
// name within the type-specific VPN subdictionary named |dict_key|. |
- void ParseVPNUIProperty(NetworkPropertyUIData* property_ui_data, |
- Network* network, |
+ void ParseVPNUIProperty(const NetworkState* network, |
const std::string& dict_key, |
- const std::string& key); |
+ const std::string& key, |
+ NetworkPropertyUIData* property_ui_data); |
- std::string server_hostname_; |
string16 service_name_from_server_; |
bool service_text_modified_; |
// Initialized in Init(): |
- ProviderType provider_type_; |
- |
bool enable_psk_passphrase_; |
bool enable_user_cert_; |
bool enable_server_ca_cert_; |
@@ -141,6 +153,7 @@ class VPNConfigView : public ChildNetworkConfigView, |
int title_; |
+ views::GridLayout* layout_; |
views::Textfield* server_textfield_; |
views::Label* service_text_; |
views::Textfield* service_textfield_; |
@@ -165,6 +178,13 @@ class VPNConfigView : public ChildNetworkConfigView, |
views::Checkbox* save_credentials_checkbox_; |
views::Label* error_label_; |
+ // Cached VPN properties, only set when configuring an existing network. |
+ int provider_type_index_; |
+ std::string ca_cert_pem_; |
+ std::string client_cert_id_; |
+ |
+ base::WeakPtrFactory<VPNConfigView> weak_ptr_factory_; |
+ |
DISALLOW_COPY_AND_ASSIGN(VPNConfigView); |
}; |