Claudio DeSouza abe5c21074 [cr143] Correct access to Omnibox UI classes
Chromium has changed how access to the `OmniboxEditModel` instance
occurs, now routing it from the LocationBar, through the
OmniboxController reference.

This change corrects several tests and places in the codebase to relfect
that. It has also been necessary to add friend access to
`OmniboxPopupView` for `BraveOmniboxResultView` as `OmniboxResultView`
relies on that.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/d976b3a19103999113e51ae709c2632181b747f8

commit d976b3a19103999113e51ae709c2632181b747f8
Author: Moe Ahmadi <mahmadi@chromium.org>
Date:   Mon Nov 3 19:00:59 2025 -0800

    [omnibox] Refactors ownership and access to Omnibox UI classes

    This CL refactors the ownership and dependencies between key Omnibox UI
    classes, i.e., OmniboxController, OmniboxEditModel, OmniboxView, and
    LocationBarView.

    - Moves ownership of OmniboxController from OmniboxView to
      LocationBarView and ensures it outlives OmniboxView.
    - Makes OmniboxView available to OmniboxController and OmniboxEditModel
      post-construction, similar to how OmniboxPopupView is set and unset.
    - Removes public access to OmniboxController and OmniboxEditModel
      through OmniboxView.
    - Enforces access to OmniboxEditModel through OmniboxController.

    The overall goal is to improve the comprehension and adaptability of
    the Omnibox UI classes for longer-term UI architectural improvements:

    Transitioning UI components to WebUI necessitates an asynchronous
    interaction model, as direct synchronous access to View objects across
    process boundaries is not possible. This CL minimizes coupling of the
    Controller/Model with the View at construction time and minimizes the
    API surface of OmniboxView by removing direct access to the Controller
    and Model, preparing for a future where view updates are driven by state
    change observation, rather than direct manipulation.

    By moving ownership of OmniboxController to LocationBarView and
    extending its lifetime, this CL allows it to mediate between the
    OmniboxEditModel, the OmniboxView, and the OmniboxPopupView(s), managing
    their state and visibility.

    The existing OmniboxEditModel contains logic that more appropriately
    belongs in a Controller. By enforcing all access to the OmniboxEditModel
    through the OmniboxController, this CL makes it easier to identify and
    incrementally migrate controller-like responsibilities out of the Model
    and into the Controller, leading to a better separation of concerns and
    aligning with MVC principles.

    BYPASS_LARGE_CHANGE_WARNING: Largely mechanical refactoring

    Bug: 40251974
    Change-Id: Id159acd262f444cc1ad3d83bd80d63b89c104c55
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7110919
    Commit-Queue: Moe Ahmadi <mahmadi@chromium.org>
    Reviewed-by: Erik Chen <erikchen@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1539750}
2025-11-21 00:29:54 -05:00

Brave Core

Brave Core is a set of changes, APIs, and scripts used for customizing Chromium to make the Brave browser. Please also check https://github.com/brave/brave-browser

Follow @brave on Twitter for important announcements.

Resources

Community

You can ask questions and interact with the community in the following locations:

S
Description
No description provided
Readme MPL-2.0
3.8 GiB
Languages
C++ 36.9%
HTML 31.6%
Swift 9.4%
TypeScript 9%
Java 4.8%
Other 8.1%