diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/chromeos/cros/network_library.cc | 37 | ||||
-rw-r--r-- | chrome/browser/chromeos/options/passphrase_textfield.cc | 45 | ||||
-rw-r--r-- | chrome/browser/chromeos/options/passphrase_textfield.h | 34 | ||||
-rw-r--r-- | chrome/browser/chromeos/options/vpn_config_view.cc | 21 | ||||
-rw-r--r-- | chrome/browser/chromeos/options/vpn_config_view.h | 11 |
5 files changed, 24 insertions, 124 deletions
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc index 068b596..e770515 100644 --- a/chrome/browser/chromeos/cros/network_library.cc +++ b/chrome/browser/chromeos/cros/network_library.cc @@ -826,15 +826,11 @@ void VirtualNetwork::SetL2TPIPsecPSKCredentials( const std::string& username, const std::string& user_passphrase, const std::string& group_name) { - if (!psk_passphrase.empty()) { - SetStringProperty(flimflam::kL2tpIpsecPskProperty, - psk_passphrase, &psk_passphrase_); - } + SetStringProperty(flimflam::kL2tpIpsecPskProperty, + psk_passphrase, &psk_passphrase_); SetStringProperty(flimflam::kL2tpIpsecUserProperty, username, &username_); - if (!user_passphrase.empty()) { - SetStringProperty(flimflam::kL2tpIpsecPasswordProperty, - user_passphrase, &user_passphrase_); - } + SetStringProperty(flimflam::kL2tpIpsecPasswordProperty, + user_passphrase, &user_passphrase_); SetStringProperty(flimflam::kL2tpIpsecGroupNameProperty, group_name, &group_name_); } @@ -847,10 +843,8 @@ void VirtualNetwork::SetL2TPIPsecCertCredentials( SetStringProperty(flimflam::kL2tpIpsecClientCertIdProperty, client_cert_id, &client_cert_id_); SetStringProperty(flimflam::kL2tpIpsecUserProperty, username, &username_); - if (!user_passphrase.empty()) { - SetStringProperty(flimflam::kL2tpIpsecPasswordProperty, - user_passphrase, &user_passphrase_); - } + SetStringProperty(flimflam::kL2tpIpsecPasswordProperty, + user_passphrase, &user_passphrase_); SetStringProperty(flimflam::kL2tpIpsecGroupNameProperty, group_name, &group_name_); } @@ -5289,25 +5283,16 @@ void NetworkLibraryImplStub::Init() { " \"NetworkConfigurations\": [" " {" " \"GUID\": \"guid\"," - " \"Type\": \"VPN\"," - " \"Name\": \"VPNtest\"," - " \"VPN\": {" - " \"Host\": \"172.22.12.98\"," - " \"Type\": \"L2TP-IPsec\"," - " \"IPsec\": {" - " \"AuthenticationType\": \"PSK\"," - " \"IKEVersion\": 2," - " \"PSK\": \"chromeos\"," - " }," - " \"L2TP\": {" - " \"Username\": \"vpntest\"," - " }" + " \"Type\": \"WiFi\"," + " \"WiFi\": {" + " \"Security\": \"WEP\"," + " \"SSID\": \"MySSID\"," " }" " }" " ]," " \"Certificates\": []" "}"); -// LoadOncNetworks(test_blob, "", NetworkUIData::ONC_SOURCE_USER_IMPORT, NULL); + LoadOncNetworks(test_blob, "", NetworkUIData::ONC_SOURCE_USER_IMPORT, NULL); } //////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/chromeos/options/passphrase_textfield.cc b/chrome/browser/chromeos/options/passphrase_textfield.cc deleted file mode 100644 index e7b3614..0000000 --- a/chrome/browser/chromeos/options/passphrase_textfield.cc +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/chromeos/options/passphrase_textfield.h" - -#include "base/utf_string_conversions.h" - -namespace chromeos { - -// String to use as password if the password is set but not available in the UI. -// User will see this as ******** -const string16 kFakePassphrase = ASCIIToUTF16("********"); - -PassphraseTextfield::PassphraseTextfield(bool show_fake) - : Textfield(views::Textfield::STYLE_OBSCURED), - show_fake_(show_fake), - changed_(true) { - if (show_fake_) { - SetText(kFakePassphrase); - changed_ = false; - } -} - -void PassphraseTextfield::OnFocus() { - // If showing the fake password, then clear it when focused. - if (show_fake_ && !changed_) { - SetText(string16()); - changed_ = true; - } -} - -void PassphraseTextfield::OnBlur() { - // If passowrd is not changed, then show the fake password when blurred. - if (show_fake_ && text().empty()) { - SetText(kFakePassphrase); - changed_ = false; - } -} - -std::string PassphraseTextfield::GetPassphrase() { - return changed_ ? UTF16ToUTF8(text()) : std::string(); -} - -} // namespace chromeos diff --git a/chrome/browser/chromeos/options/passphrase_textfield.h b/chrome/browser/chromeos/options/passphrase_textfield.h deleted file mode 100644 index 9eb46e8..0000000 --- a/chrome/browser/chromeos/options/passphrase_textfield.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_CHROMEOS_OPTIONS_PASSPHRASE_TEXTFIELD_H_ -#define CHROME_BROWSER_CHROMEOS_OPTIONS_PASSPHRASE_TEXTFIELD_H_ -#pragma once - -#include "ui/views/controls/textfield/textfield.h" - -namespace chromeos { - -class PassphraseTextfield : public views::Textfield { - public: - // If show_already_set is true, then the text field will show a fake password. - explicit PassphraseTextfield(bool show_fake); - - // Override views::Textfield so that when focus is gained, then clear out the - // fake password if appropriate. Replace it when focus is lost if the user has - // not typed in a new password. - virtual void OnFocus(); - virtual void OnBlur(); - - // Returns the passphrase. If it's unchanged, then returns an empty string. - std::string GetPassphrase(); - - private: - bool show_fake_; - bool changed_; -}; - -} // namespace chromeos - -#endif // CHROME_BROWSER_CHROMEOS_OPTIONS_PASSPHRASE_TEXTFIELD_H_ diff --git a/chrome/browser/chromeos/options/vpn_config_view.cc b/chrome/browser/chromeos/options/vpn_config_view.cc index f9654d1..efa457b 100644 --- a/chrome/browser/chromeos/options/vpn_config_view.cc +++ b/chrome/browser/chromeos/options/vpn_config_view.cc @@ -325,7 +325,7 @@ const std::string VPNConfigView::GetPSKPassphrase() const { if (psk_passphrase_textfield_ && enable_psk_passphrase_ && psk_passphrase_textfield_->visible()) - return GetPassphraseFromField(psk_passphrase_textfield_); + return GetTextFromField(psk_passphrase_textfield_, false); return std::string(); } @@ -334,7 +334,7 @@ const std::string VPNConfigView::GetUsername() const { } const std::string VPNConfigView::GetUserPassphrase() const { - return GetPassphraseFromField(user_passphrase_textfield_); + return GetTextFromField(user_passphrase_textfield_, false); } const std::string VPNConfigView::GetGroupName() const { @@ -481,8 +481,11 @@ void VPNConfigView::Init(VirtualNetwork* vpn) { psk_passphrase_label_ = new views::Label(l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PSK_PASSPHRASE)); layout->AddView(psk_passphrase_label_); - psk_passphrase_textfield_ = new PassphraseTextfield(vpn); + psk_passphrase_textfield_ = new views::Textfield( + views::Textfield::STYLE_OBSCURED); psk_passphrase_textfield_->SetController(this); + if (vpn && !vpn->psk_passphrase().empty()) + psk_passphrase_textfield_->SetText(UTF8ToUTF16(vpn->psk_passphrase())); layout->AddView(psk_passphrase_textfield_); layout->AddView( new ControlledSettingIndicatorView(psk_passphrase_ui_data_)); @@ -546,9 +549,12 @@ void VPNConfigView::Init(VirtualNetwork* vpn) { layout->StartRow(0, column_view_set_id); layout->AddView(new views::Label(l10n_util::GetStringUTF16( IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_PASSPHRASE))); - user_passphrase_textfield_ = new PassphraseTextfield(vpn); + user_passphrase_textfield_ = new views::Textfield( + views::Textfield::STYLE_OBSCURED); user_passphrase_textfield_->SetController(this); user_passphrase_textfield_->SetEnabled(user_passphrase_ui_data_.editable()); + if (vpn && !vpn->user_passphrase().empty()) + user_passphrase_textfield_->SetText(UTF8ToUTF16(vpn->user_passphrase())); layout->AddView(user_passphrase_textfield_); layout->AddView(new ControlledSettingIndicatorView(user_passphrase_ui_data_)); layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); @@ -779,13 +785,6 @@ const std::string VPNConfigView::GetTextFromField( return result; } -const std::string VPNConfigView::GetPassphraseFromField( - PassphraseTextfield* textfield) const { - if (!textfield) - return std::string(); - return textfield->GetPassphrase(); -} - void VPNConfigView::ParseVPNUIProperty(NetworkPropertyUIData* property_ui_data, Network* network, const std::string& key) { diff --git a/chrome/browser/chromeos/options/vpn_config_view.h b/chrome/browser/chromeos/options/vpn_config_view.h index defb407..152b140 100644 --- a/chrome/browser/chromeos/options/vpn_config_view.h +++ b/chrome/browser/chromeos/options/vpn_config_view.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,7 +11,6 @@ #include "base/string16.h" #include "chrome/browser/chromeos/cros/cert_library.h" #include "chrome/browser/chromeos/options/network_config_view.h" -#include "chrome/browser/chromeos/options/passphrase_textfield.h" #include "chrome/browser/ui/select_file_dialog.h" #include "ui/views/controls/button/button.h" #include "ui/views/controls/combobox/combobox_listener.h" @@ -88,10 +87,6 @@ class VPNConfigView : public ChildNetworkConfigView, const std::string GetTextFromField(views::Textfield* textfield, bool trim_whitespace) const; - // Get passphrase from input field. - const std::string GetPassphraseFromField( - PassphraseTextfield* textfield) const; - // Convenience methods to get text from input field or cached VirtualNetwork. const std::string GetService() const; const std::string GetServer() const; @@ -138,13 +133,13 @@ class VPNConfigView : public ChildNetworkConfigView, views::Combobox* provider_type_combobox_; views::Label* provider_type_text_label_; views::Label* psk_passphrase_label_; - PassphraseTextfield* psk_passphrase_textfield_; + views::Textfield* psk_passphrase_textfield_; views::Label* user_cert_label_; views::Combobox* user_cert_combobox_; views::Label* server_ca_cert_label_; views::Combobox* server_ca_cert_combobox_; views::Textfield* username_textfield_; - PassphraseTextfield* user_passphrase_textfield_; + views::Textfield* user_passphrase_textfield_; views::Label* otp_label_; views::Textfield* otp_textfield_; views::Label* group_name_label_; |