Partager via


interface ICoreWebView2ControllerOptions

interface ICoreWebView2ControllerOptions
  : public IUnknown

This interface is used to manage profile options that created by 'CreateCoreWebView2ControllerOptions'.

Summary

Members Descriptions
get_IsInPrivateModeEnabled IsInPrivateModeEnabled property is to enable/disable InPrivate mode.
get_ProfileName ProfileName property is to specify a profile name, which is only allowed to contain the following ASCII characters.
put_IsInPrivateModeEnabled Sets the IsInPrivateModeEnabled property.
put_ProfileName Sets the ProfileName property.
    auto webViewEnvironment10 = m_webViewEnvironment.try_query<ICoreWebView2Environment10>();
    if (!webViewEnvironment10)
    {
        FeatureNotAvailable();
        return S_OK;
    }

    wil::com_ptr<ICoreWebView2ControllerOptions> options;
    // The validation of parameters occurs when setting the properties.
    HRESULT hr = webViewEnvironment10->CreateCoreWebView2ControllerOptions(&options);
    if (hr == E_INVALIDARG)
    {
        ShowFailure(hr, L"Unable to create WebView2 due to an invalid profile name.");
        CloseAppWindow();
        return S_OK;
    }
    CHECK_FAILURE(hr);

Applies to

Product Introduced
WebView2 Win32 1.0.1210.39
WebView2 Win32 Prerelease 1.0.1222

Members

get_IsInPrivateModeEnabled

IsInPrivateModeEnabled property is to enable/disable InPrivate mode.

public HRESULT get_IsInPrivateModeEnabled(BOOL * value)

get_ProfileName

ProfileName property is to specify a profile name, which is only allowed to contain the following ASCII characters.

public HRESULT get_ProfileName(LPWSTR * value)

It has a maximum length of 64 characters excluding the null-terminator. It is ASCII case insensitive.

  • alphabet characters: a-z and A-Z

  • digit characters: 0-9

  • and '#', '@', '$', '(', ')', '+', '-', '_', '~', '.', ' ' (space).

Note: the text must not end with a period '.' or ' ' (space). And, although upper-case letters are allowed, they're treated just as lower-case counterparts because the profile name will be mapped to the real profile directory path on disk and Windows file system handles path names in a case-insensitive way.

The caller must free the returned string with CoTaskMemFree. See API Conventions.

put_IsInPrivateModeEnabled

Sets the IsInPrivateModeEnabled property.

public HRESULT put_IsInPrivateModeEnabled(BOOL value)

put_ProfileName

Sets the ProfileName property.

public HRESULT put_ProfileName(LPCWSTR value)