| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/wifi_config_view.h" | 5 #include "chrome/browser/chromeos/options/wifi_config_view.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/chromeos/cros/cros_library.h" | 9 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 10 #include "chrome/browser/chromeos/cros/network_library.h" | 10 #include "chrome/browser/chromeos/cros/network_library.h" |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 } | 365 } |
| 366 | 366 |
| 367 void WifiConfigView::RefreshEapFields() { | 367 void WifiConfigView::RefreshEapFields() { |
| 368 DCHECK(cert_library_); | 368 DCHECK(cert_library_); |
| 369 int selected = eap_method_combobox_->selected_item(); | 369 int selected = eap_method_combobox_->selected_item(); |
| 370 | 370 |
| 371 // If EAP method changes, the phase 2 auth choices may have changed also. | 371 // If EAP method changes, the phase 2 auth choices may have changed also. |
| 372 phase_2_auth_combobox_->ModelChanged(); | 372 phase_2_auth_combobox_->ModelChanged(); |
| 373 phase_2_auth_combobox_->SetSelectedItem(0); | 373 phase_2_auth_combobox_->SetSelectedItem(0); |
| 374 phase_2_auth_combobox_->SetEnabled( | 374 phase_2_auth_combobox_->SetEnabled( |
| 375 phase_2_auth_combobox_->model()->GetItemCount() > 1); | 375 phase_2_auth_combobox_->model()->GetItemCount() > 1 && |
| 376 phase_2_auth_ui_data_.editable()); |
| 376 phase_2_auth_label_->SetEnabled(phase_2_auth_combobox_->IsEnabled()); | 377 phase_2_auth_label_->SetEnabled(phase_2_auth_combobox_->IsEnabled()); |
| 377 | 378 |
| 378 // No password for EAP-TLS | 379 // No password for EAP-TLS |
| 379 passphrase_textfield_->SetEnabled(selected != EAP_METHOD_INDEX_NONE && | 380 passphrase_textfield_->SetEnabled(selected != EAP_METHOD_INDEX_NONE && |
| 380 selected != EAP_METHOD_INDEX_TLS); | 381 selected != EAP_METHOD_INDEX_TLS && |
| 382 passphrase_ui_data_.editable()); |
| 381 passphrase_label_->SetEnabled(passphrase_textfield_->IsEnabled()); | 383 passphrase_label_->SetEnabled(passphrase_textfield_->IsEnabled()); |
| 382 if (!passphrase_textfield_->IsEnabled()) | 384 if (!passphrase_textfield_->IsEnabled()) |
| 383 passphrase_textfield_->SetText(string16()); | 385 passphrase_textfield_->SetText(string16()); |
| 384 | 386 |
| 385 // User certs only for EAP-TLS | 387 // User certs only for EAP-TLS |
| 386 bool certs_loading = !cert_library_->CertificatesLoaded(); | 388 bool certs_loading = !cert_library_->CertificatesLoaded(); |
| 387 bool user_cert_enabled = (selected == EAP_METHOD_INDEX_TLS); | 389 bool user_cert_enabled = (selected == EAP_METHOD_INDEX_TLS); |
| 388 user_cert_label_->SetEnabled(user_cert_enabled); | 390 user_cert_label_->SetEnabled(user_cert_enabled); |
| 389 bool have_user_certs = !certs_loading && HaveUserCerts(); | 391 bool have_user_certs = !certs_loading && HaveUserCerts(); |
| 390 user_cert_combobox_->SetEnabled(user_cert_enabled && have_user_certs); | 392 user_cert_combobox_->SetEnabled(user_cert_enabled && |
| 393 have_user_certs && |
| 394 user_cert_ui_data_.editable()); |
| 391 user_cert_combobox_->ModelChanged(); | 395 user_cert_combobox_->ModelChanged(); |
| 392 user_cert_combobox_->SetSelectedItem(0); | 396 user_cert_combobox_->SetSelectedItem(0); |
| 393 | 397 |
| 394 // No server CA certs for LEAP | 398 // No server CA certs for LEAP |
| 395 bool ca_cert_enabled = | 399 bool ca_cert_enabled = |
| 396 (selected != EAP_METHOD_INDEX_NONE && selected != EAP_METHOD_INDEX_LEAP); | 400 (selected != EAP_METHOD_INDEX_NONE && selected != EAP_METHOD_INDEX_LEAP); |
| 397 server_ca_cert_label_->SetEnabled(ca_cert_enabled); | 401 server_ca_cert_label_->SetEnabled(ca_cert_enabled); |
| 398 server_ca_cert_combobox_->SetEnabled(ca_cert_enabled && !certs_loading); | 402 server_ca_cert_combobox_->SetEnabled(ca_cert_enabled && |
| 403 !certs_loading && |
| 404 server_ca_cert_ui_data_.editable()); |
| 399 server_ca_cert_combobox_->ModelChanged(); | 405 server_ca_cert_combobox_->ModelChanged(); |
| 400 server_ca_cert_combobox_->SetSelectedItem(0); | 406 server_ca_cert_combobox_->SetSelectedItem(0); |
| 401 | 407 |
| 402 // No anonymous identity if no phase 2 auth. | 408 // No anonymous identity if no phase 2 auth. |
| 403 identity_anonymous_textfield_->SetEnabled( | 409 identity_anonymous_textfield_->SetEnabled( |
| 404 phase_2_auth_combobox_->IsEnabled()); | 410 phase_2_auth_combobox_->IsEnabled() && |
| 411 identity_anonymous_ui_data_.editable()); |
| 405 identity_anonymous_label_->SetEnabled( | 412 identity_anonymous_label_->SetEnabled( |
| 406 identity_anonymous_textfield_->IsEnabled()); | 413 identity_anonymous_textfield_->IsEnabled()); |
| 407 if (!identity_anonymous_textfield_->IsEnabled()) | 414 if (!identity_anonymous_textfield_->IsEnabled()) |
| 408 identity_anonymous_textfield_->SetText(string16()); | 415 identity_anonymous_textfield_->SetText(string16()); |
| 409 | 416 |
| 410 RefreshShareCheckbox(); | 417 RefreshShareCheckbox(); |
| 411 } | 418 } |
| 412 | 419 |
| 413 void WifiConfigView::RefreshShareCheckbox() { | 420 void WifiConfigView::RefreshShareCheckbox() { |
| 414 if (!share_network_checkbox_) | 421 if (!share_network_checkbox_) |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 void WifiConfigView::Cancel() { | 741 void WifiConfigView::Cancel() { |
| 735 } | 742 } |
| 736 | 743 |
| 737 // This will initialize the view depending on if we have a wifi network or not. | 744 // This will initialize the view depending on if we have a wifi network or not. |
| 738 // And if we are doing simple password encryption or the more complicated | 745 // And if we are doing simple password encryption or the more complicated |
| 739 // 802.1x encryption. | 746 // 802.1x encryption. |
| 740 // If we are creating the "Join other network..." dialog, we will allow user | 747 // If we are creating the "Join other network..." dialog, we will allow user |
| 741 // to enter the data. And if they select the 802.1x encryption, we will show | 748 // to enter the data. And if they select the 802.1x encryption, we will show |
| 742 // the 802.1x fields. | 749 // the 802.1x fields. |
| 743 void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { | 750 void WifiConfigView::Init(WifiNetwork* wifi, bool show_8021x) { |
| 751 if (wifi) { |
| 752 eap_method_ui_data_.UpdateFromNetwork( |
| 753 wifi, NetworkUIData::kPropertyEAPMethod); |
| 754 phase_2_auth_ui_data_.UpdateFromNetwork( |
| 755 wifi, NetworkUIData::kPropertyEAPPhase2Auth); |
| 756 user_cert_ui_data_.UpdateFromNetwork( |
| 757 wifi, NetworkUIData::kPropertyEAPClientCertPkcs11Id); |
| 758 server_ca_cert_ui_data_.UpdateFromNetwork( |
| 759 wifi, NetworkUIData::kPropertyEAPServerCaCertNssNickname); |
| 760 if (server_ca_cert_ui_data_.managed()) { |
| 761 server_ca_cert_ui_data_.UpdateFromNetwork( |
| 762 wifi, NetworkUIData::kPropertyEAPUseSystemCAs); |
| 763 } |
| 764 identity_ui_data_.UpdateFromNetwork( |
| 765 wifi, NetworkUIData::kPropertyEAPIdentity); |
| 766 identity_anonymous_ui_data_.UpdateFromNetwork( |
| 767 wifi, NetworkUIData::kPropertyEAPAnonymousIdentity); |
| 768 save_credentials_ui_data_.UpdateFromNetwork( |
| 769 wifi, NetworkUIData::kPropertySaveCredentials); |
| 770 if (show_8021x) { |
| 771 passphrase_ui_data_.UpdateFromNetwork( |
| 772 wifi, NetworkUIData::kPropertyEAPPassphrase); |
| 773 } else { |
| 774 passphrase_ui_data_.UpdateFromNetwork( |
| 775 wifi, NetworkUIData::kPropertyPassphrase); |
| 776 } |
| 777 } |
| 778 |
| 744 views::GridLayout* layout = views::GridLayout::CreatePanel(this); | 779 views::GridLayout* layout = views::GridLayout::CreatePanel(this); |
| 745 SetLayoutManager(layout); | 780 SetLayoutManager(layout); |
| 746 | 781 |
| 747 int column_view_set_id = 0; | 782 int column_view_set_id = 0; |
| 748 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id); | 783 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id); |
| 749 const int kPasswordVisibleWidth = 20; | 784 const int kPasswordVisibleWidth = 20; |
| 750 // Label | 785 // Label |
| 751 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1, | 786 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1, |
| 752 views::GridLayout::USE_PREF, 0, 0); | 787 views::GridLayout::USE_PREF, 0, 0); |
| 753 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); | 788 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); |
| 754 // Textfield, combobox. | 789 // Textfield, combobox. |
| 755 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, | 790 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, |
| 756 views::GridLayout::USE_PREF, 0, | 791 views::GridLayout::USE_PREF, 0, |
| 757 ChildNetworkConfigView::kInputFieldMinWidth); | 792 ChildNetworkConfigView::kInputFieldMinWidth); |
| 758 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); | 793 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); |
| 759 // Password visible button | 794 // Password visible button / policy indicator. |
| 760 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 1, | 795 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 1, |
| 761 views::GridLayout::USE_PREF, 0, kPasswordVisibleWidth); | 796 views::GridLayout::USE_PREF, 0, kPasswordVisibleWidth); |
| 762 | 797 |
| 763 // SSID input | 798 // SSID input |
| 764 layout->StartRow(0, column_view_set_id); | 799 layout->StartRow(0, column_view_set_id); |
| 765 layout->AddView(new views::Label(l10n_util::GetStringUTF16( | 800 layout->AddView(new views::Label(l10n_util::GetStringUTF16( |
| 766 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID))); | 801 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID))); |
| 767 if (!wifi) { | 802 if (!wifi) { |
| 768 ssid_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); | 803 ssid_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); |
| 769 ssid_textfield_->SetController(this); | 804 ssid_textfield_->SetController(this); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 795 // Setup a callback if certificates are yet to be loaded, | 830 // Setup a callback if certificates are yet to be loaded, |
| 796 if (!cert_library_->CertificatesLoaded()) | 831 if (!cert_library_->CertificatesLoaded()) |
| 797 cert_library_->AddObserver(this); | 832 cert_library_->AddObserver(this); |
| 798 | 833 |
| 799 // EAP method | 834 // EAP method |
| 800 layout->StartRow(0, column_view_set_id); | 835 layout->StartRow(0, column_view_set_id); |
| 801 layout->AddView(new views::Label(l10n_util::GetStringUTF16( | 836 layout->AddView(new views::Label(l10n_util::GetStringUTF16( |
| 802 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD))); | 837 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD))); |
| 803 eap_method_combobox_ = new views::Combobox(new EAPMethodComboboxModel()); | 838 eap_method_combobox_ = new views::Combobox(new EAPMethodComboboxModel()); |
| 804 eap_method_combobox_->set_listener(this); | 839 eap_method_combobox_->set_listener(this); |
| 840 eap_method_combobox_->SetEnabled(eap_method_ui_data_.editable()); |
| 805 layout->AddView(eap_method_combobox_); | 841 layout->AddView(eap_method_combobox_); |
| 842 layout->AddView(new ControlledSettingIndicatorView(eap_method_ui_data_)); |
| 806 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 843 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 807 | 844 |
| 808 // Phase 2 authentication | 845 // Phase 2 authentication |
| 809 layout->StartRow(0, column_view_set_id); | 846 layout->StartRow(0, column_view_set_id); |
| 810 phase_2_auth_label_ = new views::Label(l10n_util::GetStringUTF16( | 847 phase_2_auth_label_ = new views::Label(l10n_util::GetStringUTF16( |
| 811 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH)); | 848 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH)); |
| 812 layout->AddView(phase_2_auth_label_); | 849 layout->AddView(phase_2_auth_label_); |
| 813 phase_2_auth_combobox_ = new views::Combobox( | 850 phase_2_auth_combobox_ = new views::Combobox( |
| 814 new Phase2AuthComboboxModel(eap_method_combobox_)); | 851 new Phase2AuthComboboxModel(eap_method_combobox_)); |
| 815 phase_2_auth_label_->SetEnabled(false); | 852 phase_2_auth_label_->SetEnabled(false); |
| 816 phase_2_auth_combobox_->SetEnabled(false); | 853 phase_2_auth_combobox_->SetEnabled(false); |
| 817 phase_2_auth_combobox_->set_listener(this); | 854 phase_2_auth_combobox_->set_listener(this); |
| 818 layout->AddView(phase_2_auth_combobox_); | 855 layout->AddView(phase_2_auth_combobox_); |
| 856 layout->AddView(new ControlledSettingIndicatorView(phase_2_auth_ui_data_)); |
| 819 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 857 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 820 | 858 |
| 821 // Server CA certificate | 859 // Server CA certificate |
| 822 layout->StartRow(0, column_view_set_id); | 860 layout->StartRow(0, column_view_set_id); |
| 823 server_ca_cert_label_ = new views::Label(l10n_util::GetStringUTF16( | 861 server_ca_cert_label_ = new views::Label(l10n_util::GetStringUTF16( |
| 824 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA)); | 862 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA)); |
| 825 layout->AddView(server_ca_cert_label_); | 863 layout->AddView(server_ca_cert_label_); |
| 826 server_ca_cert_combobox_ = new ComboboxWithWidth( | 864 server_ca_cert_combobox_ = new ComboboxWithWidth( |
| 827 new ServerCACertComboboxModel(cert_library_), | 865 new ServerCACertComboboxModel(cert_library_), |
| 828 ChildNetworkConfigView::kInputFieldMinWidth); | 866 ChildNetworkConfigView::kInputFieldMinWidth); |
| 829 server_ca_cert_label_->SetEnabled(false); | 867 server_ca_cert_label_->SetEnabled(false); |
| 830 server_ca_cert_combobox_->SetEnabled(false); | 868 server_ca_cert_combobox_->SetEnabled(false); |
| 831 server_ca_cert_combobox_->set_listener(this); | 869 server_ca_cert_combobox_->set_listener(this); |
| 832 layout->AddView(server_ca_cert_combobox_); | 870 layout->AddView(server_ca_cert_combobox_); |
| 871 layout->AddView( |
| 872 new ControlledSettingIndicatorView(server_ca_cert_ui_data_)); |
| 833 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 873 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 834 | 874 |
| 835 // User certificate | 875 // User certificate |
| 836 layout->StartRow(0, column_view_set_id); | 876 layout->StartRow(0, column_view_set_id); |
| 837 user_cert_label_ = new views::Label(l10n_util::GetStringUTF16( | 877 user_cert_label_ = new views::Label(l10n_util::GetStringUTF16( |
| 838 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT)); | 878 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT)); |
| 839 layout->AddView(user_cert_label_); | 879 layout->AddView(user_cert_label_); |
| 840 user_cert_combobox_ = new views::Combobox( | 880 user_cert_combobox_ = new views::Combobox( |
| 841 new UserCertComboboxModel(cert_library_)); | 881 new UserCertComboboxModel(cert_library_)); |
| 842 user_cert_label_->SetEnabled(false); | 882 user_cert_label_->SetEnabled(false); |
| 843 user_cert_combobox_->SetEnabled(false); | 883 user_cert_combobox_->SetEnabled(false); |
| 844 user_cert_combobox_->set_listener(this); | 884 user_cert_combobox_->set_listener(this); |
| 845 layout->AddView(user_cert_combobox_); | 885 layout->AddView(user_cert_combobox_); |
| 886 layout->AddView(new ControlledSettingIndicatorView(user_cert_ui_data_)); |
| 846 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 887 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 847 | 888 |
| 848 // Identity | 889 // Identity |
| 849 layout->StartRow(0, column_view_set_id); | 890 layout->StartRow(0, column_view_set_id); |
| 850 identity_label_ = new views::Label(l10n_util::GetStringUTF16( | 891 identity_label_ = new views::Label(l10n_util::GetStringUTF16( |
| 851 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY)); | 892 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY)); |
| 852 layout->AddView(identity_label_); | 893 layout->AddView(identity_label_); |
| 853 identity_textfield_ = new views::Textfield( | 894 identity_textfield_ = new views::Textfield( |
| 854 views::Textfield::STYLE_DEFAULT); | 895 views::Textfield::STYLE_DEFAULT); |
| 855 identity_textfield_->SetController(this); | 896 identity_textfield_->SetController(this); |
| 856 if (wifi && !wifi->identity().empty()) | 897 if (wifi && !wifi->identity().empty()) |
| 857 identity_textfield_->SetText(UTF8ToUTF16(wifi->identity())); | 898 identity_textfield_->SetText(UTF8ToUTF16(wifi->identity())); |
| 899 identity_textfield_->SetEnabled(identity_ui_data_.editable()); |
| 858 layout->AddView(identity_textfield_); | 900 layout->AddView(identity_textfield_); |
| 901 layout->AddView(new ControlledSettingIndicatorView(identity_ui_data_)); |
| 859 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 902 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 860 } | 903 } |
| 861 | 904 |
| 862 // Passphrase input | 905 // Passphrase input |
| 863 layout->StartRow(0, column_view_set_id); | 906 layout->StartRow(0, column_view_set_id); |
| 864 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; | 907 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; |
| 865 passphrase_label_ = new views::Label( | 908 passphrase_label_ = new views::Label( |
| 866 l10n_util::GetStringUTF16(label_text_id)); | 909 l10n_util::GetStringUTF16(label_text_id)); |
| 867 layout->AddView(passphrase_label_); | 910 layout->AddView(passphrase_label_); |
| 868 passphrase_textfield_ = new views::Textfield( | 911 passphrase_textfield_ = new views::Textfield( |
| 869 views::Textfield::STYLE_PASSWORD); | 912 views::Textfield::STYLE_PASSWORD); |
| 870 passphrase_textfield_->SetController(this); | 913 passphrase_textfield_->SetController(this); |
| 871 if (wifi && !wifi->GetPassphrase().empty()) | 914 if (wifi && !wifi->GetPassphrase().empty()) |
| 872 passphrase_textfield_->SetText(UTF8ToUTF16(wifi->GetPassphrase())); | 915 passphrase_textfield_->SetText(UTF8ToUTF16(wifi->GetPassphrase())); |
| 873 // Disable passphrase input initially for other network. | 916 // Disable passphrase input initially for other network. |
| 874 if (!wifi) { | 917 if (!wifi) { |
| 875 passphrase_label_->SetEnabled(false); | 918 passphrase_label_->SetEnabled(false); |
| 876 passphrase_textfield_->SetEnabled(false); | 919 passphrase_textfield_->SetEnabled(false); |
| 877 } | 920 } |
| 878 passphrase_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( | 921 passphrase_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( |
| 879 label_text_id)); | 922 label_text_id)); |
| 880 layout->AddView(passphrase_textfield_); | 923 layout->AddView(passphrase_textfield_); |
| 881 // Password visible button. | 924 |
| 882 passphrase_visible_button_ = new views::ToggleImageButton(this); | 925 if (passphrase_ui_data_.managed()) { |
| 883 passphrase_visible_button_->SetTooltipText( | 926 layout->AddView(new ControlledSettingIndicatorView(passphrase_ui_data_)); |
| 884 l10n_util::GetStringUTF16( | 927 } else { |
| 885 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_SHOW)); | 928 // Password visible button. |
| 886 passphrase_visible_button_->SetToggledTooltipText( | 929 passphrase_visible_button_ = new views::ToggleImageButton(this); |
| 887 l10n_util::GetStringUTF16( | 930 passphrase_visible_button_->SetTooltipText( |
| 888 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_HIDE)); | 931 l10n_util::GetStringUTF16( |
| 889 passphrase_visible_button_->SetImage( | 932 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_SHOW)); |
| 890 views::ImageButton::BS_NORMAL, | 933 passphrase_visible_button_->SetToggledTooltipText( |
| 891 ResourceBundle::GetSharedInstance(). | 934 l10n_util::GetStringUTF16( |
| 892 GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_OFF)); | 935 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_HIDE)); |
| 893 passphrase_visible_button_->SetImage( | 936 passphrase_visible_button_->SetImage( |
| 894 views::ImageButton::BS_HOT, | 937 views::ImageButton::BS_NORMAL, |
| 895 ResourceBundle::GetSharedInstance(). | 938 ResourceBundle::GetSharedInstance(). |
| 896 GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_HOVER)); | 939 GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_OFF)); |
| 897 passphrase_visible_button_->SetToggledImage( | 940 passphrase_visible_button_->SetImage( |
| 898 views::ImageButton::BS_NORMAL, | 941 views::ImageButton::BS_HOT, |
| 899 ResourceBundle::GetSharedInstance(). | 942 ResourceBundle::GetSharedInstance(). |
| 900 GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_ON)); | 943 GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_HOVER)); |
| 901 passphrase_visible_button_->SetImageAlignment( | 944 passphrase_visible_button_->SetToggledImage( |
| 902 views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); | 945 views::ImageButton::BS_NORMAL, |
| 903 layout->AddView(passphrase_visible_button_); | 946 ResourceBundle::GetSharedInstance(). |
| 947 GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_ON)); |
| 948 passphrase_visible_button_->SetImageAlignment( |
| 949 views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); |
| 950 layout->AddView(passphrase_visible_button_); |
| 951 } |
| 952 |
| 904 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 953 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 905 | 954 |
| 906 if (show_8021x) { | 955 if (show_8021x) { |
| 907 // Anonymous identity | 956 // Anonymous identity |
| 908 layout->StartRow(0, column_view_set_id); | 957 layout->StartRow(0, column_view_set_id); |
| 909 identity_anonymous_label_ = | 958 identity_anonymous_label_ = |
| 910 new views::Label(l10n_util::GetStringUTF16( | 959 new views::Label(l10n_util::GetStringUTF16( |
| 911 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS)); | 960 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS)); |
| 912 layout->AddView(identity_anonymous_label_); | 961 layout->AddView(identity_anonymous_label_); |
| 913 identity_anonymous_textfield_ = new views::Textfield( | 962 identity_anonymous_textfield_ = new views::Textfield( |
| 914 views::Textfield::STYLE_DEFAULT); | 963 views::Textfield::STYLE_DEFAULT); |
| 915 identity_anonymous_label_->SetEnabled(false); | 964 identity_anonymous_label_->SetEnabled(false); |
| 916 identity_anonymous_textfield_->SetEnabled(false); | 965 identity_anonymous_textfield_->SetEnabled(false); |
| 917 identity_anonymous_textfield_->SetController(this); | 966 identity_anonymous_textfield_->SetController(this); |
| 918 layout->AddView(identity_anonymous_textfield_); | 967 layout->AddView(identity_anonymous_textfield_); |
| 968 layout->AddView( |
| 969 new ControlledSettingIndicatorView(identity_anonymous_ui_data_)); |
| 919 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 970 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
| 920 } | 971 } |
| 921 | 972 |
| 922 // Checkboxes. | 973 // Checkboxes. |
| 923 | 974 |
| 924 // Save credentials | 975 // Save credentials |
| 925 if (show_8021x) { | 976 if (show_8021x) { |
| 926 layout->StartRow(0, column_view_set_id); | 977 layout->StartRow(0, column_view_set_id); |
| 927 save_credentials_checkbox_ = new views::Checkbox( | 978 save_credentials_checkbox_ = new views::Checkbox( |
| 928 l10n_util::GetStringUTF16( | 979 l10n_util::GetStringUTF16( |
| 929 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS)); | 980 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS)); |
| 981 save_credentials_checkbox_->SetEnabled( |
| 982 save_credentials_ui_data_.editable()); |
| 930 layout->SkipColumns(1); | 983 layout->SkipColumns(1); |
| 931 layout->AddView(save_credentials_checkbox_); | 984 layout->AddView(save_credentials_checkbox_); |
| 985 layout->AddView( |
| 986 new ControlledSettingIndicatorView(save_credentials_ui_data_)); |
| 932 } | 987 } |
| 933 | 988 |
| 934 // Share network | 989 // Share network |
| 935 if (!wifi || | 990 if (!wifi || |
| 936 (wifi->profile_type() == PROFILE_NONE && | 991 (wifi->profile_type() == PROFILE_NONE && |
| 937 wifi->IsPassphraseRequired() && | 992 wifi->IsPassphraseRequired() && |
| 938 !wifi->RequiresUserProfile())) { | 993 !wifi->RequiresUserProfile())) { |
| 939 layout->StartRow(0, column_view_set_id); | 994 layout->StartRow(0, column_view_set_id); |
| 940 share_network_checkbox_ = new views::Checkbox( | 995 share_network_checkbox_ = new views::Checkbox( |
| 941 l10n_util::GetStringUTF16( | 996 l10n_util::GetStringUTF16( |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 // Set focus to a reasonable widget, depending on what we're showing. | 1129 // Set focus to a reasonable widget, depending on what we're showing. |
| 1075 if (ssid_textfield_) | 1130 if (ssid_textfield_) |
| 1076 ssid_textfield_->RequestFocus(); | 1131 ssid_textfield_->RequestFocus(); |
| 1077 else if (eap_method_combobox_) | 1132 else if (eap_method_combobox_) |
| 1078 eap_method_combobox_->RequestFocus(); | 1133 eap_method_combobox_->RequestFocus(); |
| 1079 else if (passphrase_textfield_ && passphrase_textfield_->IsEnabled()) | 1134 else if (passphrase_textfield_ && passphrase_textfield_->IsEnabled()) |
| 1080 passphrase_textfield_->RequestFocus(); | 1135 passphrase_textfield_->RequestFocus(); |
| 1081 } | 1136 } |
| 1082 | 1137 |
| 1083 } // namespace chromeos | 1138 } // namespace chromeos |
| OLD | NEW |