[cr147] LocationBarView::FocusLocation added arg
This change reflects the addition of `clear_focus_if_failed` to this function in the exiting overide for it. Chromium changes: https://chromium.googlesource.com/chromium/src/+/ccaaa043e306f0a97bc792232c378a6362141498 commit ccaaa043e306f0a97bc792232c378a6362141498 Author: Maks Orlovich <morlovich@chromium.org> Date: Fri Feb 13 12:27:25 2026 -0800 Abstract away some dependencies on LocationBarView ...to set stage to create a different, WebUI-based, implementation of LocationBar. This involves adding new LocationBar interfaces for following operations: - BrowserView::SetFocusToLocationBar clearing focus if it can't focus location bar; this is done as a new bool parameter to the existing FocusLocation() since w/a WebUI implementation the attempt would be asynchronous. - BrowserView::Layout adjusting focus behavior based on toolbar visibility. - OmniboxPopupCloser::OnMouseEvent deciding whether a mouse event should close the omnibox popup or not. - ... and also adjusting OmniboxPopupCloser::CloseWithReason to go via LocationBar and not LocationBarView, since the base class already has all the required functionality. Bug: 474582476 Change-Id: Idbf9000157a96d785c7dffafe30c2f328bc6d833 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7541736 Reviewed-by: manuk hovanesian <manukh@chromium.org> Commit-Queue: Maks Orlovich <morlovich@chromium.org> Reviewed-by: Darryl James <dljames@chromium.org> Cr-Commit-Position: refs/heads/main@{#1584842}
This commit is contained in:
@@ -440,7 +440,8 @@ int BraveLocationBarView::GetBorderRadius() const {
|
||||
views::Emphasis::kMaximum, size());
|
||||
}
|
||||
|
||||
void BraveLocationBarView::FocusLocation(bool is_user_initiated) {
|
||||
void BraveLocationBarView::FocusLocation(bool is_user_initiated,
|
||||
bool clear_focus_if_failed) {
|
||||
if (base::FeatureList::IsEnabled(tabs::kBraveSharedPinnedTabs) &&
|
||||
browser_->profile()->GetPrefs()->GetBoolean(
|
||||
brave_tabs::kSharedPinnedTab)) {
|
||||
|
||||
@@ -97,7 +97,8 @@ class BraveLocationBarView : public LocationBarView {
|
||||
void ChildVisibilityChanged(views::View* child) override;
|
||||
void AddedToWidget() override;
|
||||
int GetBorderRadius() const override;
|
||||
void FocusLocation(bool is_user_initiated) override;
|
||||
void FocusLocation(bool is_user_initiated,
|
||||
bool clear_focus_if_failed) override;
|
||||
|
||||
SkPath GetFocusRingHighlightPath() const;
|
||||
ContentSettingImageView* GetContentSettingsImageViewForTesting(size_t idx);
|
||||
|
||||
@@ -123,7 +123,8 @@ IN_PROC_BROWSER_TEST_F(BraveLocationBarViewBrowserTest,
|
||||
// Check promotion button is launched.
|
||||
GetTemplateURLService()->SetUserSelectedDefaultSearchProvider(
|
||||
&bing_template_url);
|
||||
location_bar()->FocusLocation(true);
|
||||
location_bar()->FocusLocation(/*is_user_initiated=*/true,
|
||||
/*clear_focus_if_failed=*/false);
|
||||
omnibox_view()->SetUserText(u"a");
|
||||
WaitUntil(base::BindLambdaForTesting(
|
||||
[&]() { return controller()->IsPopupOpen(); }));
|
||||
@@ -141,7 +142,8 @@ IN_PROC_BROWSER_TEST_F(BraveLocationBarViewBrowserTest,
|
||||
&brave_template_url);
|
||||
|
||||
// Check button is not shown with brave search.
|
||||
location_bar()->FocusLocation(true);
|
||||
location_bar()->FocusLocation(/*is_user_initiated=*/true,
|
||||
/*clear_focus_if_failed=*/false);
|
||||
omnibox_view()->SetUserText(u"a");
|
||||
WaitUntil(base::BindLambdaForTesting(
|
||||
[&]() { return controller()->IsPopupOpen(); }));
|
||||
@@ -173,7 +175,8 @@ IN_PROC_BROWSER_TEST_F(BraveLocationBarViewBrowserTest,
|
||||
// Unset dismissed and simulate promotion button click.
|
||||
browser()->profile()->GetPrefs()->SetBoolean(
|
||||
brave_search_conversion::prefs::kDismissed, false);
|
||||
location_bar()->FocusLocation(true);
|
||||
location_bar()->FocusLocation(/*is_user_initiated=*/true,
|
||||
/*clear_focus_if_failed=*/false);
|
||||
omnibox_view()->SetUserText(search_term);
|
||||
WaitUntil(base::BindLambdaForTesting(
|
||||
[&]() { return controller()->IsPopupOpen(); }));
|
||||
|
||||
Reference in New Issue
Block a user