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 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 layout->StartRow(0, column_view_set_id); | 541 layout->StartRow(0, column_view_set_id); |
542 layout->AddView(new views::Label(l10n_util::GetStringUTF16( | 542 layout->AddView(new views::Label(l10n_util::GetStringUTF16( |
543 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVICE_NAME))); | 543 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVICE_NAME))); |
544 if (!vpn) { | 544 if (!vpn) { |
545 service_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); | 545 service_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); |
546 service_textfield_->SetController(this); | 546 service_textfield_->SetController(this); |
547 layout->AddView(service_textfield_); | 547 layout->AddView(service_textfield_); |
548 service_text_ = NULL; | 548 service_text_ = NULL; |
549 } else { | 549 } else { |
550 service_text_ = new views::Label(ASCIIToUTF16(vpn->name())); | 550 service_text_ = new views::Label(ASCIIToUTF16(vpn->name())); |
551 service_text_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 551 service_text_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
552 layout->AddView(service_text_); | 552 layout->AddView(service_text_); |
553 service_textfield_ = NULL; | 553 service_textfield_ = NULL; |
554 } | 554 } |
555 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 555 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
556 | 556 |
557 // Provider type label and select. | 557 // Provider type label and select. |
558 layout->StartRow(0, column_view_set_id); | 558 layout->StartRow(0, column_view_set_id); |
559 layout->AddView(new views::Label(l10n_util::GetStringUTF16( | 559 layout->AddView(new views::Label(l10n_util::GetStringUTF16( |
560 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PROVIDER_TYPE))); | 560 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PROVIDER_TYPE))); |
561 if (!vpn) { | 561 if (!vpn) { |
562 provider_type_combobox_model_.reset( | 562 provider_type_combobox_model_.reset( |
563 new internal::ProviderTypeComboboxModel); | 563 new internal::ProviderTypeComboboxModel); |
564 provider_type_combobox_ = new views::Combobox( | 564 provider_type_combobox_ = new views::Combobox( |
565 provider_type_combobox_model_.get()); | 565 provider_type_combobox_model_.get()); |
566 provider_type_combobox_->set_listener(this); | 566 provider_type_combobox_->set_listener(this); |
567 layout->AddView(provider_type_combobox_); | 567 layout->AddView(provider_type_combobox_); |
568 provider_type_text_label_ = NULL; | 568 provider_type_text_label_ = NULL; |
569 } else { | 569 } else { |
570 provider_type_text_label_ = | 570 provider_type_text_label_ = |
571 new views::Label(ProviderTypeToString(provider_type_)); | 571 new views::Label(ProviderTypeToString(provider_type_)); |
572 provider_type_text_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 572 provider_type_text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
573 layout->AddView(provider_type_text_label_); | 573 layout->AddView(provider_type_text_label_); |
574 provider_type_combobox_ = NULL; | 574 provider_type_combobox_ = NULL; |
575 } | 575 } |
576 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 576 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
577 | 577 |
578 // PSK passphrase label, input and visible button. | 578 // PSK passphrase label, input and visible button. |
579 if (enable_psk_passphrase_) { | 579 if (enable_psk_passphrase_) { |
580 layout->StartRow(0, column_view_set_id); | 580 layout->StartRow(0, column_view_set_id); |
581 psk_passphrase_label_ = new views::Label(l10n_util::GetStringUTF16( | 581 psk_passphrase_label_ = new views::Label(l10n_util::GetStringUTF16( |
582 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PSK_PASSPHRASE)); | 582 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PSK_PASSPHRASE)); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 save_credentials_checkbox_->SetChecked(save_credentials); | 705 save_credentials_checkbox_->SetChecked(save_credentials); |
706 layout->SkipColumns(1); | 706 layout->SkipColumns(1); |
707 layout->AddView(save_credentials_checkbox_); | 707 layout->AddView(save_credentials_checkbox_); |
708 layout->AddView( | 708 layout->AddView( |
709 new ControlledSettingIndicatorView(save_credentials_ui_data_)); | 709 new ControlledSettingIndicatorView(save_credentials_ui_data_)); |
710 | 710 |
711 // Error label. | 711 // Error label. |
712 layout->StartRow(0, column_view_set_id); | 712 layout->StartRow(0, column_view_set_id); |
713 layout->SkipColumns(1); | 713 layout->SkipColumns(1); |
714 error_label_ = new views::Label(); | 714 error_label_ = new views::Label(); |
715 error_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 715 error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
716 error_label_->SetEnabledColor(SK_ColorRED); | 716 error_label_->SetEnabledColor(SK_ColorRED); |
717 layout->AddView(error_label_); | 717 layout->AddView(error_label_); |
718 | 718 |
719 // Set or hide the UI, update comboboxes and error labels. | 719 // Set or hide the UI, update comboboxes and error labels. |
720 Refresh(); | 720 Refresh(); |
721 } | 721 } |
722 | 722 |
723 void VPNConfigView::Refresh() { | 723 void VPNConfigView::Refresh() { |
724 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); | 724 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); |
725 | 725 |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 NetworkLibrary* network_library = CrosLibrary::Get()->GetNetworkLibrary(); | 909 NetworkLibrary* network_library = CrosLibrary::Get()->GetNetworkLibrary(); |
910 const base::DictionaryValue* onc = | 910 const base::DictionaryValue* onc = |
911 network_library->FindOncForNetwork(network->unique_id()); | 911 network_library->FindOncForNetwork(network->unique_id()); |
912 | 912 |
913 property_ui_data->ParseOncProperty( | 913 property_ui_data->ParseOncProperty( |
914 network->ui_data(), onc, | 914 network->ui_data(), onc, |
915 base::StringPrintf("%s.%s.%s", onc::kVPN, dict_key.c_str(), key.c_str())); | 915 base::StringPrintf("%s.%s.%s", onc::kVPN, dict_key.c_str(), key.c_str())); |
916 } | 916 } |
917 | 917 |
918 } // namespace chromeos | 918 } // namespace chromeos |
OLD | NEW |