Commit Graph
306 Commits
Author SHA1 Message Date
Dev 36605e97e0 fix: remove secret key material from log messages (#34265)
* fix: remove secret key material from log messages

CRITICAL: Several VLOG(1) statements were logging plaintext secret
key material that could be captured via adb logcat (Android) or
Console.app (iOS):

- browser/android/brave_sync_worker.cc: Sync recovery phrase (seed
  words) and hex-encoded sync seed logged on parse failure
- ios/browser/api/sync/brave_sync_worker.cc: Same issue on iOS
- components/brave_wallet/browser/filecoin_keyring.cc: Import payload
  containing Filecoin private key logged on JSON parse failure

These log statements would expose the user's master sync secret or
private key material to any process with log access. The fix removes
the secret material from all log messages while preserving the
diagnostic error information.

* fix: also redact plaintext sync code from LOG(ERROR) in SetSyncCode (iOS) and SaveCodeWords (Android)

* fix: apply clang-format to sync worker files
2026-03-02 10:51:59 +00:00
Serg 461d66e02c [Android] Shows Brave Wallet UI based on policy. (#33630)
* [Android] Shows Brave Wallet UI based on policy.

Resolves: https://github.com/brave/brave-browser/issues/52496
2026-02-04 10:08:30 -05:00
Aleksei Seren 6309b120a6 [ads] Brave Ads buildflag for Android (#33374)
The PR adds Brave Ads buildflag checks to Android code
which depends on Brave Ads.
2026-01-30 19:27:32 +00:00
samartnik 7a0552e17c [Android] Fix for Youtube background play (#33522) 2026-01-30 11:38:49 -05:00
Artem Samoilenko 79cb1bbb57 [cr145][Android] Replace JavaParamRef -> JavaRef
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/0d6ec7e0f328e9ddd6f5174f61676ff85c777af6

commit 0d6ec7e0f328e9ddd6f5174f61676ff85c777af6
Author: Andrew Grieve <agrieve@chromium.org>
Date:   Tue Dec 2 12:37:02 2025 -0800

    Android: Replace JavaParamRef -> JavaRef (part 5)

    JavaParamRef used to be different, but now is an alias for JavaRef.

    Bug: 40173007
    Change-Id: I9bfa2fcdd012fc90859886ee2e747cb360733421
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7217772
    Commit-Queue: Andrew Grieve <agrieve@chromium.org>
    Owners-Override: Andrew Grieve <agrieve@chromium.org>
    Reviewed-by: Martin Kong <martinkong@google.com>
    Cr-Commit-Position: refs/heads/main@{#1553033}
2026-01-29 13:40:24 -05:00
Artem Samoilenko a79268cd0e [cr145][Android] Add DEFINE_JNI macro to the end of every file (part 1)
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/37865ec47270489182e954bb9a6dc32c04fd51d7

commit 37865ec47270489182e954bb9a6dc32c04fd51d7
Author: Martin Kong <martinkong@google.com>
Date:   Mon Dec 1 08:47:18 2025 -0800

    Add DEFINE_JNI macro to the end of every file (part 1)

    This CL adds DEFINE_JNI(ClassName) macro to the end of every file
    that includes ClassName_jni.h. Currently the macro expands to nothing.

    Bug: 346596940
    Change-Id: I61da4d1cc46f71d8ede30f74b267237a5f8cf14f
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7206009
    Commit-Queue: Andrew Grieve <agrieve@chromium.org>
    Auto-Submit: Martin Kong <martinkong@google.com>
    Reviewed-by: Andrew Grieve <agrieve@chromium.org>
    Owners-Override: Andrew Grieve <agrieve@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1552186}
2026-01-29 13:40:19 -05:00
vadims ab701482db [Shred] Auto shred UI implementation (#33414)
Added UI implementation for the auto shred feature

Resolves: https://github.com/brave/brave-browser/issues/52278
Resolves: https://github.com/brave/brave-browser/issues/51620
---------

Signed-off-by: Vadym Struts <vstruts@brave.com>
2026-01-29 12:17:49 +01:00
Serg ec99d6c72e [Android] Shows Brave News UI based on policy. (#33342)
Resolves: https://github.com/brave/brave-browser/issues/52170
2026-01-21 21:48:09 +00:00
Brian Clifton c1def2b65a Remove obsolete setting from search settings (#32950)
* Remove obsolete setting from search settings

Fixes https://github.com/brave/brave-browser/issues/51656

* lint fixup
2025-12-29 14:51:19 -07:00
Serg 7a06a92381 [Android] Android origin policies
Creates origin policies constants for Android
Adds BraveOriginServiceFactory and connect preferences with BraveOriginSettingsHandler
Resolves https://github.com/brave/brave-browser/issues/51333
2025-12-10 07:14:19 +09:00
vadimsandShivan aacd064270 [Element Blocker] Disabled by Default Support for Blocking Elements in Private Browsing (#32339)
Added the ability to enable or disable the element blocker in private browsing
mode using a separate toggle in the shields settings area (default OFF).

Resolves: https://github.com/brave/brave-browser/issues/49428

---------

Signed-off-by: Vadym Struts <vstruts@brave.com>
Co-authored-by: Shivan <shivankaulsahib@gmail.com>
2025-12-02 11:12:45 +01:00
Brian R. Bondy a4d9248fcb Add enable_brave_wallet gn var and build flag (#32484)
* Add enable_brave_wallet GN variable and build flag

This adds a new GN build flag 'enable_brave_wallet' that can be set to
false to exclude Brave Wallet from the build. The flag is true by default
to maintain current behavior.

Changes include:
- Add enable_brave_wallet declare_args in build/config/BUILDCONFIG.gn
- Create brave_wallet/common/buildflags with ENABLE_BRAVE_WALLET flag
- Update all BUILD.gn and sources.gni files to use the new flag
- Add wallet buildflags dependencies via minimal one-line imports

* Add patches for wallet buildflags in Chromium BUILD files

Adds minimal one-line patches to import wallet buildflags dependencies
in Chromium source files. This allows Chromium code to conditionally
depend on wallet headers.

Patches:
- chrome/browser/ui/hid/BUILD.gn
- net/BUILD.gn
- third_party/blink/common/BUILD.gn
- third_party/blink/public/common/BUILD.gn
- third_party/blink/renderer/modules/permissions/BUILD.gn

* Guard wallet code in Chromium source overrides

Updates chromium_src overrides to conditionally compile wallet-related
code based on enable_brave_wallet flag. This includes:

- Adding DEPS files to allow buildflags dependencies
- Guarding wallet permission handling with #if BUILDFLAG(ENABLE_BRAVE_WALLET)
- Keeping wallet permission enum values unconditionally to maintain profile
  interchangeability between wallet-enabled and wallet-disabled builds
- Updating component registration and preference handling

Key changes:
- Permission enums remain stable across build configs for UMA and persistence
- Wallet permission handling code only compiled when wallet enabled
- DEPS files updated to allow buildflags includes

* Guard wallet UI code in front-end TypeScript and Mojom

Conditionally compiles wallet-related UI code in TypeScript and Mojom
interfaces based on enable_brave_wallet preprocessor flag.

Changes:
- Settings menu: Use lastInserted pattern for menu item ordering
- Page visibility: Guard wallet page visibility checks
- Browser commands: Guard wallet command handling
- Routes: Conditionally include wallet routes
- Add non-null assertions for DOM insertions in TypeScript
- Update Mojom interfaces to conditionally include wallet enums

Front-end code uses <if expr="enable_brave_wallet"> preprocessor
directives to exclude wallet UI when the feature is disabled.

* Guard wallet usage in non-wallet Brave code

Conditionally compiles wallet-related code in non-wallet Brave files
based on enable_brave_wallet build flag.

Changes include:
- browser/: Guard wallet service factories, preferences, and helpers
- components/: Guard wallet dependencies in rewards, sidebar, and DNS
- renderer/: Conditionally register wallet content settings
- utility/: Guard wallet component registration
- ios/: Add optional chaining for wallet feature flags
- test/: Guard wallet-related test code

Key files:
- brave_stats_updater.cc: Guard wallet pref registration with #if
- brave_profile_prefs.cc: Conditionally register wallet preferences
- sidebar_service.cc: Guard wallet panel items
- iOS WalletConstants.swift: Use optional chaining for feature checks

This allows building Brave without wallet while maintaining profile
compatibility between wallet-enabled and wallet-disabled builds.

* Add static_assert for ENABLE_BRAVE_WALLET in wallet headers

Adds compile-time assertions to wallet headers to ensure they are only
included when wallet is enabled. This prevents accidental usage of wallet
APIs when enable_brave_wallet=false.

Added static_assert(BUILDFLAG(ENABLE_BRAVE_WALLET)) to:

browser/brave_wallet/ (11 files):
- asset_ratio_service_factory.h
- brave_wallet_context_utils.h
- brave_wallet_ipfs_service_factory.h
- brave_wallet_provider_delegate_impl.h
- brave_wallet_service_factory.h
- brave_wallet_tab_helper.h
- meld_integration_service_factory.h
- wallet_notification_service_factory.h
- simulation_service_factory.h
- swap_service_factory.h
- wallet_data_files_installer_delegate_impl.h

components/brave_wallet/browser/ (15 files):
- brave_wallet_p3a_private.h
- brave_wallet_prefs.h
- brave_wallet_service.h
- brave_wallet_utils.h
- ens_resolver_task.h
- json_rpc_service_test_utils.h
- json_rpc_service.h
- keyring_service_observer_base.h
- keyring_service.h
- network_manager.h
- permission_utils.h
- pref_names.h
- test_utils.h
- tx_service.h
- wallet_data_files_installer.h

components/brave_wallet/common/ (6 files):
- brave_wallet_types.h
- common_utils.h
- eth_abi_utils.h
- features.h
- hex_utils.h
- pref_names.h

Also includes minor wallet code updates to use buildflags and
guard zcash-specific test code.

* Follow up fixes after Parts 1-7
2025-11-28 15:54:27 -05:00
Artem Samoilenko 52a50cf00d [cr143] SyncServiceObserver: Make OnSyncShutdown() pure virtual
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/7b876338b50659b0ede0412040c8d86dd39c4c8d

commit 7b876338b50659b0ede0412040c8d86dd39c4c8d
Author: Marc Treib <treib@chromium.org>
Date:   Mon Oct 13 02:50:06 2025 -0700

    SyncServiceObserver: Make OnSyncShutdown() pure virtual

    All subclasses now implement this method \o/

    Making the method pure virtual forces all implementers to consider
    whether they need to do anything there (i.e. drop the SyncService
    observation).

    Fixed: 40882734
    Change-Id: I32c9767e4a88f91714ef7be7c004cad5791eb786
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6973542
    Commit-Queue: Marc Treib <treib@chromium.org>
    Reviewed-by: Mahmoud Rashad <mmrashad@google.com>
    Cr-Commit-Position: refs/heads/main@{#1528808}
2025-11-18 11:18:59 -05:00
Claudio DeSouza 13a2651e70 [cr143] GURL::*_piece() removed
All the main methods now return a string_piece, which made the `_piece`
functions redundant.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/566074ac1aee3a91cbec0d2eac3120b7dd71860b

commit 566074ac1aee3a91cbec0d2eac3120b7dd71860b
Author: Charlie Harrison <csharrison@chromium.org>
Date:   Mon Oct 6 19:18:05 2025 -0700

    Remove GURL::*_piece() method

    There are no more users of this deprecated and misnamed API.
    This completes phase 1.5 of crbug.com/448174617.

    Bug: 448174617
    Change-Id: I82918ec4ec10b68729c31cb36487c7cb02ad0b56
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7008912
    Reviewed-by: Daniel Cheng <dcheng@chromium.org>
    Commit-Queue: Daniel Cheng <dcheng@chromium.org>
    Owners-Override: Charlie Harrison <csharrison@chromium.org>
    Owners-Override: Daniel Cheng <dcheng@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1525986}
2025-11-18 11:18:46 -05:00
Claudio DeSouza 51604f40d0 [cr143] Several GURL methods returning string_view
This migration has been effected in upstream, but several places in our
codebase got broken by this transition. This change makes several parts
of our codebase more friendly to passing `string_view`.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/0e1784e3cf990560b173f40338e582f50aba0e85

commit 0e1784e3cf990560b173f40338e582f50aba0e85
Author: Charlie Harrison <csharrison@chromium.org>
Date:   Fri Oct 3 11:04:26 2025 -0700

    RELAND: Migrate GURL::path() and friends to return string_view

    This relands crrev.com/c/7003625. Missing cases were found by staring
    at the output of `git grep` for the whole codebase.

    Origin description:
    Also migrates some last remaining callers of the std::string APIs.
    This completes phase 1 of crbug.com/448174617.

    Bug: 448174617
    Change-Id: I7f24f81d1fbf129d8b0dd94f4cf948626deab933
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7007010
    Reviewed-by: Daniel Cheng <dcheng@chromium.org>
    Commit-Queue: Charlie Harrison <csharrison@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1524878}
2025-11-18 11:18:41 -05:00
Artem Samoilenko 96e0234f73 [cr143][Android] Migrate NewTabPagePreloadPipelineManager to TabFeatures
Error fixed:
../../chrome/browser/android/preloading/android_prerender_manager.cc:56:39: error: no member named 'new_tab_page_preload_pipeline_manager' in 'tabs::TabFeatures'
   56 |   return tab ? tab->GetTabFeatures()->new_tab_page_preload_pipeline_manager()

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/8965a614fb0e5c650f888a8644bbbfa9ae433635

commit 8965a614fb0e5c650f888a8644bbbfa9ae433635
Author: Robert Lin <robertlin@chromium.org>
Date:   Wed Oct 1 20:18:36 2025 -0700

    Migrate NewTabPagePreloadPipelineManager to TabFeatures

    According to `docs/chrome_browser_design_principles.md`, TabFeatures
    is preferred for all tab-centric features. This CL migrates
    NewTabPagePreloadPipelineManager to TabFeatures

    Bug: 421941586
    Change-Id: Id48373979e7b6750e24c3bc60365a0760bf252ea
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6980603
    Reviewed-by: Tom Lukaszewicz <tluk@chromium.org>
    Commit-Queue: Huanpo Lin <robertlin@chromium.org>
    Reviewed-by: Sky Malice <skym@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1523984}
2025-11-18 11:18:39 -05:00
Szilard Szaloki 8698c26abb [Android] Sync Account section with registration flow. (#32319) 2025-11-14 22:31:31 +01:00
Brian Johnson e219548035 Move ForgetFirstPartyStorageEnabled to BraveShieldsSettingsService (#31825)
Migrating settings from deprecated brave_shields_util to consolidate in BraveShieldsSettingsService
2025-11-05 09:49:26 +09:00
cdesouza-chromium 07b587a892 [CodeHealth] Use BASE_FEATURE with two args where possible (#32041)
This PR corrects several places where `BASE_FEATURE` is being used to
rely on the two-arg variant of this macro. This particular PR has no
functional changes, and the only feature declarations affected are the
ones for which the feature-name constant, and the actual value are
identical.

The particular issue for this will be left open so subsequent work for
the other features can be followed up on.

Bug: https://github.com/brave/brave-browser/issues/50492
2025-10-27 18:56:50 +00:00
AlexeyBarabash 9b18479f3e [cr142][Android] ScopedJavaLocalRef.ctor is private
Chromium change:
https://source.chromium.org/chromium/chromium/src/+/36a44467b00a84f0696ace4e69cdc1c712a20992

	JNI Zero: Remove WEBRTC_ANDROID guard from JNI_ZERO_ENABLE_COMPAT_API

	WebRTC has migrated to newer APIs on
	https://webrtc-review.googlesource.com/c/src/+/409500/, so the
	compatibility layer no longer needs to be used for WebRTC Android.

	Bug: 40173007
	Change-Id: I8007d1a92f4b79fdf0dd6d36b8d60181094f4f7e
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6967913
2025-10-15 20:31:24 -04:00
Brian Johnson 1f27a328c6 [Speedreader] Remove speedreader on android (#31418)
Remove buggy speedreader implementation on android
2025-09-29 11:52:46 +09:00
Serg 89ce54707b Android origin skus (#31431)
* Connects GPS Brave Origin purchase with SKUs SDK

We need to pass order token to the SKUs SDK to be able to register
Brave Origin purchase from Google Play Store on Android. The commit
exposes Brave domains util functions and SkusService via mojom to
Java.
Resolves: https://github.com/brave/brave-browser/issues/49619
2025-09-27 09:06:27 +09:00
samartnik dd0d6e9831 [Android] Changes condition for PIP script injection (#31065) 2025-09-08 07:07:22 -04:00
Pavel Beloborodov 644dfbecbf Speedreader GN structure. (#30702)
* Inroduced BUILD.gn for //brave/browser/speedreader.
2025-09-01 20:10:34 +07:00
Simone Arpe 1fd0726cb7 Improve Picture-in-picture transition algorithm (#30934)
* 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
2025-08-29 19:24:06 +02:00
AlexeyBarabash be9e624bff [cr140][Android] Disabled YouTubeScriptInjectorBrowserTest.MultipleFullscreenCalls
This test is flaky on CI and succeedes on local env.

Follow-up issue:
https://github.com/brave/brave-browser/issues/48430
2025-08-20 01:07:05 +03:00
AlexeyBarabash ee9681703a Fixed wrong condition at GetWordsFromSeedHex 2025-08-19 19:54:33 +01:00
AlexeyBarabash 75d47f9af9 [cr140][Android] Fixed missing includes for WebContens 2025-08-19 19:54:17 +01:00
Simone Arpe 9c848af0b5 Fix Picture-in-Picture orientation issues for YouTube videos (#30578)
This fix ensures that YouTube videos on Android can properly handle the transition from fullscreen playback to Picture-in-Picture mode without interference from automatic screen orientation changes.
2025-08-12 13:59:08 +02:00
Simone Arpe d467850cbc Improve Picture-in-Picture Logic for YouTube Videos on Android (#30548)
Refactors and improves the Picture-in-Picture (PiP) functionality for YouTube videos in Brave Android browser.
The changes focus on better integration, cleaner architecture, improved reliability, and proper handling of Android system settings.
2025-08-11 15:23:45 +02:00
Simone Arpe ce1125a96b Improve picture in picture transition (#30330)
* Fix OnFullscreenScriptComplete never called

* Reset fulscreen requests

* Improve fullscreen script

* Ressume media session when entering fullscreen

* Exit fullscreen when leaving picture in picture mode

* Apply code formatting

* Fix tests
2025-07-29 20:13:24 +02:00
Simone Arpe 6ed3822029 Improve YT video check (#30156) 2025-07-22 19:56:20 +02:00
Simone Arpe 6e1791f50c Add PIP icon in omnibox (#29431) 2025-07-17 21:17:54 +02:00
Max Karolinskiy 6c6f0b89e2 [cr139] //chrome/browser:flags was added.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/62d53e38d8025e6de29b6b74ee866c6dd6887a4b

commit 62d53e38d8025e6de29b6b74ee866c6dd6887a4b
Author: Antonio Gomes <tonikitoo@igalia.com>
Date:   Fri Jun 20 16:06:53 2025 -0700

    Introduce //chrome/browser:flags

    .. that today compiles about_flags.h and flag_description.h

    What is more, this new target is added temporarly as part of the
    `public_deps` of //c/b:b, not to change the status quo - ie all targets
    that today depend on //c/b:b to include these headers will continue to.
    However, in a follow up:

      1/ //c/b:flags will be removed from the `public_deps` of //c/b:b, and all
      targets that depend on it will list it explicitly.

    In practice, the newly added GN target //c/b:flags also allows the componentization
    of .cc files of chrome/browser/ui/toolbar/chrome_labs/, without circular dependencies
    against //c/b:b.

    Bug: 369436587
2025-07-16 13:38:49 -04:00
StephenHeaps 5e101d4731 fix(privacy): Move Brave Shields utility functions to shared location (#29736)
* Move Brave Shields utility functions
- Move utility functions that are not using `//content/` from `/components/brave_shields/content/` to `/components/brave_shields/core/` so it can be also be accessed by iOS.

* Update tests
- Update tests after moving functions from `/components/brave_shields/content/` to `/components/brave_shields/core/`.

* Fix UNSAFE_TODO
- Update brave_shields_p3a.cc to address unsafe buffer warnings.
2025-07-14 09:33:26 -04:00
Brian Johnson cba8b77182 fix "main file cannot be included recursively when building a preambl… (#29752)
Fix "main file cannot be included recursively when building a preamble" for TabFeatures override on desktop and android
2025-06-25 21:22:04 +07:00
cdesouza-chromium 34c2028c47 [IWYU] Fix includes for utf conversion functions (#29709)
This PR does IWYU for the following files:

 - base/strings/utf_string_conversions.h
 - base/i18n/number_formatting.h

This is a mechanical change, and for more details, check the issue
description.

Resolves https://github.com/brave/brave-browser/issues/47060
2025-06-23 22:44:37 +01:00
Terry Mancey c9dbac0d22 [CodeHealth] Remove uses of banned std::to_string (#29669)
This PR replaces the banned std::to_string with its //base counterparts.
https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++-features.md#std_sto_i_l_ul_ll_ull_f_d_ld_to_string_banned
2025-06-23 10:38:09 -04:00
cdesouza-chromium 821274796b [IWYU] Fixing logging inclusions pt.11 (#29531)
This change is one of many fixing inclusion for the following files:

    - `base/notimplemented.h`
    - `base/notreached.h`
    - `base/check.h`
    - `base/dcheck_is_on.h`
    - `base/check_deref.h`
    - `base/check_op.h`
    - `base/logging/log_severity.h`
    - `base/logging.h`

This change is a mechanical change done with the following script:
https://github.com/brave/brave-browser/issues/46707#issuecomment-2960116515

Resolves https://github.com/brave/brave-browser/issues/46707
2025-06-12 13:48:07 +01:00
Claudio DeSouza fbe55ecb90 [cr138] SetSyncFeatureRequested deleted
This function was already gutted functionally, and now this
functionality is exclusive to ChromeOS.

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/4c52eb14ee5ad97ee65048fc7649ded426f7fa63

commit 4c52eb14ee5ad97ee65048fc7649ded426f7fa63
Author: Mikel Astiz <mastiz@chromium.org>
Date:   Wed May 14 02:50:23 2025 -0700

    [sync] Remove SetSyncFeatureRequested API

    Gradually and definitely starting with the recent
    https://crrev.com/c/6533710, SyncService::SetSyncFeatureRequested() did
    nothing outside ChromeOS.

    On ChromeOS, starting with https://crrev.com/c/6540467, there is a
    better API to use in SyncUserSettings.

    In this patch, ChromeOS callers are migrated to the better API and
    everything else is cleaned up as they are no-op calls. As a result, the
    SetSyncFeatureRequested API itself, as well as the Java counterpart, can
    be safely deleted.

    Bug: 40772592,40911173
    Change-Id: I716ac1e59cc99afccf313697c0121858d19898c8
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6540075
    Commit-Queue: Mikel Astiz <mastiz@chromium.org>
    Reviewed-by: Marc Treib <treib@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1459963}
2025-06-11 17:07:18 -04:00
Simone Arpe e5be5e25ec Rename background_video_player_tab_helper into youtube_script_injector_tab_helper (#29233)
* Make `IsBackgroundVideoPlaybackEnabled` method more readable

* Rename background_video_player_tab_helper into youtube_script_injector_tab_helper

* Apply code formatting
2025-05-29 13:51:50 +02:00
Simone Arpe 660020c778 Tweak background video playback description in flag page (#29207)
* Tweak background video playback description in flag page
* Remove redundant call to allow Javascript injection
The method `content::RenderFrameHost::AllowInjectingJavaScript()` is already called in
`background_video_playback_tab_helper` for those domains that correctly have a match so
it's not needed in `brave_browser_main_parts`.
* Fix boolean logic
* Make `IsBackgroundVideoPlaybackEnabled` method more readable
* Remove unneeded predefined default value from XML
* Refactor logic and remove old code
* Enable background video playback preference by default
* Remove unused constant
2025-05-29 11:33:22 +02:00
Simone Arpe e2a5b49706 Remove usage of BravePrefServiceBridge for boolean background video playback (#29197)
* Remove usage of `BravePrefServiceBridge` for boolean background video playback

* Use mTabModelProfileSupplier as settings UI always use original profile
2025-05-28 16:05:26 -07:00
Artem Samoilenko db61accadf [cr137] [Android] TabAndroid implements TabInterface
Chromium change:
https://chromium.googlesource.com/chromium/src/+/715ac48128b5de0e854c4233dbb922249b950e54

[Tabs] TabAndroid implements TabInterface

In order to use tab_collection for Chrome Android a TabInterface
implementation is required. The logical candidate for this is
TabAndroid. This CL has TabAndroid implement TabInterface with most
methods currently being stubbed out with NOTIMPLEMENTED until future
CLs.

Notable changes:
- Some existing TabAndroid users wanted WeakPtr<TabAndroid> this
  collided with TabInterface::GetWeakPtr so a renamed
  GetTabAndroidWeakPtr is added and existing callers are migrated.
- TabFeaturesAndroid is renamed to tabs::TabFeatures to fulfill
  the definition of the forward declaration of TabFeatures in
  TabInterface. While we could put in more effort to share a
  TabFeatures interface in components/tabs/ this would likely
  introduce lots of buildflags and has some blockers due to a
  dependency on chrome/... This is a possible follow-up.
- SplitTabId is redefined in tab_android.h temporarily until it
  can be migrated to components/tabs/ in order to be shared.

Bug: 409366905
2025-05-13 15:52:58 -04:00
Simone Arpeandbridiver dba6298f0d Inject JS script to restore picture in picture behavior (#28593)
Implements a strategy to bring back picture in picture support for YouTube videos.
Picture in picture implementation is behind feature flag `kBravePictureInPictureForYouTubeVideos` enabled by default.

Test coverage has been extensively discussed and introduced to make sure:

- We don't have race conditions when injecting the JS script
- We don't inject the script multiple times on same page navigation
- We don't create side effects in case of unexpected changes, and/or serialzed flags don't match
- We inject/modify the serialized flags in case of partial match

---------

Co-authored-by: bridiver <34129+bridiver@users.noreply.github.com>
2025-05-06 15:14:15 +02:00
Brian Johnson c75d1de3d3 [CodeHealth] remove brave_l10n::GetLocalizedResourceUTF16String (#28889)
remove brave_l10n::GetLocalizedResourceUTF16String and replace with ui/base/l10n
2025-05-01 04:22:24 -07:00
Max Karolinskiy 40f558edc7 [cr135][Android] TabFeaturesAndroid moved to own target.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/0da964ef06024

commit 0da964ef06024feb83ba3acb34d86ee7a61f64b6
Author: Jay Harris <harrisjay@chromium.org>
Date:   Wed Feb 12 11:41:45 2025 -0800

    [TabFeatures]: Refactor TabFeaturesAndroid into its own target

    Bug: 395640953
2025-03-18 20:02:11 -04:00
Claudio DeSouza 0a7802d702 [cr135] flags_ui moved under //components/webui/
This affects several gn inclusion paths, header files, and shadow files
to this component.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/422d5eb80c1ee199aaf98f07707e71449fb42d86

commit 422d5eb80c1ee199aaf98f07707e71449fb42d86
Author: rbpotter <rbpotter@chromium.org>
Date:   Wed Feb 5 08:42:48 2025 -0800

    WebUI: Refactor components/flags_ui into components/webui/flags

    Followup from refactoring recommended by components/ OWNER in
    https://chromium-review.googlesource.com/c/chromium/src/+/6178599

    no other changes

    Bug: 379889249
2025-03-18 20:02:00 -04:00
vadims b3e162dba1 Additional Shields menu item to show all blocked elements(same as reset) (#27910)
Additional Shields menu item to show all blocked elements(same as reset)
(https://github.com/brave/brave-browser/issues/43955)

---------

Signed-off-by: Vadym Struts <vstruts@brave.com>
2025-03-13 15:54:57 +01:00
Artem Samoilenko 8ad41286d0 [Android] Remove duplicate jni headers generation 2025-03-06 15:49:32 -05:00