[Extensions] Use BrowserWindowInterface in ExtensionContextMenuModel
This CL refactors the main constructor of ExtensionContextMenuModel to
use BrowserWindowInterface instead of Browser. This change is part of a
larger effort to decouple extensions from the Browser object.
For the few instances that are not yet supported by
BrowserWindowInterface, this CL uses
browser->GetBrowserForMigrationOnly() and enables it only on
non-Android platforms.
The Android constructor is not updated because it is a placeholder
being used by ExtensionActionContextMenuBridge while the shared
extensions logic is being refactored.
This change also required converting the context menu model unit test
to a browser test. This was done by:
- Using ExtensionBrowserTest instead of ExtensionServiceTestBase
- Using NavigateToURLInNewTab() instead of adding a URL using
content::WebContentsTester. URLs must be provided via
embedded_test_server, which uses http.
The test is only enabled for non-Android since it only tests the "main"
constructor.
Bypass-Check-License: converted unit test to browser test
Bug: 437774758
Change-Id: I6e5645fde57d693a6813c8ee82f4dabb1dceda43
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6966931
Commit-Queue: Emilia Paz <emiliapaz@chromium.org>
Reviewed-by: Devlin Cronin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1521427}
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone! Instead, follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.