summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorchocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 02:37:39 +0000
committerchocobo@chromium.org <chocobo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 02:37:39 +0000
commit7230de30ea04e40499e202346803de56ea1630c3 (patch)
tree9f9a285cf8ef4181a3e9c4d1be9bae9c8fb313d9 /chrome
parent026b594cf4d3fc0bc22b0fa0ca5db2b6eae43c26 (diff)
downloadchromium_src-7230de30ea04e40499e202346803de56ea1630c3.zip
chromium_src-7230de30ea04e40499e202346803de56ea1630c3.tar.gz
chromium_src-7230de30ea04e40499e202346803de56ea1630c3.tar.bz2
UI for 802.1x connections.
BUG=chromium-os:11412 TEST=None Review URL: http://codereview.chromium.org/6596064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76865 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/generated_resources.grd45
-rw-r--r--chrome/browser/chromeos/options/network_config_view.cc2
-rw-r--r--chrome/browser/chromeos/options/wifi_config_view.cc341
-rw-r--r--chrome/browser/chromeos/options/wifi_config_view.h24
4 files changed, 318 insertions, 94 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 4882c86..ad3c930 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -9649,9 +9649,54 @@ This web page was killed, either because Chrome ran out of memory, or you chose
<message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID" desc="In settings Internet options, the label for the network id.">
SSID:
</message>
+ <message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD" desc="In settings Internet options, the label for the EAP method.">
+ EAP Method:
+ </message>
+ <message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_NONE" desc="In settings Internet options, a string specifying EAP method none.">
+ Choose...
+ </message>
+ <message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_PEAP" desc="In settings Internet options, a string specifying EAP method PEAP.">
+ PEAP
+ </message>
+ <message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_TLS" desc="In settings Internet options, a string specifying EAP method TLS.">
+ EAP-TLS
+ </message>
+ <message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_TTLS" desc="In settings Internet options, a string specifying EAP method TTLS.">
+ EAP-TTLS
+ </message>
+ <message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_LEAP" desc="In settings Internet options, a string specifying EAP method LEAP.">
+ LEAP
+ </message>
+ <message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH" desc="In settings Internet options, the label for the phase 2 authentication.">
+ Phase 2 Authentication:
+ </message>
+ <message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_AUTO" desc="In settings Internet options, a string specifying phase 2 authentication auto.">
+ Automatic
+ </message>
+ <message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_MD5" desc="In settings Internet options, a string specifying phase 2 authentication EAP-MD5.">
+ EAP-MD5
+ </message>
+ <message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_MSCHAPV2" desc="In settings Internet options, a string specifying phase 2 authentication MSCHAPv2.">
+ MSCHAPv2
+ </message>
+ <message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_MSCHAP" desc="In settings Internet options, a string specifying phase 2 authentication MSCHAP.">
+ MSCHAP
+ </message>
+ <message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_PAP" desc="In settings Internet options, a string specifying phase 2 authentication PAP.">
+ PAP
+ </message>
+ <message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_CHAP" desc="In settings Internet options, a string specifying phase 2 authentication CHAP.">
+ CHAP
+ </message>
<message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY" desc="In settings Internet options, the user identity for authentication.">
Identity:
</message>
+ <message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS" desc="In settings Internet options, the anonymous identity for authentication.">
+ Anonymous Identity:
+ </message>
+ <message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER" desc="In settings Internet options, the server certificate to use.">
+ Server Certificate:
+ </message>
<message name="IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT" desc="In settings Internet options, the x509 certificate to use.">
Certificate:
</message>
diff --git a/chrome/browser/chromeos/options/network_config_view.cc b/chrome/browser/chromeos/options/network_config_view.cc
index 59c1d84..c583f88 100644
--- a/chrome/browser/chromeos/options/network_config_view.cc
+++ b/chrome/browser/chromeos/options/network_config_view.cc
@@ -53,7 +53,7 @@ bool NetworkConfigView::IsDialogButtonEnabled(
MessageBoxFlags::DialogButton button) const {
// Disable connect button if cannot login.
if (button == MessageBoxFlags::DIALOGBUTTON_OK)
- return wificonfig_view_->can_login();
+ return wificonfig_view_->CanLogin();
return true;
}
diff --git a/chrome/browser/chromeos/options/wifi_config_view.cc b/chrome/browser/chromeos/options/wifi_config_view.cc
index 39ff35b..0b306ab 100644
--- a/chrome/browser/chromeos/options/wifi_config_view.cc
+++ b/chrome/browser/chromeos/options/wifi_config_view.cc
@@ -24,45 +24,153 @@
namespace chromeos {
+namespace {
+
// The width of the password field.
const int kPasswordWidth = 150;
enum SecurityComboboxIndex {
- INDEX_NONE = 0,
- INDEX_WEP = 1,
- INDEX_WPA = 2,
- INDEX_RSN = 3,
- INDEX_COUNT = 4
+ SECURITY_INDEX_NONE = 0,
+ SECURITY_INDEX_WEP = 1,
+ SECURITY_INDEX_WPA = 2,
+ SECURITY_INDEX_RSN = 3,
+ SECURITY_INDEX_COUNT = 4
};
-int WifiConfigView::SecurityComboboxModel::GetItemCount() {
- return INDEX_COUNT;
-}
+class SecurityComboboxModel : public ui::ComboboxModel {
+ public:
+ SecurityComboboxModel() {}
+ virtual ~SecurityComboboxModel() {}
+ virtual int GetItemCount() {
+ return SECURITY_INDEX_COUNT;
+ }
+ virtual string16 GetItemAt(int index) {
+ if (index == SECURITY_INDEX_NONE)
+ return l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY_NONE);
+ else if (index == SECURITY_INDEX_WEP)
+ return l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY_WEP);
+ else if (index == SECURITY_INDEX_WPA)
+ return l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY_WPA);
+ else if (index == SECURITY_INDEX_RSN)
+ return l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY_RSN);
+ NOTREACHED();
+ return string16();
+ }
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SecurityComboboxModel);
+};
-string16 WifiConfigView::SecurityComboboxModel::GetItemAt(int index) {
- if (index == INDEX_NONE)
- return l10n_util::GetStringUTF16(
- IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY_NONE);
- else if (index == INDEX_WEP)
- return l10n_util::GetStringUTF16(
- IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY_WEP);
- else if (index == INDEX_WPA)
- return l10n_util::GetStringUTF16(
- IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY_WPA);
- else if (index == INDEX_RSN)
- return l10n_util::GetStringUTF16(
- IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY_RSN);
- NOTREACHED();
- return string16();
-}
+enum EAPMethodComboboxIndex {
+ EAP_METHOD_INDEX_NONE = 0,
+ EAP_METHOD_INDEX_PEAP = 1,
+ EAP_METHOD_INDEX_TLS = 2,
+ EAP_METHOD_INDEX_TTLS = 3,
+ EAP_METHOD_INDEX_LEAP = 4,
+ EAP_METHOD_INDEX_COUNT = 5
+};
+
+class EAPMethodComboboxModel : public ui::ComboboxModel {
+ public:
+ EAPMethodComboboxModel() {}
+ virtual ~EAPMethodComboboxModel() {}
+ virtual int GetItemCount() {
+ return EAP_METHOD_INDEX_COUNT;
+ }
+ virtual string16 GetItemAt(int index) {
+ if (index == EAP_METHOD_INDEX_NONE)
+ return l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_NONE);
+ else if (index == EAP_METHOD_INDEX_PEAP)
+ return l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_PEAP);
+ else if (index == EAP_METHOD_INDEX_TLS)
+ return l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_TLS);
+ else if (index == EAP_METHOD_INDEX_TTLS)
+ return l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_TTLS);
+ else if (index == EAP_METHOD_INDEX_LEAP)
+ return l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD_LEAP);
+ NOTREACHED();
+ return string16();
+ }
+ private:
+ DISALLOW_COPY_AND_ASSIGN(EAPMethodComboboxModel);
+};
+
+enum Phase2AuthComboboxIndex {
+ PHASE_2_AUTH_INDEX_AUTO = 0, // LEAP, EAP-TLS have only this auth.
+ PHASE_2_AUTH_INDEX_MD5 = 1,
+ PHASE_2_AUTH_INDEX_MSCHAPV2 = 2, // PEAP has up to this auth.
+ PHASE_2_AUTH_INDEX_MSCHAP = 3,
+ PHASE_2_AUTH_INDEX_PAP = 4,
+ PHASE_2_AUTH_INDEX_CHAP = 5, // EAP-TTLS has up to this auth.
+ PHASE_2_AUTH_INDEX_COUNT = 6
+};
+
+class Phase2AuthComboboxModel : public ui::ComboboxModel {
+ public:
+ explicit Phase2AuthComboboxModel(views::Combobox* eap_method_combobox)
+ : eap_method_combobox_(eap_method_combobox) {}
+ virtual ~Phase2AuthComboboxModel() {}
+ virtual int GetItemCount() {
+ switch (eap_method_combobox_->selected_item()) {
+ case EAP_METHOD_INDEX_NONE:
+ case EAP_METHOD_INDEX_TLS:
+ case EAP_METHOD_INDEX_LEAP:
+ return PHASE_2_AUTH_INDEX_AUTO + 1;
+ case EAP_METHOD_INDEX_PEAP:
+ return PHASE_2_AUTH_INDEX_MSCHAPV2 + 1;
+ case EAP_METHOD_INDEX_TTLS:
+ return PHASE_2_AUTH_INDEX_CHAP + 1;
+ }
+ NOTREACHED();
+ return 0;
+ }
+ virtual string16 GetItemAt(int index) {
+ if (index == PHASE_2_AUTH_INDEX_AUTO)
+ return l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_AUTO);
+ else if (index == PHASE_2_AUTH_INDEX_MD5)
+ return l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_MD5);
+ else if (index == PHASE_2_AUTH_INDEX_MSCHAPV2)
+ return l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_MSCHAPV2);
+ else if (index == PHASE_2_AUTH_INDEX_MSCHAP)
+ return l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_MSCHAP);
+ else if (index == PHASE_2_AUTH_INDEX_PAP)
+ return l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_PAP);
+ else if (index == PHASE_2_AUTH_INDEX_CHAP)
+ return l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH_CHAP);
+ NOTREACHED();
+ return string16();
+ }
+ private:
+ views::Combobox* eap_method_combobox_;
+ DISALLOW_COPY_AND_ASSIGN(Phase2AuthComboboxModel);
+};
+
+} // namespace
WifiConfigView::WifiConfigView(NetworkConfigView* parent,
const WifiNetwork* wifi)
: parent_(parent),
- can_login_(false),
+ is_8021x_(false),
wifi_(new WifiNetwork(*wifi)),
ssid_textfield_(NULL),
+ eap_method_combobox_(NULL),
+ phase_2_auth_combobox_(NULL),
identity_textfield_(NULL),
+ identity_anonymous_textfield_(NULL),
certificate_browse_button_(NULL),
certificate_path_(),
security_combobox_(NULL),
@@ -74,9 +182,12 @@ WifiConfigView::WifiConfigView(NetworkConfigView* parent,
WifiConfigView::WifiConfigView(NetworkConfigView* parent)
: parent_(parent),
- can_login_(false),
+ is_8021x_(false),
ssid_textfield_(NULL),
+ eap_method_combobox_(NULL),
+ phase_2_auth_combobox_(NULL),
identity_textfield_(NULL),
+ identity_anonymous_textfield_(NULL),
certificate_browse_button_(NULL),
certificate_path_(),
security_combobox_(NULL),
@@ -89,36 +200,41 @@ WifiConfigView::WifiConfigView(NetworkConfigView* parent)
WifiConfigView::~WifiConfigView() {
}
-void WifiConfigView::UpdateCanLogin(void) {
+bool WifiConfigView::CanLogin() {
static const size_t kMinWirelessPasswordLen = 5;
- bool can_login = true;
if (!wifi_.get()) {
// Enforce ssid is non empty.
+ if (GetSSID().empty())
+ return false;
+
// If security is not none, also enforce passphrase is non empty.
- can_login = !GetSSID().empty() &&
- (security_combobox_->selected_item() == INDEX_NONE ||
- passphrase_textfield_->text().length() >= kMinWirelessPasswordLen);
+ if (security_combobox_->selected_item() != SECURITY_INDEX_NONE &&
+ passphrase_textfield_->text().length() < kMinWirelessPasswordLen)
+ return false;
} else {
- // Connecting to an encrypted network
- if (passphrase_textfield_ != NULL) {
- // if the network requires a passphrase, make sure it is non empty.
- can_login &=
- passphrase_textfield_->text().length() >= kMinWirelessPasswordLen;
- }
- if (identity_textfield_ != NULL) {
+ if (is_8021x_) {
+ // Make sure the EAP method is set
+ if (eap_method_combobox_->selected_item() == EAP_METHOD_INDEX_NONE)
+ return false;
+
// If we have an identity field, we can login if we have a non empty
// identity and a certificate path
- can_login &= !identity_textfield_->text().empty() &&
- !certificate_path_.empty();
+ if (identity_textfield_ != NULL &&
+ (identity_textfield_->text().empty() || certificate_path_.empty()))
+ return false;
}
- }
- // Update the login button enable/disable state if can_login_ changes.
- if (can_login != can_login_) {
- can_login_ = can_login;
- parent_->GetDialogClientView()->UpdateDialogButtons();
+ // if the network requires a passphrase, make sure it is the right length.
+ if (passphrase_textfield_ != NULL &&
+ passphrase_textfield_->text().length() < kMinWirelessPasswordLen)
+ return false;
}
+ return true;
+}
+
+void WifiConfigView::UpdateCanLogin() {
+ parent_->GetDialogClientView()->UpdateDialogButtons();
}
void WifiConfigView::UpdateErrorLabel(bool failed) {
@@ -180,13 +296,43 @@ void WifiConfigView::ButtonPressed(views::Button* sender,
void WifiConfigView::ItemChanged(views::Combobox* combo_box,
int prev_index, int new_index) {
- // If changed to no security, then disable combobox and clear it.
- // Otherwise, enable it. Also, update can login.
- if (new_index == INDEX_NONE) {
- passphrase_textfield_->SetEnabled(false);
- passphrase_textfield_->SetText(string16());
- } else {
- passphrase_textfield_->SetEnabled(true);
+ if (new_index == prev_index)
+ return;
+ if (combo_box == security_combobox_) {
+ // If changed to no security, then disable combobox and clear it.
+ // Otherwise, enable it. Also, update can login.
+ if (new_index == SECURITY_INDEX_NONE) {
+ passphrase_textfield_->SetEnabled(false);
+ passphrase_textfield_->SetText(string16());
+ } else {
+ passphrase_textfield_->SetEnabled(true);
+ }
+ } else if (combo_box == eap_method_combobox_) {
+ // If EAP method changes, the phase 2 auth choices may have changed also.
+ phase_2_auth_combobox_->ModelChanged();
+ phase_2_auth_combobox_->SetSelectedItem(0);
+ phase_2_auth_combobox_->SetEnabled(
+ phase_2_auth_combobox_->model()->GetItemCount() > 1);
+
+ // No password for EAP-TLS
+ if (eap_method_combobox_->selected_item() == EAP_METHOD_INDEX_TLS) {
+ passphrase_textfield_->SetEnabled(false);
+ passphrase_textfield_->SetText(string16());
+ } else {
+ passphrase_textfield_->SetEnabled(true);
+ }
+
+ // No client certs for EAP-TTLS, PEAP, or LEAP
+
+ // No server certs for LEAP
+
+ // No anonymous identity if no phase 2 auth.
+ if (phase_2_auth_combobox_->model()->GetItemCount() > 1) {
+ identity_anonymous_textfield_->SetEnabled(true);
+ } else {
+ identity_anonymous_textfield_->SetEnabled(false);
+ identity_anonymous_textfield_->SetText(string16());
+ }
}
UpdateCanLogin();
}
@@ -211,13 +357,13 @@ bool WifiConfigView::Login() {
if (!wifi_.get()) {
ConnectionSecurity sec = SECURITY_UNKNOWN;
int index = security_combobox_->selected_item();
- if (index == INDEX_NONE)
+ if (index == SECURITY_INDEX_NONE)
sec = SECURITY_NONE;
- else if (index == INDEX_WEP)
+ else if (index == SECURITY_INDEX_WEP)
sec = SECURITY_WEP;
- else if (index == INDEX_WPA)
+ else if (index == SECURITY_INDEX_WPA)
sec = SECURITY_WPA;
- else if (index == INDEX_RSN)
+ else if (index == SECURITY_INDEX_RSN)
sec = SECURITY_RSN;
connected = cros->ConnectToWifiNetwork(
sec, GetSSID(), GetPassphrase(),
@@ -283,6 +429,12 @@ const std::string WifiConfigView::GetPassphrase() const {
return result;
}
+// This will initialize the view depending on if we have a wifi network or not.
+// And if we are doing simple password encyption or the more complicated
+// 802.1x encryption.
+// If we are creating the "Join other network..." dialog, we will allow user
+// to enter the data. And if they select the 802.1x encryption, we will show
+// the 802.1x fields.
void WifiConfigView::Init() {
views::GridLayout* layout = views::GridLayout::CreatePanel(this);
SetLayoutManager(layout);
@@ -314,6 +466,17 @@ void WifiConfigView::Init() {
}
layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
+ // Security select
+ if (!wifi_.get()) {
+ layout->StartRow(0, column_view_set_id);
+ layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY))));
+ security_combobox_ = new views::Combobox(new SecurityComboboxModel());
+ security_combobox_->set_listener(this);
+ layout->AddView(security_combobox_);
+ layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
+ }
+
// Certificate input
// Loaded certificates (i.e. stored in a pkcs11 device) do not require
// a passphrase.
@@ -324,18 +487,30 @@ void WifiConfigView::Init() {
// in general, but very common. WPA Supplicant doesn't report the
// EAP type because it's unknown until the process begins, and we'd
// need some kind of callback.
- if (wifi_.get() && wifi_->encrypted() &&
- wifi_->encryption() == SECURITY_8021X) {
+ is_8021x_ = wifi_.get() && wifi_->encrypted() &&
+ wifi_->encryption() == SECURITY_8021X;
+ if (is_8021x_) {
+ // EAP Method
layout->StartRow(0, column_view_set_id);
layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
- IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY))));
- identity_textfield_ = new views::Textfield(
- views::Textfield::STYLE_DEFAULT);
- identity_textfield_->SetController(this);
- if (!wifi_->identity().empty())
- identity_textfield_->SetText(UTF8ToUTF16(wifi_->identity()));
- layout->AddView(identity_textfield_);
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_EAP_METHOD))));
+ eap_method_combobox_ = new views::Combobox(new EAPMethodComboboxModel());
+ eap_method_combobox_->set_listener(this);
+ layout->AddView(eap_method_combobox_);
layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
+
+ // Phase 2 Authentication
+ layout->StartRow(0, column_view_set_id);
+ layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PHASE_2_AUTH))));
+ phase_2_auth_combobox_ = new views::Combobox(
+ new Phase2AuthComboboxModel(eap_method_combobox_));
+ phase_2_auth_combobox_->SetEnabled(false);
+ phase_2_auth_combobox_->set_listener(this);
+ layout->AddView(phase_2_auth_combobox_);
+ layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
+
+ // Certificate
layout->StartRow(0, column_view_set_id);
layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT))));
@@ -360,28 +535,38 @@ void WifiConfigView::Init() {
layout->AddView(certificate_browse_button_);
}
layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
- }
- // Security select
- if (!wifi_.get()) {
+ // Identity
layout->StartRow(0, column_view_set_id);
layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
- IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY))));
- security_combobox_ = new views::Combobox(new SecurityComboboxModel());
- security_combobox_->set_listener(this);
- layout->AddView(security_combobox_);
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY))));
+ identity_textfield_ = new views::Textfield(
+ views::Textfield::STYLE_DEFAULT);
+ identity_textfield_->SetController(this);
+ if (!wifi_->identity().empty())
+ identity_textfield_->SetText(UTF8ToUTF16(wifi_->identity()));
+ layout->AddView(identity_textfield_);
+ layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
+
+ // Anonymous Identity
+ layout->StartRow(0, column_view_set_id);
+ layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY_ANONYMOUS))));
+ identity_anonymous_textfield_ = new views::Textfield(
+ views::Textfield::STYLE_DEFAULT);
+ identity_anonymous_textfield_->SetEnabled(false);
+ identity_anonymous_textfield_->SetController(this);
+ layout->AddView(identity_anonymous_textfield_);
layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
}
// Passphrase input
layout->StartRow(0, column_view_set_id);
int label_text_id;
- if (wifi_.get() && wifi_->encryption() == SECURITY_8021X) {
- label_text_id =
- IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PRIVATE_KEY_PASSWORD;
- } else {
+ if (is_8021x_)
+ label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PRIVATE_KEY_PASSWORD;
+ else
label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE;
- }
layout->AddView(new views::Label(
UTF16ToWide(l10n_util::GetStringUTF16(label_text_id))));
passphrase_textfield_ = new views::Textfield(
@@ -411,7 +596,7 @@ void WifiConfigView::Init() {
error_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
error_label_->SetColor(SK_ColorRED);
layout->AddView(error_label_);
- layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
+
// Set or hide the error text.
UpdateErrorLabel(false);
}
diff --git a/chrome/browser/chromeos/options/wifi_config_view.h b/chrome/browser/chromeos/options/wifi_config_view.h
index e690cdb..a75bd72 100644
--- a/chrome/browser/chromeos/options/wifi_config_view.h
+++ b/chrome/browser/chromeos/options/wifi_config_view.h
@@ -34,7 +34,9 @@ class WifiConfigView : public views::View,
public views::Combobox::Listener,
public SelectFileDialog::Listener {
public:
+ // Wifi login dialog for wifi network |wifi|
WifiConfigView(NetworkConfigView* parent, const WifiNetwork* wifi);
+ // Wifi login dialog for "Joining other network..."
explicit WifiConfigView(NetworkConfigView* parent);
virtual ~WifiConfigView();
@@ -68,20 +70,10 @@ class WifiConfigView : public views::View,
// Get the typed in passphrase.
const std::string GetPassphrase() const;
- // Returns true if the textfields are non-empty and we can login.
- bool can_login() const { return can_login_; }
+ // Returns whether or not we can login.
+ bool CanLogin();
private:
- class SecurityComboboxModel : public ui::ComboboxModel {
- public:
- SecurityComboboxModel() {}
- virtual ~SecurityComboboxModel() {}
- virtual int GetItemCount();
- virtual string16 GetItemAt(int index);
- private:
- DISALLOW_COPY_AND_ASSIGN(SecurityComboboxModel);
- };
-
// Initializes UI.
void Init();
@@ -93,14 +85,16 @@ class WifiConfigView : public views::View,
NetworkConfigView* parent_;
- // Whether or not we can log in. This gets recalculated when textfield
- // contents change.
- bool can_login_;
+ // Whether or not it is an 802.1x network.
+ bool is_8021x_;
scoped_ptr<WifiNetwork> wifi_;
views::Textfield* ssid_textfield_;
+ views::Combobox* eap_method_combobox_;
+ views::Combobox* phase_2_auth_combobox_;
views::Textfield* identity_textfield_;
+ views::Textfield* identity_anonymous_textfield_;
views::NativeButton* certificate_browse_button_;
scoped_refptr<SelectFileDialog> select_file_dialog_;
std::string certificate_path_;