Plumbing for BravePlaylistExclusions component. Installer and registrar to follow suite
Expose PlaylistExclusionsAPI as a protocol with a private impl so Swift can mock it, and add BravePlaylistExclusions.sharedInstance instead of exposing a wrapper on BraveCoreMain.
Register the public header directly in ios/BUILD.gn and remove unused playlist deps from ios/app and ios/browser/web.
Signed-off-by: Eli Hini <8249954+EliHini@users.noreply.github.com>
This change adds a helper class `RandomizedMessageHandlerName` that can be used in JavaScriptFeature's to support randomizing message handler names. The randomized message handler is a UUIDv4 which is injected with the script itself via placeholder replacement.
* [Android] New Nala icons: copy, edit, share, microphone
Icon ic_share_white_24dp is png in the upstream, so for now we have to use png format as well.
* PNG optimisation
* clear window.localStorage from swift side when wallet is reset
* Clear WebUI localStorage on wallet reset via hidden WKWebView
* fix gn check
* address review(kyle) feedback
refactor WebUI localStorage clear to use SequenceBound
Replace the static global objc object and GCD dispatch with a WalletWebviewRunner C++ class held via base::SequenceBound, ensuring correct per-profile lifetime and UI thread enforcement via DCHECK_CURRENTLY_ON.
* address review(stephen) feedback
update func name with more clarity
* [AI Chat] Move HandoffButton lower and make it smaller
Brave's URL bar is centered, so it makes the URL unreadable in more cases than upstream. And Brave's AI Chat conversation UI has large buttons for pausing the tasks, which perform the same function.
- Fix https://github.com/brave/brave-browser/issues/51384
Brave Origin builds disable rewards (enable_brave_rewards =
!is_brave_origin_branded), so the rewards_grant_* endpoints are unused
and should not be required in .env.
This adds an additional tokenized method `sendWebKitMessageSynchronously` alongside `sendTokenizedWebKitMessage{WithReply}` that uses `window.prompt` from SafeBuiltins.
This change adds a new WebGPU web-compat content settings type. This would allow showing a brand new "Webgpu" toggle inside the Brave shields > "Block fingerprinting" secondary UI.
This change also connects the current webgpu scrubbing to this new content setting type which was webgl before. This allows the users to turn on/off the fingerprinting protections selectively on WebGPU APIs w/o changing WebGL.
Resolves: https://github.com/brave/brave-browser/issues/55927
* update
This change:
- Fixed a bug related with WebGPU adapter info.
- Updates the existing WebGPU browser tests to setup the WebGPU environment correctly.
- The tests are disabled for win x64 which doesn't have support for WebGPU adapter.
- New tests are added to check we don't scrub if the kEnableWebGPUDeveloperFeatures feature flag was enabled.
Related brave/brave-browser#55677
* [AI Chat] Tab Management Tool - close action
Adds the "close" action to the tab management tool, reimplemented on top
of the refactored handlers. Closing is asynchronous (beforeunload handlers
can delay WebContents destruction), so a self-owned TabsClosedWaiter waits
for the tabs to be destroyed, or a fallback timeout, before reporting the
resulting tab list. Duplicate tab_ids are de-duplicated and indices are
re-queried per close to avoid acting on a stale or destroyed WebContents.
* [AIChat] Tab Management Tool actions
Implements tab organizing actions. Does not implement close action which, due to complexity, will be submitted separately
Resolves brave/brave-browser#55816
This ensures UpdateIcon_BraveImpl is called at the point where the upstream has already updated the
image, rather than at the end of the function where it would be skipped by early returns.
Regressions from #35750
TEST=DownloadToolbarInsecureIconTest.InsecureDownloadIcon
On iPhone, rotating to landscape should force fullscreen mode. This was broken because handleFullScreenOrientationChanges derived whether fullscreen or orientation had changed by comparing an expected value against the environment. However, SwiftUI updates environment values before .onChange fires, so the comparison was always false and toggleFullScreen was never called.
The fix uses handler identity instead of value comparison: the isFullScreen handler passes isFullScreenModeChanging: true; the interfaceOrientation handler passes isOrientationChanging: true. The switch then reads the already-updated environment values directly.
Signed-off-by: Eli Hini <8249954+EliHini@users.noreply.github.com>
To add a new BraveVpnService implementation based on Architecture 2.0,
which must co-exist with Architecture 1.0 for quite a while, we need
to split service's interface and implementation. All the external
components will keep accessing VPN service via the BraveVpnService
interface, but the implementation mostly goes into BraveVpnServiceImpl.
This change finalizes the BraveVpnService Architecture 1.0 extraction
based on GN flags. It also splits "components/brave_vpn/browser"
targets in the BUILD.gn into two targets - a shared one and a V1
specific one. The factory is prepared to create different service
implementations, and the V1 tests are ensured to run only when
V1 architecture is enabled by a GN flag.
Implements part of https://github.com/brave/brave-browser/issues/54597
The following content consists of the original commits. Original HEAD
commit is b599de1bcf0702ca11466a3ae1afeac732839544
* shields: add unified panel UI resources and skeleton handler
Add the new unified Shields panel that replaces the legacy popup,
triggered from the existing toolbar Shields icon.
- BraveUnifiedPanelHandler.java (new): skeleton handler with
popup display, basic shields status rendering, favicon display,
and lifecycle management.
- BraveShieldsHandler.java:
- Add mBlockedUrls tracking to BlockersInfo.
- Add getTotalBlockedCount() and getBlockedUrls() accessors for
the unified panel.
- BraveShieldsContentSettings.java:
- Add resetSiteToDefaults() to reset all per-site shields
settings to global defaults via individual JNI getter/setter
pairs.
- BraveToolbarLayoutImpl.java:
- Instantiate BraveUnifiedPanelHandler and route Shields button
taps through it instead of the legacy handler.
- All XML drawables, layouts, string resources, colors, styles,
and BUILD.gn/brave_java_sources.gni wiring.
* shields: implement advanced options and toggle controls
Wire up the expandable advanced options section and all toggle
controls in the unified Shields panel.
- BraveUnifiedPanelHandler.java:
- Implement shields on/off toggle with observer notification.
- Add block scripts and fingerprinting toggles with
BraveShieldsContentSettings persistence.
- Add advanced options expand/collapse with navigation items.
- Add reset site shields to defaults.
- Stub methods for sub-panel navigation.
- BraveToolbarLayoutImpl.java:
- Extract BraveShieldsMenuObserver into a shared instance and
register it on both the legacy and unified panel handlers so
either can trigger toolbar icon updates and page reloads.
* shields: add sub-panel navigation for detailed settings
Implement the drill-down sub-panels accessible from the advanced
options section of the unified Shields panel.
- BraveUnifiedPanelHandler.java:
- Fill out stub navigation methods with full implementations.
- HTTPS upgrades panel with strict/standard/disabled radio
options.
- Trackers & ads panel with aggressive/standard/allow settings.
- Cookies panel with block-all/block-third-party/allow settings.
- Shred site data panel with auto-shred mode selection dialog
and immediate shred with confirmation.
- Each sub-panel persists its selection via
BraveShieldsContentSettings and provides return navigation
to the main panel.
* shields: display favicons for blocked trackers and ads
Add favicon display for blocked tracker domains in the unified
Shields panel, showing up to three cascaded icons with a
prohibited overlay.
- BraveUnifiedPanelHandler.java:
- Add asynchronous favicon lookup via
FaviconHelper.getLocalFaviconImageForURL with a multi-step
fallback chain: exact origin -> registrable domain (via
UrlUtilities.getDomainAndRegistry) -> alternative TLDs.
- Prioritize successfully loaded favicons before
letter-placeholder defaults.
- Render circular icon containers with theme-aware backgrounds,
negative-margin cascading, z-ordering, and a stroke-based
prohibited overlay.
- Use UrlFormatter for display-friendly domain names.
- Use ViewUtils.dpToPx for density-independent measurements.
* shields: implement broken site reporting panel
Wire up the broken site reporting panel in the unified Shields UI,
accessible when shields are toggled off.
- BraveUnifiedPanelHandler.java:
- Add showReportBrokenSitePanel() and
setupReportBrokenSitePanel().
- Display site favicon and domain via UrlFormatter.
- Populate category selection from WebcompatReporterHandler.
- Attach screenshot via BraveShieldsScreenshotUtil.
- Pre-populate contact info from existing reporter preferences.
- Add learn-more clickable span linking to community support.
- Submit report via WebcompatReporterHandler with toast
confirmation.
* shields: Add tests for suitable bits of the implementation.
Add unit tests for the new unified Shields panel logic introduced
across the preceding commits.
- BraveShieldsContentSettingsResetTest.java:
- Verify resetSiteToDefaults() reads global defaults and applies
them to a per-site URL for all eight setting types.
- Verify HTTPS upgrade setter is skipped when global default is
"default" and called when it is any other value.
- BraveUnifiedPanelHandlerStatTest.java:
- Verify addStat() increments the correct counter for each block
type (ads, trackers, scripts, fingerprinting).
- Verify blocked URL recording with 50-item cap.
- Verify clearBraveShieldsCount() resets and removeStat() deletes
tab entries.
- Verify getters return sensible defaults for unknown tab IDs.
- Verify per-tab stat isolation.
- BraveUnifiedPanelFaviconPriorityTest.java:
- Verify populateBlockedItemsContainer() prioritises successfully
loaded favicons before letter-placeholder defaults.
- Verify display is capped at MAX_BLOCKED_ICONS (3).
- Verify onFaviconResult() countdown triggers population only
after all loads complete.
- Verify cascading negative-margin layout for overlapping icons.
- BUILD.gn (brave/android/junit, brave/test):
- Register new robolectric_library targets for the shields and
preferences.website test packages.
* Cleanup & Remove old Shields UI.
This commit completes the changeset by removing the old Shields UI from
the codebase.
Since only a small amount of functionality needed to be kept from the
old UI's code, it has been relocated into BraveUnifiedPanelHandler
* Apply Shields UI tweaks.
This commit applies a number of minor tweaks that were initially missed
from the Figma designs. This should make the look and feel match with
the intended UX fully.
* Shields: Task-post & Back button cleanup.
The back button has been moved to its own XML which is then included by
other dialogs. Additionally, the Shred UI has been fixed up to be
consistent with the existing dialogs.
The favicon rendering task uses PostTask now. The check for whether or
not to post the task has been removed since the callback checks it
anyway and the saving from not posting the task would require pretty
tight timing in order to actually be of benefit so it's arguably not
worth double-checking.
* Shields: Improve accessibility for toggle switches.
Since we have custom-designed toggles, TalkBack would consider them
images. We now attach a delegate to these controls that causes them to
be treated as switches.
* Shields: Improve title sizing, HTTPS reset & fix radio buttons
The title sizing now uses a standard Material style for titles along
with a few tweaks that make it dynamically downsize itself to avoid
truncation.
The HTTPS settings reset is now called unconditionally in order to
resolve a report from the puLL-Merge bot.
Finally, Since there appears to be no easy way to group the radio
buttons whilst retaining the desired style, the code now unconditionally
unchecks them after a settings reset to ensure multiple entries don't
appear to be selected.
* Shields: Remove tryAlternativeTldFavicon code.
We originally implemented a hack for verifying if favicons would load at
all. It has served its purpose and we of course can't legitimately
attempt to pull favicons for other TLDs since they could just be
flat-out wrong. There may be desire for a mechanism in future where we
alias domains, but that is largely out-of-scope for our UI.
* Shields: Support zooming/scrolling the screenshot preview.
When a user reports a site and previews the screenshot (if they choose
to send one) they can now zoom and scroll around the image.
This commit includes the implementation of a reusable class for handling
inputs and scaling the image. I didn't find any pre-existing code for
this behaviour and whilst it could be used elsewhere, I've left it
embedded as a static class since there are no other potential users at
this juncture.
* Shields: Restore code that handles WebView usage.
The old implementation of the Shields panel would ensure
`mHardwareButtonMenuAnchor`/`mContext` were initialised when in WebView
only mode. We still require this in order for the panel to still work.
* Implement more requested minor UI tweaks.
This adds animations to the toggle buttons in the new Shields UI and
fixes the ripple animation on the advanced expander which was missing a
single XML attribute that clamped the effect to the bounds of the
rounded box.
The blocked trackers (without a favicon) have also been tweaked to use
colours from Nala and the letter has been sized up to match the Figma
design.
* Switch toggles to Material UI
This commit switches the toggles to Material UI. This doesn't appear to
have any discernible issues but I'm keeping it separated just in case.
* Support Material You colours and tweak minor UI issues.
This commit alters the XML files so that Material You themes should work
out of the box once the Brave flag for dynamic colours is enabled.
Also resolves a few minor UI issues with placing/alignment/sizing.
Fold/unfold fires onConfigurationChanged without recreating the
activity, leaving containment styling stale. Override
onConfigurationChanged in BraveMainPreferencesBase to post
notifyPreferencesUpdated after the layout pass.
Resolves: https://github.com/brave/brave-browser/issues/55992
AI-assisted commit
This change adds a helper class `MessageHandlerToken` that can be used in JavaScriptFeature's to support tokenized communication validation. The token is a UUIDv4 which is injected with the script itself via placeholder replacement. Given the sensitivity of the token
* Integrate basic shielding in QuickView
1. add a boolean to hide/unhide advanced control in shield panel
2. popover shield panel when user tap shield button in quickview
3. user can shield/unshield tab in quickview
4. user can report broken site from shield panel in quickview
5. reflect all tabs in browser both regular and quickview tab's shield status when shield is enabled/disabled from qucikview.
# Conflicts:
# ios/brave-ios/Sources/Brave/Frontend/Browser/QuickView/QuickViewController.swift
# ios/brave-ios/Sources/Brave/Frontend/Browser/QuickView/QuickViewToolbar.swift
# ios/brave-ios/Sources/Brave/Frontend/Browser/QuickView/QuickViewToolbarModel.swift
* fix share shield activity not working in quickview
* use `DetachedTabPrivacyHelper` as tab's policy decider in QuickView
* address review(Stephen) feedback
* create detachedPrivacyHelper for shielding in quickview mode when tab did create webview
* address review (stephen) feedback
* fix formating
Resolves no issue - use umbrella issue (brave/brave-browser#51462)
With rounded corners, draw an empty border with kRoundedCornersContentsViewMargin
on the outer side and bottom (content view owns its own margins). Without rounded
corners, draw a 1px solid separator on the content-facing side using
kColorToolbarContentAreaSeparator.
Previously, we put resize strip over the border when rounded corners enabled.
But, no border anymore on content-facing side.
Put resize strip over the local bound at the fixed position(0, 0) always.
TEST=SidebarBrowserTest.SidebarV2ResizeAreaPositionMatchesBorderState