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_.controller() != | |
761 NetworkPropertyUIData::CONTROLLER_POLICY) { | |
762 server_ca_cert_ui_data_.UpdateFromNetwork( | |
763 wifi, NetworkUIData::kPropertyEAPUseSystemCAs); | |
764 } | |
765 identity_ui_data_.UpdateFromNetwork( | |
766 wifi, NetworkUIData::kPropertyEAPIdentity); | |
767 identity_anonymous_ui_data_.UpdateFromNetwork( | |
768 wifi, NetworkUIData::kPropertyEAPAnonymousIdentity); | |
769 save_credentials_ui_data_.UpdateFromNetwork( | |
770 wifi, NetworkUIData::kPropertySaveCredentials); | |
771 if (show_8021x) { | |
772 passphrase_ui_data_.UpdateFromNetwork( | |
773 wifi, NetworkUIData::kPropertyEAPPassphrase); | |
774 } else { | |
775 passphrase_ui_data_.UpdateFromNetwork( | |
776 wifi, NetworkUIData::kPropertyPassphrase); | |
777 } | |
778 } | |
779 | |
744 views::GridLayout* layout = views::GridLayout::CreatePanel(this); | 780 views::GridLayout* layout = views::GridLayout::CreatePanel(this); |
745 SetLayoutManager(layout); | 781 SetLayoutManager(layout); |
746 | 782 |
747 int column_view_set_id = 0; | 783 int column_view_set_id = 0; |
748 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id); | 784 views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id); |
749 const int kPasswordVisibleWidth = 20; | 785 const int kPasswordVisibleWidth = 20; |
750 // Label | 786 // Label |
751 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1, | 787 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1, |
752 views::GridLayout::USE_PREF, 0, 0); | 788 views::GridLayout::USE_PREF, 0, 0); |
753 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); | 789 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); |
754 // Textfield, combobox. | 790 // Textfield, combobox. |
755 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, | 791 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, |
756 views::GridLayout::USE_PREF, 0, | 792 views::GridLayout::USE_PREF, 0, |
757 ChildNetworkConfigView::kInputFieldMinWidth); | 793 ChildNetworkConfigView::kInputFieldMinWidth); |
758 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); | 794 column_set->AddPaddingColumn(0, views::kRelatedControlSmallHorizontalSpacing); |
759 // Password visible button | 795 // Password visible button / policy indicator. |
760 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 1, | 796 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::FILL, 1, |
761 views::GridLayout::USE_PREF, 0, kPasswordVisibleWidth); | 797 views::GridLayout::USE_PREF, 0, kPasswordVisibleWidth); |
762 | 798 |
763 // SSID input | 799 // SSID input |
764 layout->StartRow(0, column_view_set_id); | 800 layout->StartRow(0, column_view_set_id); |
765 layout->AddView(new views::Label(l10n_util::GetStringUTF16( | 801 layout->AddView(new views::Label(l10n_util::GetStringUTF16( |
766 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID))); | 802 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID))); |
767 if (!wifi) { | 803 if (!wifi) { |
768 ssid_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); | 804 ssid_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT); |
769 ssid_textfield_->SetController(this); | 805 ssid_textfield_->SetController(this); |
(...skipping 25 matching lines...) Expand all Loading... | |
795 // Setup a callback if certificates are yet to be loaded, | 831 // Setup a callback if certificates are yet to be loaded, |
796 if (!cert_library_->CertificatesLoaded()) | 832 if (!cert_library_->CertificatesLoaded()) |
797 cert_library_->AddObserver(this); | 833 cert_library_->AddObserver(this); |
798 | 834 |
799 // EAP method | 835 // EAP method |
800 layout->StartRow(0, column_view_set_id); | 836 layout->StartRow(0, column_view_set_id); |
801 layout->AddView(new views::Label(l10n_util::GetStringUTF16( | 837 layout->AddView(new views::Label(l10n_util::GetStringUTF16( |
802 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD))); | 838 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD))); |
803 eap_method_combobox_ = new views::Combobox(new EAPMethodComboboxModel()); | 839 eap_method_combobox_ = new views::Combobox(new EAPMethodComboboxModel()); |
804 eap_method_combobox_->set_listener(this); | 840 eap_method_combobox_->set_listener(this); |
841 eap_method_combobox_->SetEnabled(eap_method_ui_data_.editable()); | |
805 layout->AddView(eap_method_combobox_); | 842 layout->AddView(eap_method_combobox_); |
843 layout->AddView(new ControlledSettingIndicatorView(eap_method_ui_data_)); | |
806 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 844 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
807 | 845 |
808 // Phase 2 authentication | 846 // Phase 2 authentication |
809 layout->StartRow(0, column_view_set_id); | 847 layout->StartRow(0, column_view_set_id); |
810 phase_2_auth_label_ = new views::Label(l10n_util::GetStringUTF16( | 848 phase_2_auth_label_ = new views::Label(l10n_util::GetStringUTF16( |
811 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH)); | 849 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH)); |
812 layout->AddView(phase_2_auth_label_); | 850 layout->AddView(phase_2_auth_label_); |
813 phase_2_auth_combobox_ = new views::Combobox( | 851 phase_2_auth_combobox_ = new views::Combobox( |
814 new Phase2AuthComboboxModel(eap_method_combobox_)); | 852 new Phase2AuthComboboxModel(eap_method_combobox_)); |
815 phase_2_auth_label_->SetEnabled(false); | 853 phase_2_auth_label_->SetEnabled(false); |
816 phase_2_auth_combobox_->SetEnabled(false); | 854 phase_2_auth_combobox_->SetEnabled(false); |
817 phase_2_auth_combobox_->set_listener(this); | 855 phase_2_auth_combobox_->set_listener(this); |
818 layout->AddView(phase_2_auth_combobox_); | 856 layout->AddView(phase_2_auth_combobox_); |
857 layout->AddView(new ControlledSettingIndicatorView(phase_2_auth_ui_data_)); | |
819 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 858 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
820 | 859 |
821 // Server CA certificate | 860 // Server CA certificate |
822 layout->StartRow(0, column_view_set_id); | 861 layout->StartRow(0, column_view_set_id); |
823 server_ca_cert_label_ = new views::Label(l10n_util::GetStringUTF16( | 862 server_ca_cert_label_ = new views::Label(l10n_util::GetStringUTF16( |
824 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA)); | 863 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA)); |
825 layout->AddView(server_ca_cert_label_); | 864 layout->AddView(server_ca_cert_label_); |
826 server_ca_cert_combobox_ = new ComboboxWithWidth( | 865 server_ca_cert_combobox_ = new ComboboxWithWidth( |
827 new ServerCACertComboboxModel(cert_library_), | 866 new ServerCACertComboboxModel(cert_library_), |
828 ChildNetworkConfigView::kInputFieldMinWidth); | 867 ChildNetworkConfigView::kInputFieldMinWidth); |
829 server_ca_cert_label_->SetEnabled(false); | 868 server_ca_cert_label_->SetEnabled(false); |
830 server_ca_cert_combobox_->SetEnabled(false); | 869 server_ca_cert_combobox_->SetEnabled(false); |
831 server_ca_cert_combobox_->set_listener(this); | 870 server_ca_cert_combobox_->set_listener(this); |
832 layout->AddView(server_ca_cert_combobox_); | 871 layout->AddView(server_ca_cert_combobox_); |
872 layout->AddView( | |
873 new ControlledSettingIndicatorView(server_ca_cert_ui_data_)); | |
833 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 874 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
834 | 875 |
835 // User certificate | 876 // User certificate |
836 layout->StartRow(0, column_view_set_id); | 877 layout->StartRow(0, column_view_set_id); |
837 user_cert_label_ = new views::Label(l10n_util::GetStringUTF16( | 878 user_cert_label_ = new views::Label(l10n_util::GetStringUTF16( |
838 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT)); | 879 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT)); |
839 layout->AddView(user_cert_label_); | 880 layout->AddView(user_cert_label_); |
840 user_cert_combobox_ = new views::Combobox( | 881 user_cert_combobox_ = new views::Combobox( |
841 new UserCertComboboxModel(cert_library_)); | 882 new UserCertComboboxModel(cert_library_)); |
842 user_cert_label_->SetEnabled(false); | 883 user_cert_label_->SetEnabled(false); |
843 user_cert_combobox_->SetEnabled(false); | 884 user_cert_combobox_->SetEnabled(false); |
844 user_cert_combobox_->set_listener(this); | 885 user_cert_combobox_->set_listener(this); |
845 layout->AddView(user_cert_combobox_); | 886 layout->AddView(user_cert_combobox_); |
887 layout->AddView(new ControlledSettingIndicatorView(user_cert_ui_data_)); | |
846 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 888 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
847 | 889 |
848 // Identity | 890 // Identity |
849 layout->StartRow(0, column_view_set_id); | 891 layout->StartRow(0, column_view_set_id); |
850 identity_label_ = new views::Label(l10n_util::GetStringUTF16( | 892 identity_label_ = new views::Label(l10n_util::GetStringUTF16( |
851 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY)); | 893 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY)); |
852 layout->AddView(identity_label_); | 894 layout->AddView(identity_label_); |
853 identity_textfield_ = new views::Textfield( | 895 identity_textfield_ = new views::Textfield( |
854 views::Textfield::STYLE_DEFAULT); | 896 views::Textfield::STYLE_DEFAULT); |
855 identity_textfield_->SetController(this); | 897 identity_textfield_->SetController(this); |
856 if (wifi && !wifi->identity().empty()) | 898 if (wifi && !wifi->identity().empty()) |
857 identity_textfield_->SetText(UTF8ToUTF16(wifi->identity())); | 899 identity_textfield_->SetText(UTF8ToUTF16(wifi->identity())); |
900 identity_textfield_->SetEnabled(identity_ui_data_.editable()); | |
858 layout->AddView(identity_textfield_); | 901 layout->AddView(identity_textfield_); |
902 layout->AddView(new ControlledSettingIndicatorView(identity_ui_data_)); | |
859 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 903 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
860 } | 904 } |
861 | 905 |
862 // Passphrase input | 906 // Passphrase input |
863 layout->StartRow(0, column_view_set_id); | 907 layout->StartRow(0, column_view_set_id); |
864 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; | 908 int label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE; |
865 passphrase_label_ = new views::Label( | 909 passphrase_label_ = new views::Label( |
866 l10n_util::GetStringUTF16(label_text_id)); | 910 l10n_util::GetStringUTF16(label_text_id)); |
867 layout->AddView(passphrase_label_); | 911 layout->AddView(passphrase_label_); |
868 passphrase_textfield_ = new views::Textfield( | 912 passphrase_textfield_ = new views::Textfield( |
869 views::Textfield::STYLE_PASSWORD); | 913 views::Textfield::STYLE_PASSWORD); |
870 passphrase_textfield_->SetController(this); | 914 passphrase_textfield_->SetController(this); |
871 if (wifi && !wifi->GetPassphrase().empty()) | 915 if (wifi && !wifi->GetPassphrase().empty()) |
872 passphrase_textfield_->SetText(UTF8ToUTF16(wifi->GetPassphrase())); | 916 passphrase_textfield_->SetText(UTF8ToUTF16(wifi->GetPassphrase())); |
873 // Disable passphrase input initially for other network. | 917 // Disable passphrase input initially for other network. |
874 if (!wifi) { | 918 if (!wifi) { |
875 passphrase_label_->SetEnabled(false); | 919 passphrase_label_->SetEnabled(false); |
876 passphrase_textfield_->SetEnabled(false); | 920 passphrase_textfield_->SetEnabled(false); |
877 } | 921 } |
878 passphrase_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( | 922 passphrase_textfield_->SetAccessibleName(l10n_util::GetStringUTF16( |
879 label_text_id)); | 923 label_text_id)); |
880 layout->AddView(passphrase_textfield_); | 924 layout->AddView(passphrase_textfield_); |
881 // Password visible button. | 925 |
882 passphrase_visible_button_ = new views::ToggleImageButton(this); | 926 if (passphrase_ui_data_.controller() == |
883 passphrase_visible_button_->SetTooltipText( | 927 NetworkPropertyUIData::CONTROLLER_POLICY) { |
stevenjb
2011/11/29 17:58:28
I think this should definitely be either !editable
Mattias Nissler (ping if slow)
2011/11/29 21:29:39
Done.
| |
884 l10n_util::GetStringUTF16( | 928 layout->AddView(new ControlledSettingIndicatorView(passphrase_ui_data_)); |
885 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_SHOW)); | 929 } else { |
886 passphrase_visible_button_->SetToggledTooltipText( | 930 // Password visible button. |
887 l10n_util::GetStringUTF16( | 931 passphrase_visible_button_ = new views::ToggleImageButton(this); |
888 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_HIDE)); | 932 passphrase_visible_button_->SetTooltipText( |
889 passphrase_visible_button_->SetImage( | 933 l10n_util::GetStringUTF16( |
890 views::ImageButton::BS_NORMAL, | 934 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_SHOW)); |
891 ResourceBundle::GetSharedInstance(). | 935 passphrase_visible_button_->SetToggledTooltipText( |
892 GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_OFF)); | 936 l10n_util::GetStringUTF16( |
893 passphrase_visible_button_->SetImage( | 937 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE_HIDE)); |
894 views::ImageButton::BS_HOT, | 938 passphrase_visible_button_->SetImage( |
895 ResourceBundle::GetSharedInstance(). | 939 views::ImageButton::BS_NORMAL, |
896 GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_HOVER)); | 940 ResourceBundle::GetSharedInstance(). |
897 passphrase_visible_button_->SetToggledImage( | 941 GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_OFF)); |
898 views::ImageButton::BS_NORMAL, | 942 passphrase_visible_button_->SetImage( |
899 ResourceBundle::GetSharedInstance(). | 943 views::ImageButton::BS_HOT, |
900 GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_ON)); | 944 ResourceBundle::GetSharedInstance(). |
901 passphrase_visible_button_->SetImageAlignment( | 945 GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_HOVER)); |
902 views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); | 946 passphrase_visible_button_->SetToggledImage( |
903 layout->AddView(passphrase_visible_button_); | 947 views::ImageButton::BS_NORMAL, |
948 ResourceBundle::GetSharedInstance(). | |
949 GetBitmapNamed(IDR_NETWORK_SHOW_PASSWORD_ON)); | |
950 passphrase_visible_button_->SetImageAlignment( | |
951 views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); | |
952 layout->AddView(passphrase_visible_button_); | |
953 } | |
954 | |
904 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 955 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
905 | 956 |
906 if (show_8021x) { | 957 if (show_8021x) { |
907 // Anonymous identity | 958 // Anonymous identity |
908 layout->StartRow(0, column_view_set_id); | 959 layout->StartRow(0, column_view_set_id); |
909 identity_anonymous_label_ = | 960 identity_anonymous_label_ = |
910 new views::Label(l10n_util::GetStringUTF16( | 961 new views::Label(l10n_util::GetStringUTF16( |
911 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS)); | 962 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS)); |
912 layout->AddView(identity_anonymous_label_); | 963 layout->AddView(identity_anonymous_label_); |
913 identity_anonymous_textfield_ = new views::Textfield( | 964 identity_anonymous_textfield_ = new views::Textfield( |
914 views::Textfield::STYLE_DEFAULT); | 965 views::Textfield::STYLE_DEFAULT); |
915 identity_anonymous_label_->SetEnabled(false); | 966 identity_anonymous_label_->SetEnabled(false); |
916 identity_anonymous_textfield_->SetEnabled(false); | 967 identity_anonymous_textfield_->SetEnabled(false); |
917 identity_anonymous_textfield_->SetController(this); | 968 identity_anonymous_textfield_->SetController(this); |
918 layout->AddView(identity_anonymous_textfield_); | 969 layout->AddView(identity_anonymous_textfield_); |
970 layout->AddView( | |
971 new ControlledSettingIndicatorView(identity_anonymous_ui_data_)); | |
919 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); | 972 layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); |
920 } | 973 } |
921 | 974 |
922 // Checkboxes. | 975 // Checkboxes. |
923 | 976 |
924 // Save credentials | 977 // Save credentials |
925 if (show_8021x) { | 978 if (show_8021x) { |
926 layout->StartRow(0, column_view_set_id); | 979 layout->StartRow(0, column_view_set_id); |
927 save_credentials_checkbox_ = new views::Checkbox( | 980 save_credentials_checkbox_ = new views::Checkbox( |
928 l10n_util::GetStringUTF16( | 981 l10n_util::GetStringUTF16( |
929 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS)); | 982 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS)); |
983 save_credentials_checkbox_->SetEnabled( | |
984 save_credentials_ui_data_.editable()); | |
930 layout->SkipColumns(1); | 985 layout->SkipColumns(1); |
931 layout->AddView(save_credentials_checkbox_); | 986 layout->AddView(save_credentials_checkbox_); |
987 layout->AddView( | |
988 new ControlledSettingIndicatorView(save_credentials_ui_data_)); | |
932 } | 989 } |
933 | 990 |
934 // Share network | 991 // Share network |
935 if (!wifi || | 992 if (!wifi || |
936 (wifi->profile_type() == PROFILE_NONE && | 993 (wifi->profile_type() == PROFILE_NONE && |
937 wifi->IsPassphraseRequired() && | 994 wifi->IsPassphraseRequired() && |
938 !wifi->RequiresUserProfile())) { | 995 !wifi->RequiresUserProfile())) { |
939 layout->StartRow(0, column_view_set_id); | 996 layout->StartRow(0, column_view_set_id); |
940 share_network_checkbox_ = new views::Checkbox( | 997 share_network_checkbox_ = new views::Checkbox( |
941 l10n_util::GetStringUTF16( | 998 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. | 1131 // Set focus to a reasonable widget, depending on what we're showing. |
1075 if (ssid_textfield_) | 1132 if (ssid_textfield_) |
1076 ssid_textfield_->RequestFocus(); | 1133 ssid_textfield_->RequestFocus(); |
1077 else if (eap_method_combobox_) | 1134 else if (eap_method_combobox_) |
1078 eap_method_combobox_->RequestFocus(); | 1135 eap_method_combobox_->RequestFocus(); |
1079 else if (passphrase_textfield_ && passphrase_textfield_->IsEnabled()) | 1136 else if (passphrase_textfield_ && passphrase_textfield_->IsEnabled()) |
1080 passphrase_textfield_->RequestFocus(); | 1137 passphrase_textfield_->RequestFocus(); |
1081 } | 1138 } |
1082 | 1139 |
1083 } // namespace chromeos | 1140 } // namespace chromeos |
OLD | NEW |