Commit 0ceb36b9 authored by Anthony Vallee-Dubois's avatar Anthony Vallee-Dubois Committed by Commit Bot

[Web Payments] Update origin in PH header when interstitial is shown

This change displays the Visible URL in the PH header instead of the
last committed. Moreover, it updates the header when an interstitial
(such as Safe Browsing) is attached or detached.

Bug: 829027
Change-Id: Ie1fd0f9f404d571587f4980687bb170d036e76a0
Reviewed-on: https://chromium-review.googlesource.com/998750
Commit-Queue: anthonyvd <anthonyvd@chromium.org>
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548589}
parent b343e316
......@@ -170,9 +170,8 @@ bool PaymentHandlerWebFlowViewController::ShouldShowSecondaryButton() {
std::unique_ptr<views::View>
PaymentHandlerWebFlowViewController::CreateHeaderContentView() {
const GURL origin = web_contents()
? web_contents()->GetLastCommittedURL().GetOrigin()
: GURL();
const GURL origin =
web_contents() ? web_contents()->GetVisibleURL().GetOrigin() : GURL();
std::unique_ptr<views::Background> background = GetHeaderBackground();
return std::make_unique<ReadOnlyOriginView>(GetSheetTitle(), origin,
background->get_color(), this);
......@@ -215,4 +214,12 @@ void PaymentHandlerWebFlowViewController::TitleWasSet(
UpdateHeaderView();
}
void PaymentHandlerWebFlowViewController::DidAttachInterstitialPage() {
UpdateHeaderView();
}
void PaymentHandlerWebFlowViewController::DidDetachInterstitialPage() {
UpdateHeaderView();
}
} // namespace payments
......@@ -51,6 +51,8 @@ class PaymentHandlerWebFlowViewController
void DidFinishNavigation(
content::NavigationHandle* navigation_handle) override;
void TitleWasSet(content::NavigationEntry* entry) override;
void DidAttachInterstitialPage() override;
void DidDetachInterstitialPage() override;
Profile* profile_;
GURL target_;
......
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