| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "chrome/browser/chromeos/enrollment_dialog_view.h" | 17 #include "chrome/browser/chromeos/enrollment_dialog_view.h" |
| 18 #include "chrome/browser/chromeos/net/shill_error.h" | 18 #include "chrome/browser/chromeos/net/shill_error.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/ui/views/harmony/layout_delegate.h" | |
| 21 #include "chrome/common/net/x509_certificate_model.h" | 20 #include "chrome/common/net/x509_certificate_model.h" |
| 22 #include "chrome/grit/generated_resources.h" | 21 #include "chrome/grit/generated_resources.h" |
| 23 #include "chromeos/login/login_state.h" | 22 #include "chromeos/login/login_state.h" |
| 24 #include "chromeos/network/network_configuration_handler.h" | 23 #include "chromeos/network/network_configuration_handler.h" |
| 25 #include "chromeos/network/network_connect.h" | 24 #include "chromeos/network/network_connect.h" |
| 26 #include "chromeos/network/network_event_log.h" | 25 #include "chromeos/network/network_event_log.h" |
| 27 #include "chromeos/network/network_state.h" | 26 #include "chromeos/network/network_state.h" |
| 28 #include "chromeos/network/network_state_handler.h" | 27 #include "chromeos/network/network_state_handler.h" |
| 29 #include "chromeos/network/network_ui_data.h" | 28 #include "chromeos/network/network_ui_data.h" |
| 30 #include "chromeos/network/onc/onc_utils.h" | 29 #include "chromeos/network/onc/onc_utils.h" |
| 31 #include "components/onc/onc_constants.h" | 30 #include "components/onc/onc_constants.h" |
| 32 #include "third_party/cros_system_api/dbus/service_constants.h" | 31 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 33 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
| 34 #include "ui/base/models/combobox_model.h" | 33 #include "ui/base/models/combobox_model.h" |
| 35 #include "ui/events/event.h" | 34 #include "ui/events/event.h" |
| 36 #include "ui/views/controls/button/checkbox.h" | 35 #include "ui/views/controls/button/checkbox.h" |
| 37 #include "ui/views/controls/combobox/combobox.h" | 36 #include "ui/views/controls/combobox/combobox.h" |
| 38 #include "ui/views/controls/label.h" | 37 #include "ui/views/controls/label.h" |
| 39 #include "ui/views/controls/textfield/textfield.h" | 38 #include "ui/views/controls/textfield/textfield.h" |
| 40 #include "ui/views/layout/grid_layout.h" | 39 #include "ui/views/layout/grid_layout.h" |
| 40 #include "ui/views/layout/layout_provider.h" |
| 41 #include "ui/views/widget/widget.h" | 41 #include "ui/views/widget/widget.h" |
| 42 #include "ui/views/window/dialog_client_view.h" | 42 #include "ui/views/window/dialog_client_view.h" |
| 43 | 43 |
| 44 namespace { | 44 namespace { |
| 45 | 45 |
| 46 enum ProviderTypeIndex { | 46 enum ProviderTypeIndex { |
| 47 PROVIDER_TYPE_INDEX_L2TP_IPSEC_PSK = 0, | 47 PROVIDER_TYPE_INDEX_L2TP_IPSEC_PSK = 0, |
| 48 PROVIDER_TYPE_INDEX_L2TP_IPSEC_USER_CERT = 1, | 48 PROVIDER_TYPE_INDEX_L2TP_IPSEC_USER_CERT = 1, |
| 49 PROVIDER_TYPE_INDEX_OPEN_VPN = 2, | 49 PROVIDER_TYPE_INDEX_OPEN_VPN = 2, |
| 50 PROVIDER_TYPE_INDEX_MAX = 3, | 50 PROVIDER_TYPE_INDEX_MAX = 3, |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 return std::string(); | 499 return std::string(); |
| 500 } | 500 } |
| 501 | 501 |
| 502 void VPNConfigView::Init() { | 502 void VPNConfigView::Init() { |
| 503 const NetworkState* vpn = NULL; | 503 const NetworkState* vpn = NULL; |
| 504 if (!service_path_.empty()) { | 504 if (!service_path_.empty()) { |
| 505 vpn = NetworkHandler::Get()->network_state_handler()-> | 505 vpn = NetworkHandler::Get()->network_state_handler()-> |
| 506 GetNetworkState(service_path_); | 506 GetNetworkState(service_path_); |
| 507 DCHECK(vpn && vpn->type() == shill::kTypeVPN); | 507 DCHECK(vpn && vpn->type() == shill::kTypeVPN); |
| 508 } | 508 } |
| 509 |
| 509 layout_ = views::GridLayout::CreatePanel(this); | 510 layout_ = views::GridLayout::CreatePanel(this); |
| 510 LayoutDelegate* delegate = LayoutDelegate::Get(); | 511 views::LayoutProvider* provider = views::LayoutProvider::Get(); |
| 511 | 512 |
| 512 // Observer any changes to the certificate list. | 513 // Observer any changes to the certificate list. |
| 513 CertLibrary::Get()->AddObserver(this); | 514 CertLibrary::Get()->AddObserver(this); |
| 514 | 515 |
| 515 views::ColumnSet* column_set = layout_->AddColumnSet(0); | 516 views::ColumnSet* column_set = layout_->AddColumnSet(0); |
| 516 // Label. | 517 // Label. |
| 517 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1, | 518 column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1, |
| 518 views::GridLayout::USE_PREF, 0, 0); | 519 views::GridLayout::USE_PREF, 0, 0); |
| 519 column_set->AddPaddingColumn( | 520 column_set->AddPaddingColumn( |
| 520 0, delegate->GetMetric( | 521 0, |
| 521 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING)); | 522 provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_HORIZONTAL)); |
| 522 // Textfield, combobox. | 523 // Textfield, combobox. |
| 523 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, | 524 column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, |
| 524 views::GridLayout::USE_PREF, 0, | 525 views::GridLayout::USE_PREF, 0, |
| 525 ChildNetworkConfigView::kInputFieldMinWidth); | 526 ChildNetworkConfigView::kInputFieldMinWidth); |
| 526 column_set->AddPaddingColumn( | 527 column_set->AddPaddingColumn( |
| 527 0, delegate->GetMetric( | 528 0, |
| 528 LayoutDelegate::Metric::RELATED_CONTROL_HORIZONTAL_SPACING)); | 529 provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_HORIZONTAL)); |
| 529 // Policy indicator. | 530 // Policy indicator. |
| 530 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, 0, | 531 column_set->AddColumn(views::GridLayout::CENTER, views::GridLayout::CENTER, 0, |
| 531 views::GridLayout::USE_PREF, 0, 0); | 532 views::GridLayout::USE_PREF, 0, 0); |
| 532 | 533 |
| 533 // Initialize members. | 534 // Initialize members. |
| 534 service_text_modified_ = false; | 535 service_text_modified_ = false; |
| 535 title_ = vpn ? IDS_OPTIONS_SETTINGS_JOIN_VPN : IDS_OPTIONS_SETTINGS_ADD_VPN; | 536 title_ = vpn ? IDS_OPTIONS_SETTINGS_JOIN_VPN : IDS_OPTIONS_SETTINGS_ADD_VPN; |
| 536 | 537 |
| 537 // By default enable all controls. | 538 // By default enable all controls. |
| 538 enable_psk_passphrase_ = true; | 539 enable_psk_passphrase_ = true; |
| 539 enable_user_cert_ = true; | 540 enable_user_cert_ = true; |
| 540 enable_server_ca_cert_ = true; | 541 enable_server_ca_cert_ = true; |
| 541 enable_otp_ = true; | 542 enable_otp_ = true; |
| 542 enable_group_name_ = true; | 543 enable_group_name_ = true; |
| 543 | 544 |
| 544 // Server label and input. | 545 // Server label and input. |
| 545 layout_->StartRow(0, 0); | 546 layout_->StartRow(0, 0); |
| 546 views::View* server_label = | 547 views::View* server_label = |
| 547 new views::Label(l10n_util::GetStringUTF16( | 548 new views::Label(l10n_util::GetStringUTF16( |
| 548 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVER_HOSTNAME)); | 549 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVER_HOSTNAME)); |
| 549 layout_->AddView(server_label); | 550 layout_->AddView(server_label); |
| 550 server_textfield_ = new views::Textfield(); | 551 server_textfield_ = new views::Textfield(); |
| 551 server_textfield_->set_controller(this); | 552 server_textfield_->set_controller(this); |
| 552 layout_->AddView(server_textfield_); | 553 layout_->AddView(server_textfield_); |
| 553 layout_->AddPaddingRow( | 554 layout_->AddPaddingRow( |
| 554 0, delegate->GetMetric( | 555 0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
| 555 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | |
| 556 if (!service_path_.empty()) { | 556 if (!service_path_.empty()) { |
| 557 server_label->SetEnabled(false); | 557 server_label->SetEnabled(false); |
| 558 server_textfield_->SetEnabled(false); | 558 server_textfield_->SetEnabled(false); |
| 559 } | 559 } |
| 560 | 560 |
| 561 // Service label and name or input. | 561 // Service label and name or input. |
| 562 layout_->StartRow(0, 0); | 562 layout_->StartRow(0, 0); |
| 563 layout_->AddView(new views::Label(l10n_util::GetStringUTF16( | 563 layout_->AddView(new views::Label(l10n_util::GetStringUTF16( |
| 564 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVICE_NAME))); | 564 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVICE_NAME))); |
| 565 if (service_path_.empty()) { | 565 if (service_path_.empty()) { |
| 566 service_textfield_ = new views::Textfield(); | 566 service_textfield_ = new views::Textfield(); |
| 567 service_textfield_->set_controller(this); | 567 service_textfield_->set_controller(this); |
| 568 layout_->AddView(service_textfield_); | 568 layout_->AddView(service_textfield_); |
| 569 service_text_ = NULL; | 569 service_text_ = NULL; |
| 570 } else { | 570 } else { |
| 571 service_text_ = new views::Label(); | 571 service_text_ = new views::Label(); |
| 572 service_text_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 572 service_text_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 573 layout_->AddView(service_text_); | 573 layout_->AddView(service_text_); |
| 574 service_textfield_ = NULL; | 574 service_textfield_ = NULL; |
| 575 } | 575 } |
| 576 layout_->AddPaddingRow( | 576 layout_->AddPaddingRow( |
| 577 0, delegate->GetMetric( | 577 0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
| 578 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | |
| 579 | 578 |
| 580 // Provider type label and select. | 579 // Provider type label and select. |
| 581 layout_->StartRow(0, 0); | 580 layout_->StartRow(0, 0); |
| 582 layout_->AddView(new views::Label(l10n_util::GetStringUTF16( | 581 layout_->AddView(new views::Label(l10n_util::GetStringUTF16( |
| 583 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PROVIDER_TYPE))); | 582 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PROVIDER_TYPE))); |
| 584 if (service_path_.empty()) { | 583 if (service_path_.empty()) { |
| 585 provider_type_combobox_model_.reset( | 584 provider_type_combobox_model_.reset( |
| 586 new internal::ProviderTypeComboboxModel); | 585 new internal::ProviderTypeComboboxModel); |
| 587 provider_type_combobox_ = new views::Combobox( | 586 provider_type_combobox_ = new views::Combobox( |
| 588 provider_type_combobox_model_.get()); | 587 provider_type_combobox_model_.get()); |
| 589 provider_type_combobox_->set_listener(this); | 588 provider_type_combobox_->set_listener(this); |
| 590 layout_->AddView(provider_type_combobox_); | 589 layout_->AddView(provider_type_combobox_); |
| 591 provider_type_text_label_ = NULL; | 590 provider_type_text_label_ = NULL; |
| 592 } else { | 591 } else { |
| 593 provider_type_text_label_ = new views::Label(); | 592 provider_type_text_label_ = new views::Label(); |
| 594 provider_type_text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 593 provider_type_text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 595 layout_->AddView(provider_type_text_label_); | 594 layout_->AddView(provider_type_text_label_); |
| 596 provider_type_combobox_ = NULL; | 595 provider_type_combobox_ = NULL; |
| 597 } | 596 } |
| 598 layout_->AddPaddingRow( | 597 layout_->AddPaddingRow( |
| 599 0, delegate->GetMetric( | 598 0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
| 600 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | |
| 601 | 599 |
| 602 // PSK passphrase label, input and visible button. | 600 // PSK passphrase label, input and visible button. |
| 603 layout_->StartRow(0, 0); | 601 layout_->StartRow(0, 0); |
| 604 psk_passphrase_label_ = new views::Label(l10n_util::GetStringUTF16( | 602 psk_passphrase_label_ = new views::Label(l10n_util::GetStringUTF16( |
| 605 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PSK_PASSPHRASE)); | 603 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PSK_PASSPHRASE)); |
| 606 layout_->AddView(psk_passphrase_label_); | 604 layout_->AddView(psk_passphrase_label_); |
| 607 psk_passphrase_textfield_ = new PassphraseTextfield(); | 605 psk_passphrase_textfield_ = new PassphraseTextfield(); |
| 608 psk_passphrase_textfield_->set_controller(this); | 606 psk_passphrase_textfield_->set_controller(this); |
| 609 layout_->AddView(psk_passphrase_textfield_); | 607 layout_->AddView(psk_passphrase_textfield_); |
| 610 layout_->AddView( | 608 layout_->AddView( |
| 611 new ControlledSettingIndicatorView(psk_passphrase_ui_data_)); | 609 new ControlledSettingIndicatorView(psk_passphrase_ui_data_)); |
| 612 layout_->AddPaddingRow( | 610 layout_->AddPaddingRow( |
| 613 0, delegate->GetMetric( | 611 0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
| 614 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | |
| 615 | 612 |
| 616 // Server CA certificate | 613 // Server CA certificate |
| 617 if (service_path_.empty()) { | 614 if (service_path_.empty()) { |
| 618 layout_->StartRow(0, 0); | 615 layout_->StartRow(0, 0); |
| 619 server_ca_cert_label_ = new views::Label(l10n_util::GetStringUTF16( | 616 server_ca_cert_label_ = new views::Label(l10n_util::GetStringUTF16( |
| 620 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA)); | 617 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA)); |
| 621 layout_->AddView(server_ca_cert_label_); | 618 layout_->AddView(server_ca_cert_label_); |
| 622 server_ca_cert_combobox_model_.reset( | 619 server_ca_cert_combobox_model_.reset( |
| 623 new internal::VpnServerCACertComboboxModel()); | 620 new internal::VpnServerCACertComboboxModel()); |
| 624 server_ca_cert_combobox_ = new views::Combobox( | 621 server_ca_cert_combobox_ = new views::Combobox( |
| 625 server_ca_cert_combobox_model_.get()); | 622 server_ca_cert_combobox_model_.get()); |
| 626 layout_->AddView(server_ca_cert_combobox_); | 623 layout_->AddView(server_ca_cert_combobox_); |
| 627 layout_->AddView(new ControlledSettingIndicatorView(ca_cert_ui_data_)); | 624 layout_->AddView(new ControlledSettingIndicatorView(ca_cert_ui_data_)); |
| 628 layout_->AddPaddingRow( | 625 layout_->AddPaddingRow(0, provider->GetDistanceMetric( |
| 629 0, delegate->GetMetric( | 626 views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
| 630 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | |
| 631 } else { | 627 } else { |
| 632 server_ca_cert_label_ = NULL; | 628 server_ca_cert_label_ = NULL; |
| 633 server_ca_cert_combobox_ = NULL; | 629 server_ca_cert_combobox_ = NULL; |
| 634 } | 630 } |
| 635 | 631 |
| 636 // User certificate label and input. | 632 // User certificate label and input. |
| 637 layout_->StartRow(0, 0); | 633 layout_->StartRow(0, 0); |
| 638 user_cert_label_ = new views::Label(l10n_util::GetStringUTF16( | 634 user_cert_label_ = new views::Label(l10n_util::GetStringUTF16( |
| 639 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_CERT)); | 635 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_CERT)); |
| 640 layout_->AddView(user_cert_label_); | 636 layout_->AddView(user_cert_label_); |
| 641 user_cert_combobox_model_.reset( | 637 user_cert_combobox_model_.reset( |
| 642 new internal::VpnUserCertComboboxModel()); | 638 new internal::VpnUserCertComboboxModel()); |
| 643 user_cert_combobox_ = new views::Combobox(user_cert_combobox_model_.get()); | 639 user_cert_combobox_ = new views::Combobox(user_cert_combobox_model_.get()); |
| 644 user_cert_combobox_->set_listener(this); | 640 user_cert_combobox_->set_listener(this); |
| 645 layout_->AddView(user_cert_combobox_); | 641 layout_->AddView(user_cert_combobox_); |
| 646 layout_->AddView(new ControlledSettingIndicatorView(user_cert_ui_data_)); | 642 layout_->AddView(new ControlledSettingIndicatorView(user_cert_ui_data_)); |
| 647 layout_->AddPaddingRow( | 643 layout_->AddPaddingRow( |
| 648 0, delegate->GetMetric( | 644 0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
| 649 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | |
| 650 | 645 |
| 651 // Username label and input. | 646 // Username label and input. |
| 652 layout_->StartRow(0, 0); | 647 layout_->StartRow(0, 0); |
| 653 layout_->AddView(new views::Label(l10n_util::GetStringUTF16( | 648 layout_->AddView(new views::Label(l10n_util::GetStringUTF16( |
| 654 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USERNAME))); | 649 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USERNAME))); |
| 655 username_textfield_ = new views::Textfield(); | 650 username_textfield_ = new views::Textfield(); |
| 656 username_textfield_->set_controller(this); | 651 username_textfield_->set_controller(this); |
| 657 username_textfield_->SetEnabled(username_ui_data_.IsEditable()); | 652 username_textfield_->SetEnabled(username_ui_data_.IsEditable()); |
| 658 layout_->AddView(username_textfield_); | 653 layout_->AddView(username_textfield_); |
| 659 layout_->AddView(new ControlledSettingIndicatorView(username_ui_data_)); | 654 layout_->AddView(new ControlledSettingIndicatorView(username_ui_data_)); |
| 660 layout_->AddPaddingRow( | 655 layout_->AddPaddingRow( |
| 661 0, delegate->GetMetric( | 656 0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
| 662 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | |
| 663 | 657 |
| 664 // User passphrase label, input and visble button. | 658 // User passphrase label, input and visble button. |
| 665 layout_->StartRow(0, 0); | 659 layout_->StartRow(0, 0); |
| 666 layout_->AddView(new views::Label(l10n_util::GetStringUTF16( | 660 layout_->AddView(new views::Label(l10n_util::GetStringUTF16( |
| 667 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_PASSPHRASE))); | 661 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_PASSPHRASE))); |
| 668 user_passphrase_textfield_ = new PassphraseTextfield(); | 662 user_passphrase_textfield_ = new PassphraseTextfield(); |
| 669 user_passphrase_textfield_->set_controller(this); | 663 user_passphrase_textfield_->set_controller(this); |
| 670 user_passphrase_textfield_->SetEnabled(user_passphrase_ui_data_.IsEditable()); | 664 user_passphrase_textfield_->SetEnabled(user_passphrase_ui_data_.IsEditable()); |
| 671 layout_->AddView(user_passphrase_textfield_); | 665 layout_->AddView(user_passphrase_textfield_); |
| 672 layout_->AddView( | 666 layout_->AddView( |
| 673 new ControlledSettingIndicatorView(user_passphrase_ui_data_)); | 667 new ControlledSettingIndicatorView(user_passphrase_ui_data_)); |
| 674 layout_->AddPaddingRow( | 668 layout_->AddPaddingRow( |
| 675 0, delegate->GetMetric( | 669 0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
| 676 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | |
| 677 | 670 |
| 678 // OTP label and input. | 671 // OTP label and input. |
| 679 layout_->StartRow(0, 0); | 672 layout_->StartRow(0, 0); |
| 680 otp_label_ = new views::Label(l10n_util::GetStringUTF16( | 673 otp_label_ = new views::Label(l10n_util::GetStringUTF16( |
| 681 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_OTP)); | 674 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_OTP)); |
| 682 layout_->AddView(otp_label_); | 675 layout_->AddView(otp_label_); |
| 683 otp_textfield_ = new views::Textfield(); | 676 otp_textfield_ = new views::Textfield(); |
| 684 otp_textfield_->set_controller(this); | 677 otp_textfield_->set_controller(this); |
| 685 layout_->AddView(otp_textfield_); | 678 layout_->AddView(otp_textfield_); |
| 686 layout_->AddPaddingRow( | 679 layout_->AddPaddingRow( |
| 687 0, delegate->GetMetric( | 680 0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
| 688 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | |
| 689 | 681 |
| 690 // Group Name label and input. | 682 // Group Name label and input. |
| 691 layout_->StartRow(0, 0); | 683 layout_->StartRow(0, 0); |
| 692 group_name_label_ = new views::Label(l10n_util::GetStringUTF16( | 684 group_name_label_ = new views::Label(l10n_util::GetStringUTF16( |
| 693 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_GROUP_NAME)); | 685 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_GROUP_NAME)); |
| 694 layout_->AddView(group_name_label_); | 686 layout_->AddView(group_name_label_); |
| 695 group_name_textfield_ = | 687 group_name_textfield_ = |
| 696 new views::Textfield(); | 688 new views::Textfield(); |
| 697 group_name_textfield_->set_controller(this); | 689 group_name_textfield_->set_controller(this); |
| 698 layout_->AddView(group_name_textfield_); | 690 layout_->AddView(group_name_textfield_); |
| 699 layout_->AddView(new ControlledSettingIndicatorView(group_name_ui_data_)); | 691 layout_->AddView(new ControlledSettingIndicatorView(group_name_ui_data_)); |
| 700 layout_->AddPaddingRow( | 692 layout_->AddPaddingRow( |
| 701 0, delegate->GetMetric( | 693 0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)); |
| 702 LayoutDelegate::Metric::RELATED_CONTROL_VERTICAL_SPACING)); | |
| 703 | 694 |
| 704 // Save credentials | 695 // Save credentials |
| 705 layout_->StartRow(0, 0); | 696 layout_->StartRow(0, 0); |
| 706 save_credentials_checkbox_ = new views::Checkbox( | 697 save_credentials_checkbox_ = new views::Checkbox( |
| 707 l10n_util::GetStringUTF16( | 698 l10n_util::GetStringUTF16( |
| 708 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS)); | 699 IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS)); |
| 709 save_credentials_checkbox_->SetEnabled( | 700 save_credentials_checkbox_->SetEnabled( |
| 710 save_credentials_ui_data_.IsEditable()); | 701 save_credentials_ui_data_.IsEditable()); |
| 711 layout_->SkipColumns(1); | 702 layout_->SkipColumns(1); |
| 712 layout_->AddView(save_credentials_checkbox_); | 703 layout_->AddView(save_credentials_checkbox_); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 property_ui_data->ParseOncProperty( | 1087 property_ui_data->ParseOncProperty( |
| 1097 onc_source, | 1088 onc_source, |
| 1098 onc, | 1089 onc, |
| 1099 base::StringPrintf("%s.%s.%s", | 1090 base::StringPrintf("%s.%s.%s", |
| 1100 ::onc::network_config::kVPN, | 1091 ::onc::network_config::kVPN, |
| 1101 dict_key.c_str(), | 1092 dict_key.c_str(), |
| 1102 key.c_str())); | 1093 key.c_str())); |
| 1103 } | 1094 } |
| 1104 | 1095 |
| 1105 } // namespace chromeos | 1096 } // namespace chromeos |
| OLD | NEW |