How Brave Implements Chrome Extension Compatibility: A Technical Deep Dive
Brave achieves seamless Chrome extension compatibility by inheriting Chromium's untouched extension framework while injecting a thin compatibility layer for URL mapping, Brave-specific APIs, and privacy policy enforcement.
Brave Browser is built on the Chromium codebase, which provides native support for the Chrome extension ecosystem. This architectural foundation allows Brave to maintain full Chrome extension compatibility while implementing Brave-specific privacy features through strategic overrides in the brave-core repository.
Inheriting Chromium's Extension Architecture
Core Extension Services
Brave utilizes Chromium's native extension infrastructure without modification. The ExtensionService handles loading, updating, and unloading extensions through the same code paths used by Google Chrome. In chrome/browser/extensions/extension_service.cc, the ExtensionService::AddExtension method validates manifests and registers extensions with the ExtensionRegistry, which tracks installed extension states in chrome/browser/extensions/extension_registry.cc.
Extension System Initialization
The entry point ExtensionSystemImpl::CreateExtensionService in chrome/browser/extensions/extension_system_impl.cc wires the extension service into the browser process during startup. This ensures that all standard Chrome extension APIs are registered before any extensions load.
The Brave Compatibility Layer
URL Mapping and API Extensions
Brave implements a compatibility layer that maps Chrome-style URLs (chrome://) to Brave equivalents (brave://). This layer also exposes Brave-only APIs such as chrome.braveWallet and chrome.ipfs while maintaining standard Chrome API availability. The Brave Wallet API implementation in chrome/browser/extensions/api/brave_wallet/brave_wallet_api.cc demonstrates this pattern:
// chrome/browser/extensions/api/brave_wallet/brave_wallet_api.cc
#include "chrome/common/extensions/api/brave_wallet.h"
namespace extensions {
class BraveWalletGetBalanceFunction : public ExtensionFunction {
public:
BraveWalletGetBalanceFunction() = default;
// Called from JS: chrome.braveWallet.getBalance(...)
ResponseAction Run() override {
// Perform Brave‑specific logic, then reply to the caller.
std::string balance = GetBalanceFromWallet();
return RespondNow(ArgumentList(
api::brave_wallet::GetBalance::Results::Create(balance)));
}
};
} // namespace extensions
Privacy Policy Enforcement
Brave enforces privacy policies through extension-policy hooks that filter network requests. The ExtensionNavigationThrottle inspects every outgoing request from extensions, applying Brave's Shields blocklists and IPFS permission rules. In extensions/common/permissions/permissions_data.cc, the ExtensionPermissionsData class implements additional permission checks that respect Brave's privacy settings while maintaining Chrome extension compatibility.
Chrome Extension Import Mechanism
Brave provides a seamless migration path for users switching from Chrome. The ExtensionImporter class in chrome/browser/extensions/extension_importer.cc reads Chrome's extension manifests, resources, and storage (IndexedDB, local storage) and copies them into Brave's profile format:
// chrome/browser/extensions/extension_importer.cc
bool ExtensionImporter::ImportChromeExtension(const base::FilePath& chrome_profile,
const std::string& extension_id) {
// 1. Read Chrome’s extension manifest from the source profile.
// 2. Copy the extension directory to Brave’s profile under
// "Extensions/<extension_id>".
// 3. Import IndexedDB and Local Storage if present.
// 4. Register the extension with ExtensionService.
return extension_service_->AddExtension(
extension_path, mojom::ManifestLocation::kExternalPref);
}
This import logic supports both Manifest V2 and V3 extensions and preserves existing extension data, ensuring Chrome extension compatibility during migration.
Key Implementation Files
The following files in the brave-core repository define Brave's extension compatibility layer:
chrome/browser/extensions/extension_service.cc– Core loading/unloading with Brave-specific feature flagschrome/browser/extensions/extension_registry.cc– Extension state trackingchrome/browser/extensions/extension_system_impl.cc– Browser process integrationextensions/common/permissions/permissions_data.cc– Permission checks with Brave privacy ruleschrome/browser/extensions/api/brave_wallet/brave_wallet_api.cc– Brave-specific API implementationchrome/browser/extensions/extension_importer.cc– Chrome-to-Brave extension migrationchrome/browser/extensions/api/ipfs/ipfs_api.cc– IPFS API exposurechrome/browser/ui/webui/extensions/extension_settings_ui.cc– Extension management UI
Summary
- Brave maintains Chrome extension compatibility by building directly on Chromium's unchanged extension framework, including
ExtensionService,ExtensionRegistry, andExtensionSystemImpl. - A thin compatibility layer maps
chrome://URLs tobrave://equivalents and injects Brave-specific APIs likechrome.braveWalletandchrome.ipfs. - Privacy enforcement occurs through
ExtensionNavigationThrottleandExtensionPermissionsData, which apply Brave Shields and IPFS rules to extension network requests. - The
ExtensionImporterclass enables seamless migration from Chrome by reading Chrome's extension storage formats and copying them to Brave's profile directory. - All extension-related code resides in the brave-core repository under
chrome/browser/extensions/, which brave-browser pulls in as a sub-project.
Frequently Asked Questions
Can I install Chrome extensions directly in Brave?
Yes. Because Brave implements full Chrome extension compatibility through Chromium's native framework, you can install extensions directly from the Chrome Web Store or load unpacked extensions. Brave's ExtensionService in chrome/browser/extensions/extension_service.cc handles the same manifest validation and loading logic as Chrome, supporting both Manifest V2 and V3 extensions.
How does Brave handle extension permissions differently from Chrome?
Brave extends Chromium's permission system through ExtensionPermissionsData in extensions/common/permissions/permissions_data.cc. While standard Chrome permissions are granted as requested, Brave applies additional privacy filters. For example, the ExtensionNavigationThrottle checks every network request from extensions against Brave's Shields blocklists, potentially blocking requests that Chrome would allow, ensuring extensions respect Brave's privacy-first policies.
What happens to my Chrome extension data when I import to Brave?
The ExtensionImporter class in chrome/browser/extensions/extension_importer.cc preserves your data by reading Chrome's proprietary storage formats, including IndexedDB, Local Storage, and the Preferences file. It copies these into Brave's profile directory under Extensions/<extension_id>/, ensuring that both Manifest V2 and V3 extensions retain their settings and stored data after migration, maintaining seamless Chrome extension compatibility.
Does Brave support Manifest V3 extensions?
Yes. Brave's extension framework in chrome/browser/extensions/ supports both Manifest V2 and V3 extensions because it inherits Chromium's complete extension system. The ExtensionService validates manifests according to the version specified in the extension's manifest.json, and Brave-specific policies in ExtensionPermissionsData apply regardless of manifest version, ensuring consistent Chrome extension compatibility across extension formats.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →