Add support for chrome extensions

Issue #1947 wontfix
Marshall Greenblatt created an issue

Chrome supports an extension system [1] which generally functions as follows:

  1. Load a pre-packaged .crx file (zip archive) that contains the extension source code.
  2. Run the extension in an isolated JavaScript context.
  3. Expose chrome.* JavaScript APIs [2] that the extension can use to perform actions, show UI and interact with other browser content.

CEF will add support for Chrome extensions as a multi-step process:

  1. Add support for loading and running existing chrome extensions (note: they will not work until the required JavaScript APIs have been implemented).
  2. Incrementally implement JavaScript APIs over time.

The first round of implementation will include:

  • Extension - The chrome.extension API has utilities that can be used by any extension page. It includes support for exchanging messages between an extension and its content scripts or between extensions, as described in detail in Message Passing.
  • Runtime - Use the chrome.runtime API to retrieve the background page, return details about the manifest, and listen for and respond to events in the app or extension lifecycle. You can also use this API to convert the relative path of URLs to fully-qualified URLs.
  • Storage - Use the API to store, retrieve, and track changes to user data.
  • Tabs - Use the chrome.tabs API to interact with the browser's tab system. You can use this API to create, modify, and rearrange tabs in the browser. (For CEF this will operate on browser windows instead of "tabs".)
  • Web Navigation - Use the chrome.webNavigation API to receive notifications about the status of navigation requests in-flight.
  • Web Request - Use the chrome.webRequest API to observe and analyze traffic and to intercept, block, or modify requests in-flight.
  • Windows - Use the API to interact with browser windows. You can use this API to create, modify, and rearrange windows in the browser. (For CEF this will operate on browser windows instead of "tabs".)

Other APIs under consideration for early implementation include:

  • Browser Action - Use browser actions to put icons in the main Google Chrome toolbar, to the right of the address bar. In addition to its icon, a browser action can also have a tooltip, a badge, and a popup.
  • Context Menus - Use the chrome.contextMenus API to add items to Google Chrome's context menu. You can choose what types of objects your context menu additions apply to, such as images, hyperlinks, and pages.
  • DevTools - A DevTools extension adds functionality to the Chrome DevTools. It can add new UI panels and sidebars, interact with the inspected page, get information about network requests, and more.
  • I18n - Use the chrome.i18n infrastructure to implement internationalization across your whole app or extension.

Any APIs that require user interface components, such as Browser Action, will be implemented as new CEF APIs that the client application will be responsible for implementing.

This is expected to be a long term project.



Comments (44)

  1. Czarek Tomczak

    You might consider mocking some of the APIs that are non-essential, but which would stop the extension from working. For example when Browser Action is implemented, you could mock the Page Action API which is related and many extensions that use Browser Action may use Page Action as well. Page Action API is not essential for an extension, it would still work fine if the API was mocked.

    The Cookies API seem to be important to be implemented in early stages. This API was available since early Chrome v5 and we know that all websites use cookies.

    If there was a way to gather statistics about Chrome Extensions to get know which APIs are most commonly used and implement them first, so that CEF supports greatest number of extensions with the least amount of work. Maybe some scraper that downloads all Chrome extensions, unpacks the crx (zip) files and analyzes the source code.

  2. Eivind Arvesen

    Both Vivaldi and Opera is built on Chromium and supports Chrome-extensions. Thus, they must have implemented the API.

    Both Vivaldi and Opera make their source code available (though Vivaldi does not include code for the GUI).

    Would it be possible to reach out to them or to use some of their code?

    Edit: It seems Opera uses an adaptor to install extensions.

  3. Marshall Greenblatt reporter

    The Chromium code base has multiple layers. CEF currently uses the Content API layer. Chrome, Vivaldi and Opera use the chrome/ layer which sits on top of the Content API later. Extension support is implemented in the chrome/ layer. Consequently it's not a question of missing code but instead an architectural issue that needs to be resolved. We want to do this selectively to avoid exposing untested code paths in CEF.

  4. Marshall Greenblatt reporter

    Unfork streamsPrivate API and add resourcesPrivate and tabs zoom APIs required by the PDF extension in master revision 5732a8d.

  5. Marshall Greenblatt reporter

    No estimate of when the extension support possible?

    No estimates are available at this time.

  6. Marshall Greenblatt reporter

    The process for adding extension support is documented at

    For example, compare the tabs API implementation in Chrome and CEF. The Chrome implementation of GetTabById uses the Browser and TabStripModel objects that do not exist in CEF. This code can be converted to the CEF equivalent that uses CefBrowserHostImpl.

    Similar conversions will be required when implementing other extension APIs.

  7. Marshall Greenblatt reporter

    Master revision 9cff99d adds support for loading extensions.

    • Add CefRequestContext::LoadExtension, CefExtension, CefExtensionHandler and related methods/interfaces.
    • Add chrome://extensions-support that lists supported Chrome APIs.
    • Add CefBrowserHost::SetAutoResizeEnabled and CefDisplayHandler::OnAutoResize to support browser resize based on preferred web contents size.
    • views: Add support for custom CefMenuButton popups.
    • cefclient: Run with --load-extension=set_page_color command-line flag for an extension loading example. Add --use-views on Windows and Linux for an even better example.
  8. Marshall Greenblatt reporter

    Support for Chrome Alarms Extension API added in master revision dddfce4. This is a good example of how to enable support for APIs implemented at the /extensions layer (versus the /chrome layer).

  9. Andrew Warnick

    How much trouble would it be to merge this into the Chrome 61 branch? We have a customer who desperately needs to run an extension.

  10. Marshall Greenblatt reporter

    Support for Chrome Storage Extension API ( and added in master revision d8a602e and 3202 branch revision ff8b4aa.

  11. Marshall Greenblatt reporter

    @AWarnick-ADSI 61 is currently stable so it will only receive bug fixes. The extension changes will be available in 62 and later.

  12. fengxingren

    out\Debug_GN_x86\cefclient.exe crashed when launched with "--single-process --load-extension=set_page_color". would it be possible to support extensions in single process mode? thanks.

  13. fengxingren

    @magreenblatt Thanks for your reply. As I understand it, the extension process is like the devtool process, and the latter can be supported in single-process mode. So How much trouble would it be to support it? Or is it just technically not feasible? I want to use the React Developer Tools extension within CEF3 in single-process mode. It would be appreciated if you could give me some suggestions about how to implement the extension support of single-process mode.

  14. Marshall Greenblatt reporter

    To support the React Developer Tools extension (v2.5.1) we need to add:

    • chrome.browserAction
      • setIcon
      • setPopup
    • chrome.devtools
      • inspectedWindow.eval
      • inspectedWindow.tabId
      • panels.create
      • network.onNavigated.addListener
      • network.onNavigated.removeListener
      • panels.themeName
    • chrome.runtime
      • getURL
      • connect
      • onConnect.addListener
      • onMessage.addListener
      • sendMessage
  15. Andrew Warnick

    I noticed this message in the client app: "Cannot mix --load-extension and --request-context-per-browser"

    We use different request contexts in most browsers. I assume that's going to be a problem. Are you able to explain why, and is there a possibility of a work-around?

  16. Marshall Greenblatt reporter

    @AWarnick-ADSI Extensions need to be registered in each RequestContext separately. The restriction in cefclient is just to simplify the sample application implementation.

  17. vinnyq12

    Hi, is there somewhere I can view the status of extension support? What is and isn't supported yet etc. Thanks.

  18. Marshall Greenblatt reporter

    @vinnyq12 Load chrome://extensions-support in CEF to see the list of supported Chrome APIs.

  19. Kevin Flabbergasted

    Hi, is there any news for: chrome.runtime * getURL * connect * onConnect.addListener * onMessage.addListener * sendMessage

    Or will I need to implement?

  20. Alexander Guettler

    @arturchudzik I still plan on working on this, there were just a few things that came up which are a bit more important in my opinion, also wanted to submit some of the other things I had floating around in my custom cef version before doing new things, then there is this Viz change that kind of blew up a bit and required quite some time. I am getting closer to have my current backlog clear to pursue new things though and this was the first thing that I wanted to start with next.

  21. Marcus Paulo

    Hello, anyone have an example to install chrome extensions in CEF? I’m using CEFSharp, if anyone have a C# example…


  22. James Bright

    How to load “Windows 10 Accounts“ chrome extension in CEF?

    This extension allows Microsoft users to connect via Azure and Microsoft websites

  23. Jorge R Lima

    I need exactly the same thing as James Bright.

    “How to load “Windows 10 Accounts“ chrome extension in CEF?”

    It seems that the “runtime” api is not yet supported, is this true?

    “chrome://extensions-support” is not showing that API.

  24. Marshall Greenblatt reporter

    We will most likely not be supporting additional extension APIs with the current (Alloy) runtime. Extensions will be fully supported with the Chrome runtime. See issue #2969.

  25. Marshall Greenblatt reporter

    We will not be supporting additional Chrome extension APIs with the current (Alloy) runtime beyond what is required by the PDF viewer extension. See issue #3048 which takes this a step further by proposing complete removal of this functionality from the Alloy runtime in the future.

  26. Jason Mah

    Hi, I am new to CefSharp project and have limited knowledge on extensions.

    Appreciate if you can advise if it is possible to enable Aspera Connect extension (which is supported by Chrome browser) on CefSharp browser control?

    Thank you.


    Jason Mah

  27. Kevin Dyer


    Does the extension mechanism support Manifest V3? If yes, what rulesets are supported? I have an extension that I would like to use that replaces the /favicon.ico requests with a redirections to an image bundled within the extension to prevent ZTNA from denying access and this uses a redirect in the ruleset to perform the function.


    Kevin Dyer

  28. Log in to comment