| 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 #include "chrome/browser/chromeos/options/vpn_config_view.h" | 5 #include "chrome/browser/chromeos/options/vpn_config_view.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 return l10n_util::GetStringUTF16( | 188 return l10n_util::GetStringUTF16( |
| 189 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_USER_CERT_NONE_INSTALLED); | 189 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_USER_CERT_NONE_INSTALLED); |
| 190 } | 190 } |
| 191 return CertLibrary::Get()->GetCertDisplayStringAt( | 191 return CertLibrary::Get()->GetCertDisplayStringAt( |
| 192 CertLibrary::CERT_TYPE_USER, index); | 192 CertLibrary::CERT_TYPE_USER, index); |
| 193 } | 193 } |
| 194 | 194 |
| 195 } // namespace internal | 195 } // namespace internal |
| 196 | 196 |
| 197 VPNConfigView::VPNConfigView(NetworkConfigView* parent, VirtualNetwork* vpn) | 197 VPNConfigView::VPNConfigView(NetworkConfigView* parent, VirtualNetwork* vpn) |
| 198 : ChildNetworkConfigView(parent, vpn) { | 198 : ChildNetworkConfigView(parent, vpn), |
| 199 title_(0) { |
| 199 Init(vpn); | 200 Init(vpn); |
| 200 } | 201 } |
| 201 | 202 |
| 202 VPNConfigView::VPNConfigView(NetworkConfigView* parent) | 203 VPNConfigView::VPNConfigView(NetworkConfigView* parent) |
| 203 : ChildNetworkConfigView(parent) { | 204 : ChildNetworkConfigView(parent), |
| 205 title_(0) { |
| 204 Init(NULL); | 206 Init(NULL); |
| 205 } | 207 } |
| 206 | 208 |
| 207 VPNConfigView::~VPNConfigView() { | 209 VPNConfigView::~VPNConfigView() { |
| 208 CertLibrary::Get()->RemoveObserver(this); | 210 CertLibrary::Get()->RemoveObserver(this); |
| 209 } | 211 } |
| 210 | 212 |
| 213 string16 VPNConfigView::GetTitle() const { |
| 214 DCHECK_NE(title_, 0); |
| 215 return l10n_util::GetStringUTF16(title_); |
| 216 } |
| 217 |
| 211 views::View* VPNConfigView::GetInitiallyFocusedView() { | 218 views::View* VPNConfigView::GetInitiallyFocusedView() { |
| 212 // Put focus in the first editable field. | 219 // Put focus in the first editable field. |
| 213 if (server_textfield_) | 220 if (server_textfield_) |
| 214 return server_textfield_; | 221 return server_textfield_; |
| 215 else if (service_textfield_) | 222 else if (service_textfield_) |
| 216 return service_textfield_; | 223 return service_textfield_; |
| 217 else if (provider_type_combobox_) | 224 else if (provider_type_combobox_) |
| 218 return provider_type_combobox_; | 225 return provider_type_combobox_; |
| 219 else if (psk_passphrase_textfield_ && psk_passphrase_textfield_->enabled()) | 226 else if (psk_passphrase_textfield_ && psk_passphrase_textfield_->enabled()) |
| 220 return psk_passphrase_textfield_; | 227 return psk_passphrase_textfield_; |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 // Set the default provider type. | 505 // Set the default provider type. |
| 499 provider_type_ = PROVIDER_TYPE_L2TP_IPSEC_PSK; | 506 provider_type_ = PROVIDER_TYPE_L2TP_IPSEC_PSK; |
| 500 // Provider Type is user selectable, so enable all controls during init. | 507 // Provider Type is user selectable, so enable all controls during init. |
| 501 enable_psk_passphrase_ = true; | 508 enable_psk_passphrase_ = true; |
| 502 enable_user_cert_ = true; | 509 enable_user_cert_ = true; |
| 503 enable_server_ca_cert_ = true; | 510 enable_server_ca_cert_ = true; |
| 504 enable_otp_ = true; | 511 enable_otp_ = true; |
| 505 enable_group_name_ = true; | 512 enable_group_name_ = true; |
| 506 } | 513 } |
| 507 | 514 |
| 508 // Title | 515 // Initialize the title string ID used for the dialog. |
| 509 layout->StartRow(0, column_view_set_id); | 516 title_ = vpn ? IDS_OPTIONS_SETTINGS_JOIN_VPN : IDS_OPTIONS_SETTINGS_ADD_VPN; |
| 510 views::Label* title = new views::Label(l10n_util::GetStringUTF16( | |
| 511 vpn ? IDS_OPTIONS_SETTINGS_JOIN_VPN : IDS_OPTIONS_SETTINGS_ADD_VPN)); | |
| 512 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | |
| 513 title->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); | |
| 514 layout->AddView(title, 5, 1); | |
| 515 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); | |
| 516 | 517 |
| 517 // Server label and input. | 518 // Server label and input. |
| 518 // Only provide Server name when configuring a new VPN. | 519 // Only provide Server name when configuring a new VPN. |
| 519 if (!vpn) { | 520 if (!vpn) { |
| 520 layout->StartRow(0, column_view_set_id); | 521 layout->StartRow(0, column_view_set_id); |
| 521 layout->AddView(new views::Label(l10n_util::GetStringUTF16( | 522 layout->AddView(new views::Label(l10n_util::GetStringUTF16( |
| 522 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVER_HOSTNAME))); | 523 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVER_HOSTNAME))); |
| 523 server_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); | 524 server_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); |
| 524 server_textfield_->SetController(this); | 525 server_textfield_->SetController(this); |
| 525 layout->AddView(server_textfield_); | 526 layout->AddView(server_textfield_); |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 901 | 902 |
| 902 property_ui_data->ParseOncProperty( | 903 property_ui_data->ParseOncProperty( |
| 903 network->ui_data().onc_source(), onc, | 904 network->ui_data().onc_source(), onc, |
| 904 base::StringPrintf("%s.%s.%s", | 905 base::StringPrintf("%s.%s.%s", |
| 905 onc::network_config::kVPN, | 906 onc::network_config::kVPN, |
| 906 dict_key.c_str(), | 907 dict_key.c_str(), |
| 907 key.c_str())); | 908 key.c_str())); |
| 908 } | 909 } |
| 909 | 910 |
| 910 } // namespace chromeos | 911 } // namespace chromeos |
| OLD | NEW |