interface ICoreWebView2ExperimentalProfile12

Note

This reference is no longer being maintained. For the latest API reference, see WebView2 API Reference.

Note

This an experimental API that is shipped with our prerelease SDK. See WebView2 release notes.

interface ICoreWebView2ExperimentalProfile12
  : public IUnknown

This is the ICoreWebView2 experimental profile interface that manages browser extensions.

Summary

Members Descriptions
AddBrowserExtension Adds the browser extension using the extension path for unpacked extensions from the local device.
GetBrowserExtensions Gets a snapshot of the set of extensions installed at the time GetBrowserExtensions is called.

Applies to

Product Introduced
WebView2 Win32 N/A
WebView2 Win32 Prerelease 1.0.1988

Members

AddBrowserExtension

Adds the browser extension using the extension path for unpacked extensions from the local device.

public HRESULT AddBrowserExtension(LPCWSTR extensionFolderPath, ICoreWebView2ExperimentalProfileAddBrowserExtensionCompletedHandler * handler)

Extension is running right after installation. The extension folder path is the topmost folder of an unpacked browser extension and contains the browser extension manifest file. If the extensionFolderPath is an invalid path or doesn't contain the extension manifest.json file, this function will return ERROR_FILE_NOT_FOUND to callers. Installed extension will default IsEnabled to true. When AreBrowserExtensionsEnabled is FALSE, AddBrowserExtension will fail and return HRESULT ERROR_NOT_SUPPORTED. During installation, the content of the extension is not copied to the user data folder. Once the extension is installed, changing the content of the extension will cause the extension to be removed from the installed profile. When an extension is added the extension is persisted in the corresponding profile. The extension will still be installed the next time you use this profile. When an extension is installed from a folder path, adding the same extension from the same folder path means reinstalleing this extension. When two extensions with the same Id are installed, only the later installed extension will be kept.

The following summarizes the possible error values that can be returned from AddBrowserExtension and a description of why these errors occur.

Error value Description
HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED) Extensions are disabled.
HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) Cannot find manifest.json file or it is not a valid extension manifest.
E_ACCESSDENIED Cannot load extension with file or directory name starting with "_", reserved for use by the system.
E_FAIL Extension failed to install with other unknown reasons.

GetBrowserExtensions

Gets a snapshot of the set of extensions installed at the time GetBrowserExtensions is called.

public HRESULT GetBrowserExtensions(ICoreWebView2ExperimentalProfileGetBrowserExtensionsCompletedHandler * handler)

If an extension is installed or uninstalled after GetBrowserExtensions completes, the list returned by GetBrowserExtensions remains the same. When AreBrowserExtensionsEnabled is FALSE, GetBrowserExtensions won't return any extensions on current user profile.