Commit 474b0b5f authored by Fabio Tirelo's avatar Fabio Tirelo Committed by Commit Bot

[Save card dialog] Change label styles

Sets the style for explanation, footer disclaimer, and expiration dates
to secondary, in order to match the new spec. Also sets style for
credit card number as primary.

Sets context for labels as CONTEXT_BODY_TEXT_LARGE, so that they get
the correct font size (13dp).

Also changes the disclaimer test in the DialogBrowserTest to make it
easier to inspect link changes.

Bug: 852094
Test: ./out/Debug/browser_tests --gtest_filter=BrowserUiTest.Invoke --ui=SaveCardBubbleControllerImplTest.InvokeUi_Server --test-launcher-interactive
Change-Id: Ib9b7ef57119c1314848e079122f3677d5db80901
Reviewed-on: https://chromium-review.googlesource.com/1099486Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Commit-Queue: Fabio Tirelo <ftirelo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568601}
parent 935e4ba2
......@@ -35,7 +35,14 @@ class SaveCardBubbleControllerImplTest : public DialogBrowserTest {
std::unique_ptr<base::Value> value(base::JSONReader::Read(
"{"
" \"line\" : [ {"
" \"template\": \"This is the entire message.\""
" \"template\": \"The legal documents are: {0} and {1}.\","
" \"template_parameter\" : [ {"
" \"display_text\" : \"Terms of Service\","
" \"url\": \"http://www.example.com/tos\""
" }, {"
" \"display_text\" : \"Privacy Policy\","
" \"url\": \"http://www.example.com/pp\""
" } ]"
" } ]"
"}"));
base::DictionaryValue* dictionary;
......
......@@ -13,6 +13,7 @@
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/views/autofill/dialog_view_ids.h"
#include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
#include "chrome/browser/ui/views/harmony/chrome_typography.h"
#include "components/autofill/core/browser/credit_card.h"
#include "components/autofill/core/browser/legal_message_line.h"
#include "components/autofill/core/browser/ui/save_card_bubble_controller.h"
......@@ -32,6 +33,7 @@
#include "ui/views/controls/styled_label.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/style/typography.h"
#include "ui/views/window/dialog_client_view.h"
namespace autofill {
......@@ -47,6 +49,8 @@ std::unique_ptr<views::StyledLabel> CreateLegalMessageLineLabel(
views::StyledLabelListener* listener) {
std::unique_ptr<views::StyledLabel> label(
new views::StyledLabel(line.text(), listener));
label->SetTextContext(CONTEXT_BODY_TEXT_LARGE);
label->SetDefaultTextStyle(ChromeTextStyle::STYLE_SECONDARY);
for (const LegalMessageLine::Link& link : line.links()) {
label->AddStyleRange(link.range,
views::StyledLabel::RangeStyleInfo::CreateForLink());
......@@ -253,7 +257,8 @@ std::unique_ptr<views::View> SaveCardBubbleViews::CreateMainContentView() {
// info.
base::string16 explanation = controller_->GetExplanatoryMessage();
if (!explanation.empty()) {
auto* explanation_label = new views::Label(explanation);
auto* explanation_label = new views::Label(
explanation, CONTEXT_BODY_TEXT_LARGE, ChromeTextStyle::STYLE_SECONDARY);
explanation_label->SetMultiLine(true);
explanation_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
view->AddChildView(explanation_label);
......@@ -278,7 +283,8 @@ std::unique_ptr<views::View> SaveCardBubbleViews::CreateMainContentView() {
description_view->AddChildView(card_type_icon);
description_view->AddChildView(
new views::Label(card.NetworkAndLastFourDigits()));
new views::Label(card.NetworkAndLastFourDigits(), CONTEXT_BODY_TEXT_LARGE,
views::style::STYLE_PRIMARY));
// The spacer will stretch to use the available horizontal space in the
// dialog, which will end-align the expiration date label.
......@@ -286,8 +292,9 @@ std::unique_ptr<views::View> SaveCardBubbleViews::CreateMainContentView() {
description_view->AddChildView(spacer);
box_layout->SetFlexForView(spacer, /*flex=*/1);
description_view->AddChildView(
new views::Label(card.AbbreviatedExpirationDateForDisplay()));
description_view->AddChildView(new views::Label(
card.AbbreviatedExpirationDateForDisplay(), CONTEXT_BODY_TEXT_LARGE,
ChromeTextStyle::STYLE_SECONDARY));
// If necessary, add the cardholder name textfield to the upload save dialog.
if (controller_->ShouldRequestNameFromUser()) {
......
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