Unify the Android Rich NTT for reuse on iOS
The current PR is pre-requisite of Dynamic NTT on iOS as it allows
to reuse android `New Tab Takeover WebUI` on iOS. The PR removes
dependency of android `New Tab Takeover WebUI` from
`ViewCounterService` which is not available on iOS. It also removes
`current_wallpaper` base::Value cache in ViewCounterService which
allows to save memory and makes code cleaner.
Sometimes scanning QR codes searches for the URL within
search.brave.com rather than either loading the targeted URL or
displaying the URL within the omnibox so the user can load the
website that was scanned.
Resolves: https://github.com/brave/brave-browser/issues/48806
The custom menu item preference screen follows the Figma design and is composed by two sections, Main menu and Page actions.
The screen shows only those items that are supported by the device, items that will never appear won't be shown.
Each item's visibility will default to true and each preference is saved on shared preferences.
The only two items whose visibility cannot be modified are the Main Settings item and the Custom Menu item itself.
Let users to display only one tiles row in in quick action search
widget
There are cases on some devices where it is impossible to display
only one tiles row, it displays two right away.
Resolves: https://github.com/brave/brave-browser/issues/49110
The list was not updated nor maintained, and even had invalid entries.
On device which uses a local ML model was tied to this preference for some reason too, so that keeps the preference around and has a checkbox for just that now.
For Android, it doesn't support on device suggestions because the ML
models aren't available there, so no checkbox was added there.
* Move BraveYouTubeScriptInjectorNativeHelper to main app layer so it can reference BraveActivity
* Save boolean flag in activity bundle
* Add small delay to let the layout pass to complete
When a user tapped on the radio button in the VPN region (country)
selection screen, it did not have a click handler which resulted in the
user's interaction being dispatched to the parent container for that
row, causing them to be brought to the next screen where they choose a
city.
Now, the radio button handles clicks and will switch them to that
country. The optimal region is always chosen within the code. Users can
still tap on the row entry itself to access the city selection screen.
Closesbrave/brave-browser#48327
When we call into `BraveVpnPrefUtils.setPrefModel`, this function
invokes a method or two that `assert` they're being called on the UI
thread. As a result, previously, the VPN would fail to start in debug
builds as a result of the assertion and could possibly have been causing
breakage in Release builds.
Additionally, a couple of functions have had a null-check added which
causes them to return without doing anything. Prior to this commit, an
exception would be thrown immediately when passed to `setString` which
then resulted in the function not doing anything anyway - along with
negatively impacting any code further up the call chain that didn't
handle the exception.
There was also a problem with the VpnServerSelectionActivity wherein a
member of the class implemented AutoCloseable but was not being closed
in all cases which then resulted in a runtime exception because the
object detected it was freeing its resources by being finalized. A
missing close() has been added and we also handle onDestroy() to close
the object there too.
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/6853852a6e345346bb9b0578c83b5b7989e8b3ad
[Android][Signin] Move sign-in operation to bottom sheet mediator
The main goal of this CL is to move the sign-in related operations and
the use of SigninManager from the AccountPickerDelegate implementations
to AccountPickerBottomSheetMediator.
It also add a sign-out operation right before sign-in if there's an
existing account. This behavior was previously implemented only for the
web sign-in entry point, but it also makes sense for the other flows.
The SignoutReason enum description is updated accordingly to state it's
not only used by the web-signin anymore.
The tests are updated accordingly.
Bug: 431198423, 40646656
Change-Id: I9ac9f3410cba714d16a1dd02b46f1d69afcf0eb2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6759794
- new arg bringTabGroupToFrontCallback at LocationBarCoordinator.ctor;
- new arg bringTabGroupToFrontCallback at AutocompleteMediator.ctor
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/9bc7b331449ea2da29ce2d705d5b725f5688127f
[hub] Prototype adding an intent for opening tab groups from hub search
Add logic for opening up a BRING_TAB_GROUP_TO_FRONT intent with logic
for hub search. This flow follows an established pattern in the
BRING_TAB_TO_FRONT (switch to tab) path and needs to work from all
contexts such as SearchActivity.
Validate-Test-Flakiness: skip
Bug: 431020549, 435216330
Change-Id: I273c802cd28ff1f36d5e1aef6e4085772cf74699
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6795745
- new ephemeralTabCoordinatorSupplier arg at BaseCustomTabRootUiCoordinator.ctor
- changed type from OneshotSupplierImpl to ObservableSupplierImpl at TabbedRootUiCoordinator.ctor
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/8d210f0ad7b7edb9414d856391403b3773128dc1
[BNPL][Ephemeral] Add EphemeralTabCoordinatorSupplier in ChromeActivity
For BNPL (Buy Now, Pay Later) on Clank, when a user selects a BNPL
issuer, we redirect them to that issuer's site using ephemeral tabs.
To facilitate this, we need to access EphemeralTabCoordinator
from PaymentsWindowCoordinator, for which we are creating a
supplier.
Design:go/clank-bnpl-ephemeral-tabs-engineering-design
Bug: 430575808
Change-Id: Iaccfbcc59a50bcce22f8f623801dbf066bfe6483
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6776167
Fix for EphemeralTabCoordinator
- new incognitoStateProvider arg at TopToolbarCoordinator.ctor
- removed overviewColorSupplier from ToolbarManager.ctor
- new themeColorProvider, incognitoStateProvider args at ToolbarLayout.ctor
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/a2773ee6fa119d3ee50230682c3e570cac56ca0b
Initialize toolbar themeColorProvider and incognitoStateProvider earlier
Currently, the ThemeColorProvider and IncognitoStateProvider are passed
to the ToolbarLayout (and thus to ToolbarTablet) asynchronously after
their initialization. Because these two classes are needed by the
ToolbarChild ctor, this initialization order complicates things and
makes it harder to initialize the toolbar's children, since the
requisite classes are not available yet.
This CL reorders initialization such that these two classes are passed
directly via ToolbarLayout#initialize(), so that all the required inputs
are available in this method for easier initialization.
Bug: 427258660
Change-Id: I84e9cc1378ec91b8fda275b17bf603f216273e16
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6777952
Fix Initialize toolbar themeColorProvider and incognitoStateProvider earlier
New arg topInsetCoordinatorSupplier at NewTabPage.ctor and TabbedRootUiCoordinator.ctor
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/d496557e4fbca10db01a5aaf6da8790f012f3157
[Theme] Add TopInsetCoordinator for consuming top insets.
In this CL:
1. Introduce TopInsetCoordinator to consume the top inset for NTPs.
2. A supplier of TopInsetCoordinator is owned by ChromeTabbedActivity,
and the instance is created by RootUiCoordinator.
This CL plumbs the TopInsetCoordinator, but doesn't change NTP to
support edge-to-edge.
Bug: 432527690
Change-Id: Ia372f7285aaff95ca2bb47e43a76c142729dbed1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6785207
Removed noMvPlaceholderStub arg from MostVisitedTilesMediator.ctor
Removed MostVisitedTilesMediator.updateTilePlaceholderVisibility
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/d67f572a5aa967e71a3fa5cbe8fd434be9933eb5
Delete Most Visited Tiles placeholder from NTP
This CL removes the "mv_tiles_placeholder_stub" view as it never
actually appears in the New Tab Page (NTP) UI.
The placeholder's visibility is set to View.VISIBLE when no tiles are
present. However, its parent, mv_tiles_container, is only visible if and
only if there are tiles to display. Consequently, if no tiles are
present, "mv_tiles_container"'s visibility is View.GONE, preventing its
child, "mv_tiles_placeholder_stub", from ever being rendered on the NTP.
This CL deletes all related placeholder logic from the view binder, view
properties, mediator, XML, PNG files, and tests.
Bug: 421436204
Change-Id: Iab3a2288a97dcfa2e7c137d5b1d6e7521a07176e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6771167
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/7211ad73ee02dd19c83cb64c27fca687a7ed8344
Add RedirectTabCreator
- Add int enum SupportedProfileType to ChromeTabbedActivity to determine
the type of tab/profile the activity supports.
- Add RedirectTabCreator to create new tabs in another window.
- Add method in MultiWindowUtils to get foreground CTA with matching
profile.
This change affects the "Open in incognito tab" option, which is
accessible from the web content context menu, the New Tab Page (NTP)
most visited tiles, and the NTP news feed.
When selected, content will open in an incognito tab as follows:
1. New Window: If there is no adjacent window, or if the adjacent
window is a regular (non-incognito) window.
2. Adjacent Window: If the adjacent window is already incognito.
Bug: 429518553
Change-Id: Ic3f1744dcfaf34cc87dc74c0ba5d72de7d2e5ced
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6720784
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/157d37538f066ab0467fb47a9247407f244ead28
Add Support for Contextual Menu Items for CCTs
This change implements the click-handling logic for custom content
actions in the CCT context menu, gated by the CctContextualMenuItems
feature flag. Additionally, it adds a new histogram to record
interactions based on the action type (e.g. Link or Image).
For links, the returned intent contains:
- [Extra][int] The original integer id of the custom action.
- [Extra][int] The clicked target type (link/image).
For images, it additionally returns:
- [Extra][uri] Image data as a uri.
- [Data][uri] Page url.
The tests added verify the creation and clicking logic of the contextual
menu items as well as histogram recording upon selection.
Bug: 422177241
Change-Id: I9d05be9b2ba7a455dd324930fe6a0f751f59a016
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6700830
`extensionService` arg was removed
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/abfb8fa6b66c62e8c0e5fb3390b54a35c33eb7c3
extensions: Extract toolbar-related stuff from ExtensionService
ExtensionService (formerly named ExtensionToolbarManager until recently)
currently contains a lot of toolbar-specific UI logic, requiring the
dependency from //c/b/ui/android/extensions to //c/b/ui/android/toolbar.
This dependency is not desirable as it forbids most of the UI code under
//c/b/ui/android to depend on //c/b/ui/android/extensions due to
dependency cycles. We want to reverse the dependency direction.
As the first step towards the goal, this patch extracts the
toolbar-related methods from ExtensionService to a new class
ExtensionToolbarCoordinator, and place it under
//c/b/ui/android/toolbar.
ExtensionToolbarCoordinator's implementation is loaded with
ServiceLoader just like ExtensionService, so that its implementation
can depend on conditionally-compiled extension UI code. It is created
and owned by ToolbarManager, instead of RootUiCoordinator that formerly
owned ExtensionService, because it now focuses on toolbar stuff.
This is a pure refactoring. No functional changes are expected.
Bug: 428637084
Change-Id: I141d6ba797626230d59cd0bc481588264ac6cf06
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6694669
`extensionService` arg was removed
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/8a30345b5b56d892a62dd6789f9a621df233fed8
extensions: Rework ExtensionService as ExtensionUiBackend
It was pointed out in code reviews that ExtensionService (in Java) can
be confused with ExtensionService (in C++). To avoid confusion and
clarify the responsibility of the class, this patch renames it to
ExtensionUiBackend, together with some rework I'm describing below.
We also introduce a new class, ExtensionUi, that allows easy access to
ExtensionUiBackend. Production code should use ExtensionUi instead of
directly calling into ExtensionUiBackend. ExtensionUi holds a singleton
instance of ExtensionUiBackend, so it can provide static methods to
call into the backend. It also provides a test-only method to inject
a fake ExtensionUiBackend to streamline unit testing.
The only method in ExtensionUi and ExtensionUiBackend, isEnabled(),
takes a Profile as an explicit argument, rather than saving it in the
constructor, to make it clear that its result is a function of the
given profile.
This is a pure refactoring. No functional changes are expected.
Bug: 428637084
Change-Id: I746e78f8f8ed6a9bb563625c17230ee96b4a2d9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6694671
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/2460bafb67b67c895e7eb21e63fcdfaac1bcfbf5
sync: Add extensions checkbox to settings on desktop Android
Support for extensions sync was recently added to desktop Android.
Update the sync settings page to add a checkbox for the sync data
type.
toggles sync data type in chrome://sync-internals
Test: added to chrome_public_test_apk
Test: manually verified checkbox appears on desktop Android and
Test: manually verified checkbox does not appear on non-desktop Android
Bug: 424217517
Change-Id: Ifd6643e1d8b013e5d5383d21ef31a51863277650
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6652500