-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Adding a protocol scheme to Brave
We currently have 3 different types of protocol handlers in Brave:
- External protocol handler used for handling magnet URLs
- External protocol handlers used for oauth flows (cryptocurrency exchanges at the time of writing)
-
brave://
being an alias forchrome://
Below is a description of changes and patching we've had to do for schemes:
-
AddAdditionalSchemes
is only used for addingbrave://
to the same list of URLs aschrome://
. Example -
GrantRequestScheme
- Allows a webui to access it so no reason for that. Example -
RegisterURLSchemeAsNotAllowingJavascriptURLs
- Registers an URL scheme to not allow manipulation of the loaded page by bookmarklets or javascript: URLs typed in the omnibox. Example -
RegisterURLSchemeAsDisplayIsolated
- Registers a URL scheme to be treated as display-isolated. This means that pages cannot display these URLs unless they are from the same scheme. For example, pages in another origin cannot create iframes or hyperlinks to URLs with the scheme. Example -
CanAddURLToHistory
- Prevents a URL from being added to history, note that redirects do not appear in history. So this is probably not needed for oauth related schemes. Example -
IsHandledProtocol
- Needed for protocol handlers, but not needed for external protocol handlers. Example -
ExtensionTabUtil::IsKillURL
- This is only needed becausebrave://
is an alias forchrome://
and an explicit check is made. Example