Commit a1a3f955 authored by Sahel Sharify's avatar Sahel Sharify Committed by Chromium LUCI CQ

[Web Payment]PR_sheet_controller should not update views during PR abort

Similar to crbug.com/993223
PaymentRequestSheetController::UpdateHeaderView gets called after the
payment request(PR) has been aborted. The fix for crbug.com/993223 early
returns in DidFinishNavigation which is the caller of UpdateHeaderView.
That's why calling UpdateHeaderView from a different function (e.g.
DidChangeVisibleSecurityState in the case of crbug.com/1165624) still
reproduces the issue.

This CL early returns in all PaymentRequestSheetController's
Update...View functions when the PR is being aborted.

Bug: 1165624
Change-Id: Ie6f8f8ff6e72ef16878aa8dc3f15e19dea1587e1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2635074Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Commit-Queue: Sahel Sharify <sahel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#844843}
parent 385356e7
...@@ -287,12 +287,20 @@ std::unique_ptr<views::View> PaymentRequestSheetController::CreateView() { ...@@ -287,12 +287,20 @@ std::unique_ptr<views::View> PaymentRequestSheetController::CreateView() {
} }
void PaymentRequestSheetController::UpdateContentView() { void PaymentRequestSheetController::UpdateContentView() {
// Do not update the view if the payment request is being aborted.
if (!is_active_)
return;
content_view_->RemoveAllChildViews(true); content_view_->RemoveAllChildViews(true);
FillContentView(content_view_); FillContentView(content_view_);
RelayoutPane(); RelayoutPane();
} }
void PaymentRequestSheetController::UpdateHeaderView() { void PaymentRequestSheetController::UpdateHeaderView() {
// Do not update the view if the payment request is being aborted.
if (!is_active_)
return;
header_view_->RemoveAllChildViews(true); header_view_->RemoveAllChildViews(true);
PopulateSheetHeaderView( PopulateSheetHeaderView(
ShouldShowHeaderBackArrow(), CreateHeaderContentView(header_view_), ShouldShowHeaderBackArrow(), CreateHeaderContentView(header_view_),
...@@ -318,6 +326,10 @@ void PaymentRequestSheetController::UpdateFocus(views::View* focused_view) { ...@@ -318,6 +326,10 @@ void PaymentRequestSheetController::UpdateFocus(views::View* focused_view) {
} }
void PaymentRequestSheetController::RelayoutPane() { void PaymentRequestSheetController::RelayoutPane() {
// Do not update the view if the payment request is being aborted.
if (!is_active_)
return;
content_view_->Layout(); content_view_->Layout();
pane_->SizeToPreferredSize(); pane_->SizeToPreferredSize();
// Now that the content and its surrounding pane are updated, force a Layout // Now that the content and its surrounding pane are updated, force a Layout
......
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