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_OPTIONS_VPN_CONFIG_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_OPTIONS_VPN_CONFIG_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_VPN_CONFIG_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_VPN_CONFIG_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "chrome/browser/chromeos/options/cert_library.h" | 12 #include "chrome/browser/chromeos/options/cert_library.h" |
13 #include "chrome/browser/chromeos/options/network_config_view.h" | 13 #include "chrome/browser/chromeos/options/network_config_view.h" |
14 #include "chrome/browser/chromeos/options/network_property_ui_data.h" | 14 #include "chrome/browser/chromeos/options/network_property_ui_data.h" |
15 #include "chrome/browser/chromeos/options/passphrase_textfield.h" | 15 #include "chrome/browser/chromeos/options/passphrase_textfield.h" |
| 16 #include "chromeos/network/client_cert_util.h" |
16 #include "ui/views/controls/button/button.h" | 17 #include "ui/views/controls/button/button.h" |
17 #include "ui/views/controls/combobox/combobox_listener.h" | 18 #include "ui/views/controls/combobox/combobox_listener.h" |
18 #include "ui/views/controls/textfield/textfield_controller.h" | 19 #include "ui/views/controls/textfield/textfield_controller.h" |
19 #include "ui/views/view.h" | 20 #include "ui/views/view.h" |
20 | 21 |
21 namespace base { | 22 namespace base { |
22 class DictionaryValue; | 23 class DictionaryValue; |
23 } | 24 } |
24 | 25 |
25 namespace views { | 26 namespace views { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // Initializes data members and create UI controls. | 77 // Initializes data members and create UI controls. |
77 void Init(); | 78 void Init(); |
78 | 79 |
79 // Callback to initialize fields from uncached network properties. | 80 // Callback to initialize fields from uncached network properties. |
80 void InitFromProperties(const std::string& service_path, | 81 void InitFromProperties(const std::string& service_path, |
81 const base::DictionaryValue& dictionary); | 82 const base::DictionaryValue& dictionary); |
82 void ParseUIProperties(const NetworkState* vpn); | 83 void ParseUIProperties(const NetworkState* vpn); |
83 void GetPropertiesError(const std::string& error_name, | 84 void GetPropertiesError(const std::string& error_name, |
84 scoped_ptr<base::DictionaryValue> error_data); | 85 scoped_ptr<base::DictionaryValue> error_data); |
85 | 86 |
| 87 // Fill in |properties| with the properties for the selected client (user) |
| 88 // certificate or empty properties if no client cert is required. |
| 89 void SetUserCertProperties(chromeos::client_cert::ConfigType client_cert_type, |
| 90 base::DictionaryValue* properties) const; |
| 91 |
86 // Helper function to set configurable properties. | 92 // Helper function to set configurable properties. |
87 void SetConfigProperties(base::DictionaryValue* properties); | 93 void SetConfigProperties(base::DictionaryValue* properties); |
88 | 94 |
89 // Set and update all control values. | 95 // Set and update all control values. |
90 void Refresh(); | 96 void Refresh(); |
91 | 97 |
92 // Update various controls. | 98 // Update various controls. |
93 void UpdateControlsToEnable(); | 99 void UpdateControlsToEnable(); |
94 void UpdateControls(); | 100 void UpdateControls(); |
95 void UpdateErrorLabel(); | 101 void UpdateErrorLabel(); |
(...skipping 17 matching lines...) Expand all Loading... |
113 | 119 |
114 // Convenience methods to get text from input field or cached VirtualNetwork. | 120 // Convenience methods to get text from input field or cached VirtualNetwork. |
115 const std::string GetService() const; | 121 const std::string GetService() const; |
116 const std::string GetServer() const; | 122 const std::string GetServer() const; |
117 const std::string GetPSKPassphrase() const; | 123 const std::string GetPSKPassphrase() const; |
118 const std::string GetUsername() const; | 124 const std::string GetUsername() const; |
119 const std::string GetUserPassphrase() const; | 125 const std::string GetUserPassphrase() const; |
120 const std::string GetOTP() const; | 126 const std::string GetOTP() const; |
121 const std::string GetGroupName() const; | 127 const std::string GetGroupName() const; |
122 const std::string GetServerCACertPEM() const; | 128 const std::string GetServerCACertPEM() const; |
123 const std::string GetUserCertID() const; | |
124 bool GetSaveCredentials() const; | 129 bool GetSaveCredentials() const; |
125 int GetProviderTypeIndex() const; | 130 int GetProviderTypeIndex() const; |
126 std::string GetProviderTypeString() const; | 131 std::string GetProviderTypeString() const; |
127 | 132 |
128 // Parses a VPN UI |property| from the given |network|. |key| is the property | 133 // Parses a VPN UI |property| from the given |network|. |key| is the property |
129 // name within the type-specific VPN subdictionary named |dict_key|. | 134 // name within the type-specific VPN subdictionary named |dict_key|. |
130 void ParseVPNUIProperty(const NetworkState* network, | 135 void ParseVPNUIProperty(const NetworkState* network, |
131 const std::string& dict_key, | 136 const std::string& dict_key, |
132 const std::string& key, | 137 const std::string& key, |
133 NetworkPropertyUIData* property_ui_data); | 138 NetworkPropertyUIData* property_ui_data); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 std::string client_cert_id_; | 189 std::string client_cert_id_; |
185 | 190 |
186 base::WeakPtrFactory<VPNConfigView> weak_ptr_factory_; | 191 base::WeakPtrFactory<VPNConfigView> weak_ptr_factory_; |
187 | 192 |
188 DISALLOW_COPY_AND_ASSIGN(VPNConfigView); | 193 DISALLOW_COPY_AND_ASSIGN(VPNConfigView); |
189 }; | 194 }; |
190 | 195 |
191 } // namespace chromeos | 196 } // namespace chromeos |
192 | 197 |
193 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_VPN_CONFIG_VIEW_H_ | 198 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_VPN_CONFIG_VIEW_H_ |
OLD | NEW |