| Index: chrome/browser/ui/views/login_view.cc
|
| diff --git a/chrome/browser/ui/views/login_view.cc b/chrome/browser/ui/views/login_view.cc
|
| index 9e74897cb6a4fb93fa60c19c698915bb944724d0..7f1ff33705a557f6d99664ddd278ee25cdbbd9d0 100644
|
| --- a/chrome/browser/ui/views/login_view.cc
|
| +++ b/chrome/browser/ui/views/login_view.cc
|
| @@ -4,12 +4,13 @@
|
|
|
| #include "chrome/browser/ui/views/login_view.h"
|
|
|
| +#include "chrome/browser/ui/views/harmony/layout_delegate.h"
|
| +#include "chrome/browser/ui/views/layout_utils.h"
|
| #include "components/strings/grit/components_strings.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| #include "ui/views/controls/label.h"
|
| #include "ui/views/controls/textfield/textfield.h"
|
| #include "ui/views/layout/grid_layout.h"
|
| -#include "ui/views/layout/layout_constants.h"
|
|
|
| static const int kMessageWidth = 320;
|
| static const int kTextfieldStackHorizontalSpacing = 30;
|
| @@ -32,6 +33,7 @@ LoginView::LoginView(const base::string16& authority,
|
| authority_label_(new views::Label(authority)),
|
| message_label_(nullptr),
|
| login_model_(login_model_data ? login_model_data->model : nullptr) {
|
| + LayoutDelegate* layout_delegate = LayoutDelegate::Get();
|
| password_field_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
|
|
|
| authority_label_->SetMultiLine(true);
|
| @@ -39,8 +41,7 @@ LoginView::LoginView(const base::string16& authority,
|
| authority_label_->SetAllowCharacterBreak(true);
|
|
|
| // Initialize the Grid Layout Manager used for this dialog box.
|
| - GridLayout* layout = GridLayout::CreatePanel(this);
|
| - SetLayoutManager(layout);
|
| + GridLayout* layout = layout_utils::CreatePanelLayout(this);
|
|
|
| // Add the column set for the information message at the top of the dialog
|
| // box.
|
| @@ -53,13 +54,17 @@ LoginView::LoginView(const base::string16& authority,
|
| // Add the column set for the user name and password fields and labels.
|
| const int labels_column_set_id = 1;
|
| column_set = layout->AddColumnSet(labels_column_set_id);
|
| - column_set->AddPaddingColumn(0, kTextfieldStackHorizontalSpacing);
|
| - column_set->AddColumn(views::kControlLabelGridAlignment, GridLayout::CENTER,
|
| - 0, GridLayout::USE_PREF, 0, 0);
|
| - column_set->AddPaddingColumn(0, views::kRelatedControlHorizontalSpacing);
|
| + if (layout_delegate->UseExtraDialogPadding())
|
| + column_set->AddPaddingColumn(0, kTextfieldStackHorizontalSpacing);
|
| + column_set->AddColumn(layout_delegate->GetControlLabelGridAlignment(),
|
| + GridLayout::CENTER, 0, GridLayout::USE_PREF, 0, 0);
|
| + column_set->AddPaddingColumn(0, layout_delegate->GetLayoutDistance(
|
| + LayoutDelegate::LayoutDistanceType::
|
| + RELATED_CONTROL_HORIZONTAL_SPACING));
|
| column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1,
|
| GridLayout::USE_PREF, 0, 0);
|
| - column_set->AddPaddingColumn(0, kTextfieldStackHorizontalSpacing);
|
| + if (layout_delegate->UseExtraDialogPadding())
|
| + column_set->AddPaddingColumn(0, kTextfieldStackHorizontalSpacing);
|
|
|
| layout->StartRow(0, single_column_view_set_id);
|
| layout->AddView(authority_label_);
|
| @@ -68,24 +73,34 @@ LoginView::LoginView(const base::string16& authority,
|
| message_label_->SetMultiLine(true);
|
| message_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
|
| message_label_->SetAllowCharacterBreak(true);
|
| - layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
|
| + layout->AddPaddingRow(0, layout_delegate->GetLayoutDistance(
|
| + LayoutDelegate::LayoutDistanceType::
|
| + RELATED_CONTROL_VERTICAL_SPACING));
|
| layout->StartRow(0, single_column_view_set_id);
|
| layout->AddView(message_label_);
|
| }
|
|
|
| - layout->AddPaddingRow(0, views::kUnrelatedControlLargeVerticalSpacing);
|
| + layout->AddPaddingRow(0, layout_delegate->GetLayoutDistance(
|
| + LayoutDelegate::LayoutDistanceType::
|
| + UNRELATED_CONTROL_LARGE_VERTICAL_SPACING));
|
|
|
| layout->StartRow(0, labels_column_set_id);
|
| layout->AddView(username_label_);
|
| layout->AddView(username_field_);
|
|
|
| - layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
|
| + layout->AddPaddingRow(0, layout_delegate->GetLayoutDistance(
|
| + LayoutDelegate::LayoutDistanceType::
|
| + RELATED_CONTROL_VERTICAL_SPACING));
|
|
|
| layout->StartRow(0, labels_column_set_id);
|
| layout->AddView(password_label_);
|
| layout->AddView(password_field_);
|
|
|
| - layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing);
|
| + if (layout_delegate->UseExtraDialogPadding()) {
|
| + layout->AddPaddingRow(0, layout_delegate->GetLayoutDistance(
|
| + LayoutDelegate::LayoutDistanceType::
|
| + UNRELATED_CONTROL_VERTICAL_SPACING));
|
| + }
|
|
|
| if (login_model_data) {
|
| login_model_->AddObserverAndDeliverCredentials(this,
|
|
|