Commit df7d60c9 authored by Aga Wronska's avatar Aga Wronska Committed by Commit Bot

Show correct parent access dialog title

Parent access dialog should show correct title after the error is
cleared. The title should be the same as before showing the error and
it should match the reason that access code is requested for.

Bug: 987792
Test: manually
Change-Id: I4ec9a36ee22cfebae85875bbc3f2fb27d601c16d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1719810Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarHenrique Grandinetti <hgrandinetti@chromium.org>
Commit-Queue: Aga Wronska <agawronska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681324}
parent 73b8328e
...@@ -458,7 +458,7 @@ ParentAccessView::Callbacks::~Callbacks() = default; ...@@ -458,7 +458,7 @@ ParentAccessView::Callbacks::~Callbacks() = default;
ParentAccessView::ParentAccessView(const AccountId& account_id, ParentAccessView::ParentAccessView(const AccountId& account_id,
const Callbacks& callbacks, const Callbacks& callbacks,
ParentAccessRequestReason reason) ParentAccessRequestReason reason)
: callbacks_(callbacks), account_id_(account_id) { : callbacks_(callbacks), account_id_(account_id), request_reason_(reason) {
DCHECK(callbacks.on_finished); DCHECK(callbacks.on_finished);
// Main view contains all other views aligned vertically and centered. // Main view contains all other views aligned vertically and centered.
...@@ -526,8 +526,9 @@ ParentAccessView::ParentAccessView(const AccountId& account_id, ...@@ -526,8 +526,9 @@ ParentAccessView::ParentAccessView(const AccountId& account_id,
}; };
// Main view title. // Main view title.
title_label_ = new views::Label(GetTitle(reason), views::style::CONTEXT_LABEL, title_label_ =
views::style::STYLE_PRIMARY); new views::Label(GetTitle(request_reason_), views::style::CONTEXT_LABEL,
views::style::STYLE_PRIMARY);
title_label_->SetFontList(gfx::FontList().Derive( title_label_->SetFontList(gfx::FontList().Derive(
kTitleFontSizeDeltaDp, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM)); kTitleFontSizeDeltaDp, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM));
decorate_label(title_label_); decorate_label(title_label_);
...@@ -537,9 +538,9 @@ ParentAccessView::ParentAccessView(const AccountId& account_id, ...@@ -537,9 +538,9 @@ ParentAccessView::ParentAccessView(const AccountId& account_id,
// Main view description. // Main view description.
// TODO(crbug.com/970223): Add learn more link after description. // TODO(crbug.com/970223): Add learn more link after description.
description_label_ = description_label_ = new views::Label(GetDescription(request_reason_),
new views::Label(GetDescription(reason), views::style::CONTEXT_LABEL, views::style::CONTEXT_LABEL,
views::style::STYLE_PRIMARY); views::style::STYLE_PRIMARY);
description_label_->SetMultiLine(true); description_label_->SetMultiLine(true);
description_label_->SetLineHeight(kDescriptionTextLineHeightDp); description_label_->SetLineHeight(kDescriptionTextLineHeightDp);
description_label_->SetFontList( description_label_->SetFontList(
...@@ -733,8 +734,7 @@ void ParentAccessView::UpdateState(State state) { ...@@ -733,8 +734,7 @@ void ParentAccessView::UpdateState(State state) {
case State::kNormal: { case State::kNormal: {
access_code_view_->SetInputColor(kTextColor); access_code_view_->SetInputColor(kTextColor);
title_label_->SetEnabledColor(kTextColor); title_label_->SetEnabledColor(kTextColor);
title_label_->SetText( title_label_->SetText(GetTitle(request_reason_));
l10n_util::GetStringUTF16(IDS_ASH_LOGIN_PARENT_ACCESS_TITLE));
return; return;
} }
case State::kError: { case State::kError: {
......
...@@ -136,6 +136,10 @@ class ASH_EXPORT ParentAccessView : public views::DialogDelegateView, ...@@ -136,6 +136,10 @@ class ASH_EXPORT ParentAccessView : public views::DialogDelegateView,
// empty, the code is processed for all the children signed in the device. // empty, the code is processed for all the children signed in the device.
const AccountId account_id_; const AccountId account_id_;
// Indicates what action will be authorized with parent access code.
// The appearance of the view depends on |request_reason_|.
const ParentAccessRequestReason request_reason_;
State state_ = State::kNormal; State state_ = State::kNormal;
views::Label* title_label_ = nullptr; views::Label* title_label_ = nullptr;
......
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