Commit 181406c6 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

cbui: remove SaveCardOfferBubbleViews CreateExtraView

This is now a regular factory method on this class, called from a new override
of BubbleDialogDelegateView::Init().

Bug: 1011446
Change-Id: Ie177b62c237dcb8fe53dcae385bc807977d223f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1876550
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709148}
parent 076703e0
......@@ -57,28 +57,9 @@ SaveCardOfferBubbleViews::SaveCardOfferBubbleViews(
SaveCardBubbleController* controller)
: SaveCardBubbleViews(anchor_view, web_contents, controller) {}
std::unique_ptr<views::View> SaveCardOfferBubbleViews::CreateExtraView() {
// Only show the (i) info icon for upload saves using implicit sync.
// GetLegalMessageLines() being empty denotes a local save.
if (controller()->GetLegalMessageLines().empty() ||
controller()->GetSyncState() !=
AutofillSyncSigninState::kSignedInAndWalletSyncTransportEnabled) {
return nullptr;
}
// CreateMainContentView() must happen prior to this so that |prefilled_name|
// gets populated.
auto upload_explanation_tooltip = std::make_unique<
views::TooltipIcon>(l10n_util::GetStringUTF16(
(cardholder_name_textfield_ &&
!cardholder_name_textfield_->GetText().empty())
? IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_AND_CARDHOLDER_NAME_TOOLTIP
: IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_TOOLTIP));
upload_explanation_tooltip->set_bubble_width(kTooltipBubbleWidth);
upload_explanation_tooltip->set_anchor_point_arrow(
views::BubbleBorder::Arrow::TOP_RIGHT);
upload_explanation_tooltip->SetID(DialogViewId::UPLOAD_EXPLANATION_TOOLTIP);
return upload_explanation_tooltip;
void SaveCardOfferBubbleViews::Init() {
SaveCardBubbleViews::Init();
DialogDelegate::SetExtraView(CreateUploadExplanationView());
}
std::unique_ptr<views::View> SaveCardOfferBubbleViews::CreateFootnoteView() {
......@@ -323,4 +304,29 @@ SaveCardOfferBubbleViews::CreateRequestExpirationDateView() {
return expiration_date_view;
}
std::unique_ptr<views::View>
SaveCardOfferBubbleViews::CreateUploadExplanationView() {
// Only show the (i) info icon for upload saves using implicit sync.
// GetLegalMessageLines() being empty denotes a local save.
if (controller()->GetLegalMessageLines().empty() ||
controller()->GetSyncState() !=
AutofillSyncSigninState::kSignedInAndWalletSyncTransportEnabled) {
return nullptr;
}
// CreateMainContentView() must happen prior to this so that |prefilled_name|
// gets populated.
auto upload_explanation_tooltip = std::make_unique<
views::TooltipIcon>(l10n_util::GetStringUTF16(
(cardholder_name_textfield_ &&
!cardholder_name_textfield_->GetText().empty())
? IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_AND_CARDHOLDER_NAME_TOOLTIP
: IDS_AUTOFILL_SAVE_CARD_PROMPT_UPLOAD_EXPLANATION_TOOLTIP));
upload_explanation_tooltip->set_bubble_width(kTooltipBubbleWidth);
upload_explanation_tooltip->set_anchor_point_arrow(
views::BubbleBorder::Arrow::TOP_RIGHT);
upload_explanation_tooltip->SetID(DialogViewId::UPLOAD_EXPLANATION_TOOLTIP);
return upload_explanation_tooltip;
}
} // namespace autofill
......@@ -33,7 +33,7 @@ class SaveCardOfferBubbleViews : public SaveCardBubbleViews,
SaveCardBubbleController* controller);
// BubbleDialogDelegateView:
std::unique_ptr<views::View> CreateExtraView() override;
void Init() override;
std::unique_ptr<views::View> CreateFootnoteView() override;
bool Accept() override;
int GetDialogButtons() const override;
......@@ -55,6 +55,7 @@ class SaveCardOfferBubbleViews : public SaveCardBubbleViews,
std::unique_ptr<views::View> CreateMainContentView() override;
std::unique_ptr<views::View> CreateRequestExpirationDateView();
std::unique_ptr<views::View> CreateUploadExplanationView();
~SaveCardOfferBubbleViews() override;
......
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