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