Commit Graph
37 Commits
Author SHA1 Message Date
Pavel Beloborodov 5b7a479719 Prevent blocked events from previous navigation showing up on new page (#33250)
* Replaced render_tree_node_id with render_frame_token.
* Check the blocking report only for active frames.
2026-01-22 16:13:59 +00: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
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
Pete Miller df3c9a7a8f AI Chat: Create a semi-built-in Profile for agentic features (#30285)
* AI Chat: Create a semi-built-in Profile for agentic features

For now, these features will only be useable in this profile. The purpose is for users and team members to experiment with these features, isolated from their regular browser context with existing site authentication. Whilst these features might evenutally be usable in a user's main profile under isolated storage (a built-in Container), this allows us to decouple these features from that behavior being implemented, as well as try out the separate Profile experience.

- Flag for whether the agentic behavior and the separate profile is enabled
- UI for the button in the AI Chat WebUI that will launch the profile
- Profile creation params, theme, and behavior:
  - Doesn't cause the profile picker to be shown on browser startup

For subsequent PRs:
- A separate and basic NTP with messaging
- Content agent features
2025-08-06 07:08:14 -07:00
Pavel Beloborodov dcce38b856 Fixed crash. (#26110) 2024-10-21 18:14:06 +07:00
Claudio DeSouza e3a4f0322f Migrate to FrameTreeNodeId in the remaining places
Upstream seems to have completed the whole migration to an opaque
`FrameTreeNodeId`. This change converts all the places that were using
an `int` still.

Chromium change:
https://chromium.googlesource.com/chromium/src/+/e4de125f43660ff1f41e36fbff545c3bf2a7e401

commit e4de125f43660ff1f41e36fbff545c3bf2a7e401
Author: Avi Drissman <avi@chromium.org>
Date:   Thu Sep 5 00:15:45 2024 +0000

    Use an opaque type for FrameTreeNode IDs, part 15

    content/public

    Bug: 361344235
2024-10-03 17:06:28 +01:00
Aleksei Khoroshilov 1c48f00923 Pass ShieldsSettings to renderer via mojo. (#25505)
* Pass ShieldsSettings to renderer via mojo.

* Use switch to handle all ControlType values.

* Rename origins_to_allow_scripts_once to origins_to_allow_scripts.

* Cleanup RenderFrameHost interaction during ShieldsSettings passing.

* Extract GetFarblingLevel into a function.

* Use ShieldsSettings in WorkerContentSettingsClient.

* Replace WorkerContentSettingsClient patches with subclass.
2024-09-18 15:55:04 +07:00
Pavel Beloborodov 09558152d8 Added adblock info tab. (#25490)
* Added adblock info tab.
2024-09-17 08:01:27 +02:00
Pavel Beloborodov ea0df411e9 Stt issues (#23849)
* STT url override by speech_to_text:web_service_url feature param.
* Disabled speech recognition in Tor.
* Added Brave Service Key V2 for Speech to text.
2024-08-23 12:37:15 +07:00
Pete Miller d90b4a49d6 Integrate brave's webui additions into chromium's typescript build process (settings, bookmarks, extensions), remove chrome://brave-resources
- Convert lots of JS to typescript,  although marked a lot of it as ts-nocheck as adding types would take a very very long time. To be done separately, hopefully with help!
- Upgrade many modules to polymer3
- Use chromium's build target for everything instead of duplicating a lot of build processes
- Do the same for everything that was served by chrome://brave-resources, now that it's easier to have the build system for chrome://resources take our additional files
TODO: Bring back manrope substitution for ru|el languages from brave_shared_resources_data_source.cc
2022-10-13 16:51:36 -04:00
Terry Mancey 45984c92ca Refactor LocaleHelper to use non-member functions 2022-10-12 11:56:01 -05:00
Pavel BeloborodovandPete Miller 096865aad3 Removed 'Muli' font. Added 'Manrope' font. Extended 'Poppins' with 'Manrope' for Cyrillic&Greek chars. (#12933)
* Reference to Manrope (Cyrillic & Greek) added for the Poppins font.

* License.

* Bye, bye 'Muli' it's a Poppin's time.

* Overrided Poppins with Manrope.

* Load font from resources instead of hardcode.

* Lint.

* GN fixed.

* Lint.

* Format.

* Clean up.

* Removed Mult files.

* Font weight fixes.

* Safety check padding.

* Font-weight on active state.

* Added comment.

* Update brave-ui ref to include https://github.com/brave/brave-ui/pull/607

- Remove Muli in favor of Poppins

* Rebase.

* Reverted package and package-lock jsons.

* Rebased.

* extra muli -> poppins text styles as a result of brave-ui update to remove muli from more places

Co-authored-by: Pete Miller <miller.pete@gmail.com>
2022-09-21 09:58:38 -07:00
Claudio DeSouza 03e43f57ef GetMimeType taking a URL as argument
Chromium change:
https://chromium.googlesource.com/chromium/src/+/36154304c4d53c584f308efa86e9682f222a18e9

commit 36154304c4d53c584f308efa86e9682f222a18e9
Author: Giovanni Ortuño Urquidi <ortuno@chromium.org>
Date:   Wed Aug 10 05:36:17 2022 +0000

    webui: Remove deprecated GetMimeType(path)

    Remove GetMimeType(const std::string& path) function now
    that all overrides have been removed.

    Also makes GetMimeType(const GURL& url) pure virtual.

    Fixed: 1344742
2022-09-15 20:46:15 -04:00
Claudio DeSouza 2987acef1e [CodeHealth] Clang tidy browser with use-equals-default V
This change corrects the constructors of several classes under
browser/, using clang-tidy's modernize-use-equals-default. Additionally,
this commit includes a few additional straggler files.
2022-08-17 15:48:08 +01:00
Pete Miller 94f8c2d240 Brave Shared Resources omits "Access-Control-Allow-Origin:" header if not an allowed origin (any origin on chrome:// or chrome-untrusted://) 2022-04-14 17:29:50 -07:00
Pete Miller 2870fce218 VPN panel webui uses chrome-untrusted protocol 2022-04-14 17:29:46 -07:00
Mario Sanchez Prada f4c7bdda37 Migrate define(OS_*) to using BUILDFLAG(IS_*) instead
See the following PSA in the chromium-dev mailing list for more
information and links to the original discussion, the design
document and the metabug:

https://groups.google.com/a/chromium.org/g/chromium-dev/c/EIuQCy9sVfw/m/Net3FPz6AwAJ

Resolves https://github.com/brave/brave-browser/issues/21608
2022-03-22 10:57:30 +01:00
Mario Sanchez Prada bbf5fd3fe9 Remove deprecated DISALLOW_ macros from Brave-specific code
Macros such as DISALLOW_COPY_AND_ASSIGN() are deprecated since r711900
per style arbitration [1]. This commit replaces the macros with deleted
constructors and methods, which is preferred by the Google C++ Style
Guide [2][3].

Also remove unneeded "base/macros.h" #includes when possible.

This CL is created semi-mechanically with remove_disallow and
remove_base_macros [4].

[1]: https://groups.google.com/a/chromium.org/g/cxx/c/qwH2hxaEjac/m/TUKq6eqfCwAJ
[2]: https://chromium.googlesource.com/chromium/src/+/main/styleguide/c++/c++-dos-and-donts.md#explicitly-declare-class-copyability_movability
[3]: https://google.github.io/styleguide/cppguide.html#Copyable_Movable_Types
[4]: https://pkg.go.dev/go.timothygu.me/tools/cr/cmd

Chromium change:

https://chromium.googlesource.com/chromium/src.git/+/d002a3bee7ae75780b604d17df19291a3dd303fb

commit d002a3bee7ae75780b604d17df19291a3dd303fb
Author: Peter Boström <pbos@chromium.org>
Date:   Fri Nov 5 17:17:19 2021 +0000

    Remove DISALLOW_ macros from base/macros.h

    This removes DISALLOW_COPY(), DISALLOW_ASSIGN() and
    DISALLOW_COPY_AND_ASSIGN() from base/macros.h. PRESUBMITs are also
    updated to no longer check for these macros.

    IWYU removal is left as a separate change just in case this needs to be
    reverted.

    Bug: 1010217
2022-01-24 15:33:37 -05:00
mkarolin 50f7d5587b Task-related files moved from base/ to base/task/
Chromium change:

https://chromium.googlesource.com/chromium/src/+/39810e70da06baca176c0cdbc93164be1f980f59

commit 39810e70da06baca176c0cdbc93164be1f980f59
Author: Patrick Monette <pmonette@chromium.org>
Date:   Thu Oct 14 18:06:59 2021 +0000

    Reland "Move task-related files from base/ to base/task/"

    This is a reland of 092c30c5fd4def5a0c63d6f3a8953bd07768dd44

    The 2 problematic subrepos have been migrated and a couple late
    addition of the old headers were migrated.

    Original change's description:
    > Move task-related files from base/ to base/task/
    >
    > The forward headers are updated to point to the new location, and the
    > header guards were fixed.
    >
    > Bug: 1255932
2021-12-07 14:45:00 -05:00
mkarolin bbda8634b8 WebUI: remove @out_folder@ stripping.
It is no longer needed: when necessary resource_path can be used in the
grd.

Chromium change:

https://bugs.chromium.org/p/chromium/issues/detail?id=1171239

https://source.chromium.org/chromium/chromium/src/+/48b1ba996d2e019abad844fc47a5a1710b9da737

commit 48b1ba996d2e019abad844fc47a5a1710b9da737
Author: dpapad <dpapad@chromium.org>
Date:   Mon Feb 8 21:10:42 2021 +0000

    WebUI: Remove aliasing mechanism in SharedResourcesDataSource

    The last few entries in the alias map were either
     1) Unnecessary because the URLs were no longer used
        (views/resources/ case)
     2) Unnecessary because they could be replaced with |resource_path|
        (lottie case)
2021-03-23 14:55:27 -04:00
Mario Sanchez Prada 61a4a23f48 Migrate away from GritResourceMap and into webui::ResourcePath
Adapt Brave-specific code and overrides to use this equivalent struct.

Chromium change:
https://chromium.googlesource.com/chromium/src.git/+/a696151783d69bc6e8884246418d771d06cd9f53

commit a696151783d69bc6e8884246418d771d06cd9f53
Author: dpapad <dpapad@chromium.org>
Date:   Tue Feb 16 12:34:08 2021 +0000

    WebuI: Delete GritResourceMap struct in favor of webui::ResourcePath.

     - Move webui::ResourcePath definition to its own file in
       ui/base/webui/.
     - Modify Grit to use webui::ResourcePath, and delete the identical
       GritResourceMap struct.
     - Remove the AddResourcePathsBulk() override that used GritResourceMap.

    This is in preparation of moving AddResourcePathsBulk to WebUIDataSource
    itself.

    Bug: 1176299
2021-03-23 14:55:24 -04:00
bridiver fb3c0f5561 buildtools/checkdeps/checkdeps.py brave --extra-repos=brave runs succesfully 2021-02-06 13:34:00 -07:00
Pete Miller e90fa9feb2 NTP WebUI: take global fonts and css out of JS bundle
Already served from chrome://brave-resource/... which will benefit from async parsing and cross-page caching
2020-07-07 15:41:59 -07:00
mkarolin 764e2c8543 WebUI code moved to run on the UI thread.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/76ad70a295931ca8b0ff3613bd266b8fb34bc177

commit 76ad70a295931ca8b0ff3613bd266b8fb34bc177
Author: John Abd-El-Malek <jam@chromium.org>
Date:   Mon May 18 16:08:12 2020 +0000

    Reland "Move WebUI code to run on the UI thread."

    This reverts commit 8f6d95238903920fbc13d3bc805f095a0a4c8df2.

    Per analysis of all the waterfall bots that run this chrome_all_tast_tests, this doesn't affect the flakiness. Details in
    https://bugs.chromium.org/p/chromium/issues/detail?id=1082326#c51

    Original change's description:
    > Revert moving WebUI code to run on the UI thread as there are still PFQ flakes.
    >
    > Revert "Reland "Move WebUI code to run on the UI thread only.""
    >
    > This reverts commit 52fd322ec1451094dfd5b2a82cabbc47e3839e30.
    >
    > Revert "Reland "Remove InstantIOContext since it's not needed anymore.""
    >
    > This reverts commit 6360b9fdb0023228011e4e872ea2831760dd03c5.
    >
    > Revert "Add extra thread hops in WebUI code on ChromeOS to simulate old timing."
    >
    > This reverts commit dbb65740f2e7d349218ed3be4838a5a9c7ce2986.
    >
    > Bug: 1082326, 1062873
2020-07-01 18:12:02 -04:00
mkarolin 663f2fd034 Hookup Brave polymer v3 resources to the build.
Adds v3 GRDP with .m.js files.
Adds resources build dependency on modulize target.
Adds data source prefix alias to strip generated path.
2020-01-29 07:43:56 -05:00
mkarolin 8e40d033f1 UrlDataSource::IsGzipped has been removed.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/edfdcea2942f8569b535a9b85ed48dfa31942193

commit edfdcea2942f8569b535a9b85ed48dfa31942193
Author: Joel Hockey <joelhockey@chromium.org>
Date:   Thu Nov 7 21:54:44 2019 +0000

    Remove UrlDataSource::IsGzipped since it is not used

    Added in https://codereview.chromium.org/2149323003, but
    currently has no callers.
2020-01-29 07:42:50 -05:00
mkarolin 79b57daef7 URLDataSource::StartDataRequest signature changes.
Chromium changes:

https://chromium.googlesource.com/chromium/src/+/39f4ff30f2078b6e7301fdbbfc2c23b84fa0538d

commit 39f4ff30f2078b6e7301fdbbfc2c23b84fa0538d
Author: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Date:   Tue Oct 22 17:59:09 2019 +0000

    Pass GURL to URLDataSource::StartDataRequest()

    Bug: 991888

https://chromium.googlesource.com/chromium/src/+/f4b9e94bcc00bace773ea74d0801ba9a32beab8c

commit f4b9e94bcc00bace773ea74d0801ba9a32beab8c
Author: danakj <danakj@chromium.org>
Date:   Fri Nov 29 15:43:04 2019 +0000

    Convert Callback to {Once,Repeating}Callback in //content/browser.

    Use OnceCallback where possible, and use BindRepeating() where it is
    meant to be a RepeatingCallback.

    Majority of this change is a few typedefs that are very widely used:
    - LoadedCallback
    - ValidateTokenCallback
    - ValidateRegistrationCallback
    - GotDataCallback**

    ** Especially this one.

    Bug: 1007760
2020-01-29 07:42:50 -05:00
mkarolin e5adca5d21 Move ResourceRequestInfo::WebContentsGetter to WebContents::Getter
Chromium change:

https://chromium.googlesource.com/chromium/src/+/92bf36029638ae236920177e722650bed2a40e84

commit 92bf36029638ae236920177e722650bed2a40e84
Author: John Abd-El-Malek <jam@chromium.org>
Date:   Wed Jul 31 02:25:48 2019 +0000

    Move ResourceRequestInfo::WebContentsGetter to WebContents::Getter.

    This is in preparation of removing ResourceRequestInfo which isn't needed anymore.

    Bug: 934009
2019-10-09 21:50:27 -04:00
Max Karolinskiy 7d38f211bc Lint fixes. 2019-09-06 13:25:38 -04:00
Max Karolinskiy fde8fc5d9f content/public interfaces are no longer const.
Removed const from overrides.

Chromium change:

https://chromium.googlesource.com/chromium/src/+/4b4eed074e848347f5a5b07d4d4b3fd2f6e13820

commit 4b4eed074e848347f5a5b07d4d4b3fd2f6e13820
Author: Lucas Furukawa Gadani <lfg@chromium.org>
Date:   Tue Jun 4 23:12:04 2019 +0000

    Remove const interfaces from content/public.

    Tbr: boliu@chromium.org, dvadym@chromium.org, bengr@chromium.org
    Bug: 908139
2019-09-05 21:22:08 -04:00
Max Karolinskiy 7538d3c77d Lint fixes. 2019-07-10 16:38:33 -04:00
Max Karolinskiy 2cdbab6380 Minor cosmetic cleanup of brave_shared_resources_data_source.cc 2019-07-10 16:38:32 -04:00
Max Karolinskiy 442645426a No longer need gzipped resource map.
Chromium changes:

commit 516800beffb1c5dbe305cbd5291c1f2e5243c5a3
Author: dpapad <dpapad@chromium.org>
Date:   Mon May 6 22:38:48 2019 +0000

    Leverage DataPack::IsGzipped() from SharedResourcesDataSource.

    The data sources that serve chrome://resources URLs were previously
    relying on Grit's gzipped_resource_map_source output format. This is
    no longer necessary since DataPack::IsGzipped() is exposed via the
    content client API (or web client API on iOS).

    Also reverting various grd files to use a normal resource_map_source
    Grit output instead. The goal is to eventually
    remove gzipped_resource_map_source output completely, since it should not be
    necessary anymore (but there is more work needed to get there).

    Bug: 738243

commit bca1b9759444b4717c63bd2f02f10997a45530aa
Author: dpapad <dpapad@chromium.org>
Date:   Tue May 14 18:51:02 2019 +0000

    Grit: Remove gzipped_resource_* output formats.

    No longer used anywhere and not needed.

    Bug: 961063
2019-07-10 16:38:31 -04:00
Simon Hong 7fea7a5016 Delete modifying navigator.plugins and mimeTypes
So far, brave only exposes flash when it is available.
Brave will use pdfium as a pdf viewer instead of pdf.js.
That causes plugins and mimeTypes will include pdf things.
That means we expose all that brave have.
So, we don't need to blacklist except flash plugins.
2019-05-30 14:26:05 -07:00
petemill fe624a333f Serve common webui resources from chrome://brave-resources
Adds a new UrlDataSource: BraveSharedResourcesDataSource whose purpose is to:
- Serve shared fonts and css for use in brave and chromium webui
- Host modules for chromium polymer-based webui

Enable client-side caching for chrome://brave-resources since nothing from this domain is profile-specific at the moment
2019-02-21 13:05:31 -08:00
Simon Hong c0fa516e42 Fix build/link error comes from brave_plugin_registry_impl.o
To fix compile/link error, adding brave sources directly to content/browser source list is
most simple and cleaner way. If not, we need more number of patches
and can meet content/public/common dependency cycle.
2018-11-24 00:58:57 +09:00
Pranjal d039e8f1a2 Issue 1549: Return constant results for navigator.plugins and navigator.mimeTypes
auditors: @diracdeltas, @bridiver
2018-11-21 10:21:18 -08:00