Commit f1787718 authored by siyua's avatar siyua Committed by Commit Bot

[AF][Status Chip] Fix password icon highlighted button

Previously the highlighted button for the bubble is set to be the
icon in OmniboxPageActionIconContainer, so when the icon is actually in
ToolbarPageActionIconContainer, the highlight will not be updated
in BubbleDialogDelegateView::HandleVisibilityChanged() when
the bubble is dismissed.

Bug: 932818
Change-Id: Ic0aba1e922f7c240195cdef3d422422e5d9c6861
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1612363Reviewed-by: default avatarPeter Boström <pbos@chromium.org>
Commit-Queue: Siyu An <siyua@chromium.org>
Cr-Commit-Position: refs/heads/master@{#660027}
parent d9175f3c
......@@ -19,6 +19,7 @@
#include "chrome/browser/ui/views/toolbar/toolbar_page_action_icon_container_view.h"
#include "chrome/browser/ui/views/toolbar/toolbar_view.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "ui/views/controls/button/button.h"
// static
PasswordBubbleViewBase* PasswordBubbleViewBase::g_manage_passwords_bubble_ =
......@@ -48,10 +49,19 @@ void PasswordBubbleViewBase::ShowBubble(content::WebContents* web_contents,
DCHECK(bubble == g_manage_passwords_bubble_);
if (anchor_view) {
g_manage_passwords_bubble_->SetHighlightedButton(
browser_view->toolbar_button_provider()
->GetOmniboxPageActionIconContainerView()
->GetPageActionIconView(PageActionIconType::kManagePasswords));
views::Button* highlighted_button;
if (base::FeatureList::IsEnabled(
autofill::features::kAutofillEnableToolbarStatusChip)) {
highlighted_button =
browser_view->toolbar()->toolbar_page_action_container()->GetIconView(
PageActionIconType::kManagePasswords);
} else {
highlighted_button =
browser_view->toolbar_button_provider()
->GetOmniboxPageActionIconContainerView()
->GetPageActionIconView(PageActionIconType::kManagePasswords);
}
g_manage_passwords_bubble_->SetHighlightedButton(highlighted_button);
} else {
g_manage_passwords_bubble_->set_parent_window(
web_contents->GetNativeView());
......
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