Skip to content

Commit

Permalink
Reverted by Chrome sheriff. Seems to break OneClickSigninDialogViewTest.
Browse files Browse the repository at this point in the history
See https://uberchromegw.corp.google.com/i/chromium.memory/builders/Linux%20CFI/builds/1395/steps/unit_tests

Revert "Delete GridLayout::CreatePanel."

This reverts commit f6194b5.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> Delete GridLayout::CreatePanel.
> 
> Subclasses of DialogDelegate now call set_margin. Other usages
> explicitly set a border on themselves. This decouples GridLayout
> creation and actual layout declaration.
> 
> Also made GridLayout call SetLayoutManager on the host when
> constructed, since we never want to not call it.
> 
> Bug: 733040
> Change-Id: I4272d5a78f5b0b78ce15bb6b75867d44a879d7c8
> Reviewed-on: https://chromium-review.googlesource.com/627096
> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
> Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
> Reviewed-by: Scott Violet <sky@chromium.org>
> Commit-Queue: Bret Sepulveda <bsep@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#497584}

NOTRY=TRUE
TBR=xiyuan@chromium.org,dgozman@chromium.org,sky@chromium.org,bsep@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 733040
Change-Id: Icf677a1de200d7b1fe3b51b480fb5b547a431c90
Reviewed-on: https://chromium-review.googlesource.com/636244
Commit-Queue: Henrik Andreasson <henrika@chromium.org>
Reviewed-by: Henrik Andreasson <henrika@chromium.org>
Cr-Commit-Position: refs/heads/master@{#497720}
  • Loading branch information
henrikand authored and Commit Bot committed Aug 28, 2017
1 parent c300ce1 commit 64e2f76
Show file tree
Hide file tree
Showing 85 changed files with 499 additions and 497 deletions.
3 changes: 2 additions & 1 deletion ash/shell/window_type_launcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ WindowTypeLauncher::WindowTypeLauncher(
this,
base::ASCIIToUTF16("Show a web/app notification"))),
show_views_examples_callback_(show_views_examples_callback) {
views::GridLayout* layout = views::GridLayout::CreateAndInstall(this);
views::GridLayout* layout = new views::GridLayout(this);
SetLayoutManager(layout);
SetBorder(views::CreateEmptyBorder(gfx::Insets(5)));
views::ColumnSet* column_set = layout->AddColumnSet(0);
column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER,
Expand Down
3 changes: 2 additions & 1 deletion ash/system/date/date_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ void TimeView::UpdateClockLayout(ClockLayout clock_layout) {
AddChildView(horizontal_label_.get());
} else {
RemoveChildView(horizontal_label_.get());
views::GridLayout* layout = views::GridLayout::CreateAndInstall(this);
views::GridLayout* layout = new views::GridLayout(this);
SetLayoutManager(layout);
const int kColumnId = 0;
views::ColumnSet* columns = layout->AddColumnSet(kColumnId);
columns->AddPaddingColumn(0, kVerticalClockLeftPadding);
Expand Down
3 changes: 2 additions & 1 deletion ash/system/status_area_widget_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ void StatusAreaWidgetDelegate::AddTray(views::View* tray) {
void StatusAreaWidgetDelegate::UpdateLayout() {
// Use a grid layout so that the trays can be centered in each cell, and
// so that the widget gets laid out correctly when tray sizes change.
views::GridLayout* layout = views::GridLayout::CreateAndInstall(this);
views::GridLayout* layout = new views::GridLayout(this);
SetLayoutManager(layout);

// Update tray border based on layout.
bool is_child_on_edge = true;
Expand Down
4 changes: 1 addition & 3 deletions chrome/browser/chromeos/enrollment_dialog_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ EnrollmentDialogView::EnrollmentDialogView(const std::string& network_name,
target_uri_(target_uri),
connect_(connect),
added_cert_(false) {
set_margins(ChromeLayoutProvider::Get()->GetInsetsMetric(
views::INSETS_DIALOG_CONTENTS));
chrome::RecordDialogCreation(chrome::DialogIdentifier::ENROLLMENT);
}

Expand Down Expand Up @@ -166,7 +164,7 @@ void EnrollmentDialogView::InitDialog() {
label->SetMultiLine(true);
label->SetAllowCharacterBreak(true);

views::GridLayout* grid_layout = views::GridLayout::CreateAndInstall(this);
views::GridLayout* grid_layout = views::GridLayout::CreatePanel(this);

views::ColumnSet* columns = grid_layout->AddColumnSet(0);
columns->AddColumn(views::GridLayout::FILL, // Horizontal resize.
Expand Down
6 changes: 4 additions & 2 deletions chrome/browser/chromeos/login/ui/simple_web_view_dialog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ class ToolbarRowView : public views::View {
views::View* forward,
views::View* reload,
views::View* location_bar) {
GridLayout* layout = GridLayout::CreateAndInstall(this);
GridLayout* layout = new GridLayout(this);
SetLayoutManager(layout);

const int related_horizontal_spacing =
ChromeLayoutProvider::Get()->GetDistanceMetric(
Expand Down Expand Up @@ -209,7 +210,8 @@ void SimpleWebViewDialog::Init() {
toolbar_row->Init(back_, forward_, reload_, location_bar_);

// Layout.
GridLayout* layout = GridLayout::CreateAndInstall(this);
GridLayout* layout = new GridLayout(this);
SetLayoutManager(layout);

views::ColumnSet* column_set = layout->AddColumnSet(0);
column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
Expand Down
125 changes: 62 additions & 63 deletions chrome/browser/chromeos/options/vpn_config_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/combobox_model.h"
#include "ui/events/event.h"
#include "ui/views/border.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/combobox/combobox.h"
#include "ui/views/controls/label.h"
Expand Down Expand Up @@ -237,6 +236,7 @@ VPNConfigView::VPNConfigView(NetworkConfigView* parent,
enable_group_name_(false),
user_passphrase_required_(false),
title_(0),
layout_(NULL),
server_textfield_(NULL),
service_text_(NULL),
service_textfield_(NULL),
Expand Down Expand Up @@ -495,23 +495,20 @@ std::string VPNConfigView::GetProviderTypeString() const {
}

void VPNConfigView::Init() {
const views::LayoutProvider* provider = views::LayoutProvider::Get();
SetBorder(views::CreateEmptyBorder(
provider->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS)));

const NetworkState* vpn = NULL;
if (!service_path_.empty()) {
vpn = NetworkHandler::Get()->network_state_handler()->
GetNetworkState(service_path_);
DCHECK(vpn && vpn->type() == shill::kTypeVPN);
}

views::GridLayout* layout = views::GridLayout::CreateAndInstall(this);
layout_ = views::GridLayout::CreatePanel(this);
views::LayoutProvider* provider = views::LayoutProvider::Get();

// Observer any changes to the certificate list.
CertLibrary::Get()->AddObserver(this);

views::ColumnSet* column_set = layout->AddColumnSet(0);
views::ColumnSet* column_set = layout_->AddColumnSet(0);
// Label.
column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL, 1,
views::GridLayout::USE_PREF, 0, 0);
Expand Down Expand Up @@ -541,172 +538,174 @@ void VPNConfigView::Init() {
enable_group_name_ = true;

// Server label and input.
layout->StartRow(0, 0);
layout_->StartRow(0, 0);
views::View* server_label =
new views::Label(l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVER_HOSTNAME));
layout->AddView(server_label);
layout_->AddView(server_label);
server_textfield_ = new views::Textfield();
server_textfield_->set_controller(this);
layout->AddView(server_textfield_);
layout->AddPaddingRow(
layout_->AddView(server_textfield_);
layout_->AddPaddingRow(
0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL));
if (!service_path_.empty()) {
server_label->SetEnabled(false);
server_textfield_->SetEnabled(false);
}

// Service label and name or input.
layout->StartRow(0, 0);
layout->AddView(new views::Label(l10n_util::GetStringUTF16(
layout_->StartRow(0, 0);
layout_->AddView(new views::Label(l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_SERVICE_NAME)));
if (service_path_.empty()) {
service_textfield_ = new views::Textfield();
service_textfield_->set_controller(this);
layout->AddView(service_textfield_);
layout_->AddView(service_textfield_);
service_text_ = NULL;
} else {
service_text_ = new views::Label();
service_text_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
layout->AddView(service_text_);
layout_->AddView(service_text_);
service_textfield_ = NULL;
}
layout->AddPaddingRow(
layout_->AddPaddingRow(
0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL));

// Provider type label and select.
layout->StartRow(0, 0);
layout->AddView(new views::Label(l10n_util::GetStringUTF16(
layout_->StartRow(0, 0);
layout_->AddView(new views::Label(l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PROVIDER_TYPE)));
if (service_path_.empty()) {
provider_type_combobox_model_.reset(
new internal::ProviderTypeComboboxModel);
provider_type_combobox_ = new views::Combobox(
provider_type_combobox_model_.get());
provider_type_combobox_->set_listener(this);
layout->AddView(provider_type_combobox_);
layout_->AddView(provider_type_combobox_);
provider_type_text_label_ = NULL;
} else {
provider_type_text_label_ = new views::Label();
provider_type_text_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
layout->AddView(provider_type_text_label_);
layout_->AddView(provider_type_text_label_);
provider_type_combobox_ = NULL;
}
layout->AddPaddingRow(
layout_->AddPaddingRow(
0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL));

// PSK passphrase label, input and visible button.
layout->StartRow(0, 0);
layout_->StartRow(0, 0);
psk_passphrase_label_ = new views::Label(l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_PSK_PASSPHRASE));
layout->AddView(psk_passphrase_label_);
layout_->AddView(psk_passphrase_label_);
psk_passphrase_textfield_ = new PassphraseTextfield();
psk_passphrase_textfield_->set_controller(this);
layout->AddView(psk_passphrase_textfield_);
layout->AddView(new ControlledSettingIndicatorView(psk_passphrase_ui_data_));
layout->AddPaddingRow(
layout_->AddView(psk_passphrase_textfield_);
layout_->AddView(
new ControlledSettingIndicatorView(psk_passphrase_ui_data_));
layout_->AddPaddingRow(
0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL));

// Server CA certificate
if (service_path_.empty()) {
layout->StartRow(0, 0);
layout_->StartRow(0, 0);
server_ca_cert_label_ = new views::Label(l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_SERVER_CA));
layout->AddView(server_ca_cert_label_);
layout_->AddView(server_ca_cert_label_);
server_ca_cert_combobox_model_.reset(
new internal::VpnServerCACertComboboxModel());
server_ca_cert_combobox_ = new views::Combobox(
server_ca_cert_combobox_model_.get());
layout->AddView(server_ca_cert_combobox_);
layout->AddView(new ControlledSettingIndicatorView(ca_cert_ui_data_));
layout->AddPaddingRow(0, provider->GetDistanceMetric(
views::DISTANCE_RELATED_CONTROL_VERTICAL));
layout_->AddView(server_ca_cert_combobox_);
layout_->AddView(new ControlledSettingIndicatorView(ca_cert_ui_data_));
layout_->AddPaddingRow(0, provider->GetDistanceMetric(
views::DISTANCE_RELATED_CONTROL_VERTICAL));
} else {
server_ca_cert_label_ = NULL;
server_ca_cert_combobox_ = NULL;
}

// User certificate label and input.
layout->StartRow(0, 0);
layout_->StartRow(0, 0);
user_cert_label_ = new views::Label(l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_CERT));
layout->AddView(user_cert_label_);
layout_->AddView(user_cert_label_);
user_cert_combobox_model_.reset(
new internal::VpnUserCertComboboxModel());
user_cert_combobox_ = new views::Combobox(user_cert_combobox_model_.get());
user_cert_combobox_->set_listener(this);
layout->AddView(user_cert_combobox_);
layout->AddView(new ControlledSettingIndicatorView(user_cert_ui_data_));
layout->AddPaddingRow(
layout_->AddView(user_cert_combobox_);
layout_->AddView(new ControlledSettingIndicatorView(user_cert_ui_data_));
layout_->AddPaddingRow(
0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL));

// Username label and input.
layout->StartRow(0, 0);
layout->AddView(new views::Label(l10n_util::GetStringUTF16(
layout_->StartRow(0, 0);
layout_->AddView(new views::Label(l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USERNAME)));
username_textfield_ = new views::Textfield();
username_textfield_->set_controller(this);
username_textfield_->SetEnabled(username_ui_data_.IsEditable());
layout->AddView(username_textfield_);
layout->AddView(new ControlledSettingIndicatorView(username_ui_data_));
layout->AddPaddingRow(
layout_->AddView(username_textfield_);
layout_->AddView(new ControlledSettingIndicatorView(username_ui_data_));
layout_->AddPaddingRow(
0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL));

// User passphrase label, input and visble button.
layout->StartRow(0, 0);
layout->AddView(new views::Label(l10n_util::GetStringUTF16(
layout_->StartRow(0, 0);
layout_->AddView(new views::Label(l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_USER_PASSPHRASE)));
user_passphrase_textfield_ = new PassphraseTextfield();
user_passphrase_textfield_->set_controller(this);
user_passphrase_textfield_->SetEnabled(user_passphrase_ui_data_.IsEditable());
layout->AddView(user_passphrase_textfield_);
layout->AddView(new ControlledSettingIndicatorView(user_passphrase_ui_data_));
layout->AddPaddingRow(
layout_->AddView(user_passphrase_textfield_);
layout_->AddView(
new ControlledSettingIndicatorView(user_passphrase_ui_data_));
layout_->AddPaddingRow(
0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL));

// OTP label and input.
layout->StartRow(0, 0);
layout_->StartRow(0, 0);
otp_label_ = new views::Label(l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_OTP));
layout->AddView(otp_label_);
layout_->AddView(otp_label_);
otp_textfield_ = new views::Textfield();
otp_textfield_->set_controller(this);
layout->AddView(otp_textfield_);
layout->AddPaddingRow(
layout_->AddView(otp_textfield_);
layout_->AddPaddingRow(
0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL));

// Group Name label and input.
layout->StartRow(0, 0);
layout_->StartRow(0, 0);
group_name_label_ = new views::Label(l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_VPN_GROUP_NAME));
layout->AddView(group_name_label_);
layout_->AddView(group_name_label_);
group_name_textfield_ =
new views::Textfield();
group_name_textfield_->set_controller(this);
layout->AddView(group_name_textfield_);
layout->AddView(new ControlledSettingIndicatorView(group_name_ui_data_));
layout->AddPaddingRow(
layout_->AddView(group_name_textfield_);
layout_->AddView(new ControlledSettingIndicatorView(group_name_ui_data_));
layout_->AddPaddingRow(
0, provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL));

// Save credentials
layout->StartRow(0, 0);
layout_->StartRow(0, 0);
save_credentials_checkbox_ = new views::Checkbox(
l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SAVE_CREDENTIALS));
save_credentials_checkbox_->SetEnabled(
save_credentials_ui_data_.IsEditable());
layout->SkipColumns(1);
layout->AddView(save_credentials_checkbox_);
layout->AddView(
layout_->SkipColumns(1);
layout_->AddView(save_credentials_checkbox_);
layout_->AddView(
new ControlledSettingIndicatorView(save_credentials_ui_data_));

// Error label.
layout->StartRow(0, 0);
layout->SkipColumns(1);
layout_->StartRow(0, 0);
layout_->SkipColumns(1);
error_label_ = new views::Label();
error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
error_label_->SetEnabledColor(SK_ColorRED);
layout->AddView(error_label_);
layout_->AddView(error_label_);

// Set or hide the UI, update comboboxes and error labels.
Refresh();
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/chromeos/options/vpn_config_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class DictionaryValue;

namespace views {
class Checkbox;
class GridLayout;
class Label;
}

Expand Down Expand Up @@ -158,6 +159,7 @@ class VPNConfigView : public ChildNetworkConfigView,

int title_;

views::GridLayout* layout_;
views::Textfield* server_textfield_;
views::Label* service_text_;
views::Textfield* service_textfield_;
Expand Down
8 changes: 2 additions & 6 deletions chrome/browser/chromeos/options/wifi_config_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/events/event.h"
#include "ui/views/border.h"
#include "ui/views/controls/button/checkbox.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/combobox/combobox.h"
Expand Down Expand Up @@ -905,10 +904,6 @@ void WifiConfigView::Cancel() {
}

void WifiConfigView::Init(bool show_8021x) {
views::LayoutProvider* provider = views::LayoutProvider::Get();
SetBorder(views::CreateEmptyBorder(
provider->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS)));

const NetworkState* network = GetNetworkState();
if (network) {
if (network->type() == shill::kTypeWifi) {
Expand Down Expand Up @@ -943,7 +938,8 @@ void WifiConfigView::Init(bool show_8021x) {
ParseUIProperty(&passphrase_ui_data_, network, ::onc::wifi::kPassphrase);
}

views::GridLayout* layout = views::GridLayout::CreateAndInstall(this);
views::GridLayout* layout = views::GridLayout::CreatePanel(this);
views::LayoutProvider* provider = views::LayoutProvider::Get();

const int column_view_set_id = 0;
views::ColumnSet* column_set = layout->AddColumnSet(column_view_set_id);
Expand Down
Loading

0 comments on commit 64e2f76

Please sign in to comment.