Commit 0cca6ff3 authored by Thomas Tellier's avatar Thomas Tellier Committed by Commit Bot

[CrOS] Fix learn more dialog for public account on login screen

Bug: 1147043,1104336,1050589
Change-Id: Ib3b327975298edc35c53322cf1aba03f8342b010
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2547292
Commit-Queue: Thomas Tellier <tellier@google.com>
Reviewed-by: default avatarMichael Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#830686}
parent 453b6ffe
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "ui/views/border.h" #include "ui/views/border.h"
#include "ui/views/bubble/bubble_frame_view.h" #include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/flex_layout.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
namespace ash { namespace ash {
...@@ -19,14 +19,13 @@ namespace ash { ...@@ -19,14 +19,13 @@ namespace ash {
namespace { namespace {
constexpr int kDialogWidthDp = 400; constexpr int kDialogWidthDp = 400;
constexpr int kDialogHeightDp = 160;
constexpr int kDialogContentMarginDp = 13; constexpr int kDialogContentMarginDp = 13;
constexpr int kBulletRadiusDp = 2; constexpr int kBulletRadiusDp = 2;
constexpr int kBulletContainerSizeDp = 22; constexpr int kBulletContainerSizeDp = 22;
constexpr int kLineHeightDp = 15; constexpr int kLabelMaximumWidth =
constexpr int kBetweenLabelPaddingDp = 4; kDialogWidthDp - kBulletContainerSizeDp - 2 * kDialogContentMarginDp;
class BulletView : public views::View { class BulletView : public views::View {
public: public:
...@@ -59,28 +58,30 @@ class BulletView : public views::View { ...@@ -59,28 +58,30 @@ class BulletView : public views::View {
} // namespace } // namespace
// TODO(crbug.com/1142953): Rename to PublicAccountLearnMoreDialog.
PublicAccountWarningDialog::PublicAccountWarningDialog( PublicAccountWarningDialog::PublicAccountWarningDialog(
base::WeakPtr<LoginExpandedPublicAccountView> controller) base::WeakPtr<LoginExpandedPublicAccountView> controller)
: controller_(controller) { : controller_(controller) {
SetModalType(ui::MODAL_TYPE_SYSTEM); SetModalType(ui::MODAL_TYPE_SYSTEM);
SetButtons(ui::DIALOG_BUTTON_NONE); SetButtons(ui::DIALOG_BUTTON_NONE);
SetLayoutManager(std::make_unique<views::BoxLayout>( auto layout = std::make_unique<views::FlexLayout>();
views::BoxLayout::Orientation::kVertical, gfx::Insets(), layout->SetOrientation(views::LayoutOrientation::kVertical);
kBetweenLabelPaddingDp)); SetLayoutManager(std::move(layout));
SetBorder(views::CreateEmptyBorder(gfx::Insets(kDialogContentMarginDp))); SetBorder(views::CreateEmptyBorder(gfx::Insets(kDialogContentMarginDp)));
auto add_bulleted_label = [&](const base::string16& text) { auto add_bulleted_label = [&](const base::string16& text) {
auto* container = new views::View(); auto* container = new views::View();
container->SetLayoutManager(std::make_unique<views::BoxLayout>( auto layout = std::make_unique<views::FlexLayout>();
views::BoxLayout::Orientation::kHorizontal)); // Align the bullet to the top line of multi-line labels.
layout->SetCrossAxisAlignment(views::LayoutAlignment::kStart);
auto* label = new views::Label(text); container->SetLayoutManager(std::move(layout));
auto* label = new views::Label(text, views::style::CONTEXT_LABEL);
// If text style is set in the constructor, colors will not be updated and
// GetEnabledColor will return default color. See crbug.com/1151261.
label->SetTextStyle(views::style::STYLE_SECONDARY);
label->SetMultiLine(true); label->SetMultiLine(true);
label->SetMaximumWidth(kLabelMaximumWidth);
label->SetHorizontalAlignment(gfx::ALIGN_LEFT); label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
label->SetLineHeight(kLineHeightDp);
label->SetFontList(views::Label::GetDefaultFontList().Derive(
1, gfx::Font::FontStyle::NORMAL, gfx::Font::Weight::NORMAL));
label->SetEnabledColor(SK_ColorGRAY);
auto* bullet_view = auto* bullet_view =
new BulletView(label->GetEnabledColor(), kBulletRadiusDp); new BulletView(label->GetEnabledColor(), kBulletRadiusDp);
...@@ -132,7 +133,7 @@ void PublicAccountWarningDialog::AddedToWidget() { ...@@ -132,7 +133,7 @@ void PublicAccountWarningDialog::AddedToWidget() {
} }
gfx::Size PublicAccountWarningDialog::CalculatePreferredSize() const { gfx::Size PublicAccountWarningDialog::CalculatePreferredSize() const {
return gfx::Size(kDialogWidthDp, kDialogHeightDp); return {kDialogWidthDp, GetHeightForWidth(kDialogWidthDp)};
} }
} // namespace ash } // namespace ash
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment