Skip to content

LGC-2026-07-13T195050

@CrisBarreiro CrisBarreiro tagged this 13 Jul 16:57
Task/Issue URL:
https://app.asana.com/1/137249556945/project/72649045549333/task/1214489465023872?focus=true
Tech Design URL (if applicable): 

### Description
* Contribute Enable/Disable Ad Blocking entry to the browser menu
* Add view for ad blocking setting selection from browser menu entry
* Add logic to browser menu entry
* If ad blocking enabled, clicking the item will show a bottom sheet,
allowing users to change settings
      * Always On -> Unchanged
* Disable until relaunch -> Disable but don't persist, next app start
(after being killed) will re-enable the feature
* Always off -> Equivalent to disabling in settings. A line below the
toggle item in settings is added
* If ad blocking disabled, clicking the item will enable ad blocking, no
bottom sheet shown

### Steps to test this PR

_UX improvements RC flag disabled - no menu entry_
- [x] Fresh install
- [x] Open a YouTube video
- [x] Check no entry for YouTube ad blocking is shown


_adBlockingExtension RC flag disabled, UX improvements RC flag enabled -
no menu entry_
- [x] Disable `adBlockingExtension` and enable
`adBlockingUXImprovements`flags
- [x] Open a YouTube video
- [x] Check no entry for YouTube ad blocking is shown

_UX improvements RC flag enabled - menu entry on YT pages - test enable_
- [x] Enable `adBlockingExtension` and `adBlockingUXImprovements` RC
flag
- [x] Open a YouTube video
- [x] Check "Enable YouTube Ad Blocking" is shown
- [x] Click it
- [x] Check no new bottom sheet appears
- [x] Check current page reloads
- [x] Check no logs for "Ad blocking disabled"
- [x] Open the menu again and check it now says "Disable YouTube Ad
Blocking"
- [x] Open Ad Blocking settings
- [x] Check the toggle is enabled

_UX improvements RC flag enabled - menu entry on YT pages - test disable
until relaunch_
- [x] From the previous scenario (RC flag enabled, ad blocking enabled),
open a YouTube video
- [x] Click "Disable YouTube Ad Blocking"
- [x] Check a new bottom sheet appears with "Always On" selected
- [x] Click "Disable Until Relaunch"
- [x] Check current page reloads
- [x] Check logs for "Ad blocking disabled"
- [ ] Open the menu again and check "Disable until Relaunch" is selected
- [x] Open Ad Blocking settings
- [x] Check the toggle is disabled and "Disabled until relaunch" is
displayed
- [x] Toggle the feature on and check that second line disappears
- [x] Toggle the feature off and check that second line still doesn't
show
- [x] Toggle the feature on again
- [x] Select "Disable Until Relaunch" again from the browser menu
- [x] Close the app
- [x] Open it again and check ad blocking is now enabled

_UX improvements RC flag enabled - menu entry on YT pages - test
disable_
- [x] From the previous test scenario (RC flags enabled, ad blocking
enabled), open a YouTube video
- [x] Check logs for "Ad blocking disabled"
- [x] Check Enable YouTube Ad Blocking is shown
- [x] Click it
- [x] Check current page reloads
- [x] Check no logs for "Ad blocking disabled"
- [x] Open the menu again and check "Disable until Relaunch" is selected
- [x] Open Ad Blocking settings
- [x] Check the toggle is on

_UX improvements RC flag enabled - no menu entry on non-YT pages_
- [x] From the previous test scenario (RC flags enabled, ad blocking
enabled), open wikipedia.org
- [x] Open browser menu
- [x] Check no entry is shown for ad blocking


### UI changes
| Before  | After |
| ------ | ----- |
!(Upload before screenshot)|(Upload after screenshot)|


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes when ad-blocking scripts inject and how user vs session
preferences interact; mistakes could leave blocking on/off incorrectly
until relaunch or persist the wrong setting.
> 
> **Overview**
> Adds a **“disable until relaunch”** path for YouTube ad blocking: an
in-memory `AdBlockingSessionStore` overrides persisted settings for the
current process, and `AdBlockingState` now distinguishes **permanent**
vs **until-relaunch** disable. `AdBlockingStatusChecker` folds that
session flag into `observeState()` / `observeCanInject()` so injection
stops while the override is active.
> 
> The **browser menu** is wired end-to-end via
`AdBlockingMenuController`: enabled state opens a bottom sheet with
checkmarks for Always On / Disable Until Relaunch / Always Off; disabled
state enables blocking in one tap without the sheet. Settings V2 shows a
two-line toggle with **“Disabled until relaunch”** when that session
override is active, and toggling from settings clears the session
override.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
08fe59e866d30eb11915019340f25c4a8e2c4122. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

> [!NOTE]
> **Low Risk**
> UI-only scaffolding with no persistence or ad-blocking logic wired to
choices yet; behavior change is limited to showing a sheet on menu tap.
> 
> **Overview**
> Tapping the YouTube ad-blocking browser menu item now opens a **child
bottom sheet** with three choices—**Always On**, **Disable Until
Relaunch**, and **Always Off**—instead of only forwarding the host
click.
> 
> The sheet is implemented via `AdBlockingMenuBottomSheetDialog`,
`AdBlockingChoice`, layout `bottom_sheet_ad_blocking_menu.xml`, and new
copy/icons. Selection is surfaced through an `EventListener`;
`AdBlockingMenuItemView` currently **logs the choice only** and does not
yet apply settings or update blocking behavior (follow-up stack PR).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
1674f476f960d224b718630887dfbf22a7959383. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

> [!NOTE]
> **Low Risk**
> Mostly new UI and a small extension API; gating is behind remote
config and domain checks, and the menu item does not change blocking
behavior on click in this change.
> 
> **Overview**
> Introduces a **pluggable top-of-browser-menu** hook
(`TopInContextSection`) and wires it through `BrowserMenuBottomSheet`,
`BrowserTabFragment`, and a new plugin point in `BrowserModule`.
> 
> The ad-blocking module contributes a **YouTube ad-blocking menu row**
that shows **Enable/Disable YouTube Ad Blocking** on matching URLs.
Visibility and label come from `AdBlockingMenuStateProvider`, which
combines the extension domain matcher, remote-config toggles (kill
switch, UX improvements, contingency), and `AdBlockingStatusChecker`
state. The row is a reactive `AdBlockingMenuItemView`; taps currently
only run the host callback (menu-used pixel + dismiss)—toggle behavior
is left for follow-up work per the PR description.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
5529d4fa7649137a79d66d4c110bc189b76a42e2. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

---------

Co-authored-by: smartling <smartling@host-vm>
Assets 2
Loading