Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: chrome/browser/chromeos/options/vpn_config_view.cc

Issue 9296009: Fix WiFi & VPN connection dialogs when controls a disabled through policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nit, rebase Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/options/wifi_config_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 316 }
317 317
318 const std::string VPNConfigView::GetServer() const { 318 const std::string VPNConfigView::GetServer() const {
319 if (server_textfield_ != NULL) 319 if (server_textfield_ != NULL)
320 return GetTextFromField(server_textfield_, true); 320 return GetTextFromField(server_textfield_, true);
321 return server_hostname_; 321 return server_hostname_;
322 } 322 }
323 323
324 const std::string VPNConfigView::GetPSKPassphrase() const { 324 const std::string VPNConfigView::GetPSKPassphrase() const {
325 if (psk_passphrase_textfield_ && 325 if (psk_passphrase_textfield_ &&
326 psk_passphrase_textfield_->enabled() && 326 enable_psk_passphrase_ &&
327 psk_passphrase_textfield_->visible()) 327 psk_passphrase_textfield_->visible())
328 return GetTextFromField(psk_passphrase_textfield_, false); 328 return GetTextFromField(psk_passphrase_textfield_, false);
329 return std::string(); 329 return std::string();
330 } 330 }
331 331
332 const std::string VPNConfigView::GetUsername() const { 332 const std::string VPNConfigView::GetUsername() const {
333 return GetTextFromField(username_textfield_, true); 333 return GetTextFromField(username_textfield_, true);
334 } 334 }
335 335
336 const std::string VPNConfigView::GetUserPassphrase() const { 336 const std::string VPNConfigView::GetUserPassphrase() const {
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 612
613 void VPNConfigView::Refresh() { 613 void VPNConfigView::Refresh() {
614 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); 614 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
615 615
616 UpdateControls(); 616 UpdateControls();
617 617
618 // Set certificate combo boxes. 618 // Set certificate combo boxes.
619 VirtualNetwork* vpn = cros->FindVirtualNetworkByPath(service_path_); 619 VirtualNetwork* vpn = cros->FindVirtualNetworkByPath(service_path_);
620 if (server_ca_cert_combobox_) { 620 if (server_ca_cert_combobox_) {
621 server_ca_cert_combobox_->ModelChanged(); 621 server_ca_cert_combobox_->ModelChanged();
622 if (server_ca_cert_combobox_->enabled() && 622 if (enable_server_ca_cert_ &&
623 (vpn && !vpn->ca_cert_nss().empty())) { 623 (vpn && !vpn->ca_cert_nss().empty())) {
624 // Select the current server CA certificate in the combobox. 624 // Select the current server CA certificate in the combobox.
625 int cert_index = cert_library_->GetCACertificates().FindCertByNickname( 625 int cert_index = cert_library_->GetCACertificates().FindCertByNickname(
626 vpn->ca_cert_nss()); 626 vpn->ca_cert_nss());
627 if (cert_index >= 0) { 627 if (cert_index >= 0) {
628 // Skip item for "Default" 628 // Skip item for "Default"
629 server_ca_cert_combobox_->SetSelectedItem(1 + cert_index); 629 server_ca_cert_combobox_->SetSelectedItem(1 + cert_index);
630 } else { 630 } else {
631 server_ca_cert_combobox_->SetSelectedItem(0); 631 server_ca_cert_combobox_->SetSelectedItem(0);
632 } 632 }
633 } else { 633 } else {
634 server_ca_cert_combobox_->SetSelectedItem(0); 634 server_ca_cert_combobox_->SetSelectedItem(0);
635 } 635 }
636 } 636 }
637 637
638 if (user_cert_combobox_) { 638 if (user_cert_combobox_) {
639 user_cert_combobox_->ModelChanged(); 639 user_cert_combobox_->ModelChanged();
640 if (user_cert_combobox_->enabled() && 640 if (enable_user_cert_ &&
641 (vpn && !vpn->client_cert_id().empty())) { 641 (vpn && !vpn->client_cert_id().empty())) {
642 int cert_index = cert_library_->GetUserCertificates().FindCertByPkcs11Id( 642 int cert_index = cert_library_->GetUserCertificates().FindCertByPkcs11Id(
643 vpn->client_cert_id()); 643 vpn->client_cert_id());
644 if (cert_index >= 0) 644 if (cert_index >= 0)
645 user_cert_combobox_->SetSelectedItem(cert_index); 645 user_cert_combobox_->SetSelectedItem(cert_index);
646 else 646 else
647 user_cert_combobox_->SetSelectedItem(0); 647 user_cert_combobox_->SetSelectedItem(0);
648 } else { 648 } else {
649 user_cert_combobox_->SetSelectedItem(0); 649 user_cert_combobox_->SetSelectedItem(0);
650 } 650 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 754
755 bool VPNConfigView::UserCertRequired() const { 755 bool VPNConfigView::UserCertRequired() const {
756 return provider_type_ == PROVIDER_TYPE_L2TP_IPSEC_USER_CERT; 756 return provider_type_ == PROVIDER_TYPE_L2TP_IPSEC_USER_CERT;
757 } 757 }
758 758
759 bool VPNConfigView::HaveUserCerts() const { 759 bool VPNConfigView::HaveUserCerts() const {
760 return cert_library_->GetUserCertificates().Size() > 0; 760 return cert_library_->GetUserCertificates().Size() > 0;
761 } 761 }
762 762
763 bool VPNConfigView::IsUserCertValid() const { 763 bool VPNConfigView::IsUserCertValid() const {
764 if (!user_cert_combobox_ || !user_cert_combobox_->enabled()) 764 if (!user_cert_combobox_ || !enable_user_cert_)
765 return false; 765 return false;
766 int selected = user_cert_combobox_->selected_item(); 766 int selected = user_cert_combobox_->selected_item();
767 if (selected < 0) 767 if (selected < 0)
768 return false; 768 return false;
769 // Currently only hardware-backed user certificates are valid. 769 // Currently only hardware-backed user certificates are valid.
770 if (cert_library_->IsHardwareBacked() && 770 if (cert_library_->IsHardwareBacked() &&
771 !cert_library_->GetUserCertificates().IsHardwareBackedAt(selected)) 771 !cert_library_->GetUserCertificates().IsHardwareBackedAt(selected))
772 return false; 772 return false;
773 return true; 773 return true;
774 } 774 }
(...skipping 24 matching lines...) Expand all
799 std::string vpn_type; 799 std::string vpn_type;
800 if (!vpn_dict || !vpn_dict->GetString(onc::kType, &vpn_type)) 800 if (!vpn_dict || !vpn_dict->GetString(onc::kType, &vpn_type))
801 return; 801 return;
802 802
803 property_ui_data->ParseOncProperty( 803 property_ui_data->ParseOncProperty(
804 network->ui_data(), onc, 804 network->ui_data(), onc,
805 base::StringPrintf("%s.%s.%s", onc::kVPN, vpn_type.c_str(), key.c_str())); 805 base::StringPrintf("%s.%s.%s", onc::kVPN, vpn_type.c_str(), key.c_str()));
806 } 806 }
807 807
808 } // namespace chromeos 808 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/options/wifi_config_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698