Skip to content

Commit e7c2a27

Browse files
authored
Update MultiProfile.md
1 parent 6c53f26 commit e7c2a27

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

specs/MultiProfile.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ API spec for multiple profile support
44
# Background
55

66
Previously, all WebView2s can only use one fixed Edge profile in the browser process, which is
7-
normally the **Default** profile by not specifying a profile path, or the profile specified by the **--profile-directory** command
8-
line switch. It means different WebView2s share a single profile directory on disk for data storage,
9-
which might bring security concerns over cookies, autofill data, and password management etc.. Also,
10-
they might also interfere with each other in terms of user preference settings.
7+
normally the **Default** profile by not specifying a profile path, or the profile specified by the
8+
**--profile-directory** command line switch. It means different WebView2s share a single profile
9+
directory on disk for data storage, which might bring security concerns over cookies, autofill data,
10+
and password management etc.. Also, they might also interfere with each other in terms of user
11+
preference settings.
1112

1213
Although you can make your WebView2s use different user data directories to achieve data separation,
1314
in such way you'll have to be running multiple browser instances (each including a browser process
@@ -36,7 +37,7 @@ HRESULT AppWindow::CreateControllerWithOptions()
3637
return S_OK;
3738
}
3839

39-
Microsoft::WRL::ComPtr<ICoreWebView2ControllerOptions> options;
40+
wil::com_ptr<ICoreWebView2ControllerOptions> options;
4041
HRESULT hr = webViewEnvironment4->CreateCoreWebView2ControllerOptions(
4142
m_webviewOption.profile.c_str(), m_webviewOption.isInPrivate, options.GetAddressOf());
4243
if (hr == E_INVALIDARG)
@@ -47,11 +48,7 @@ HRESULT AppWindow::CreateControllerWithOptions()
4748
}
4849
CHECK_FAILURE(hr);
4950

50-
#ifdef USE_WEBVIEW2_WIN10
5151
if (m_dcompDevice || m_wincompCompositor)
52-
#else
53-
if (m_dcompDevice)
54-
#endif
5552
{
5653
CHECK_FAILURE(webViewEnvironment4->CreateCoreWebView2CompositionControllerWithOptions(
5754
m_mainWindow, options.Get(),
@@ -126,13 +123,13 @@ CoreWebView2Environment _webViewEnvironment;
126123
public CreateWebView2ControllerWithOptions(IntPtr parentWindow, string profileName, bool isInPrivate)
127124
{
128125
CoreWebView2ControllerOptions options = _webViewEnvironment.CreateCoreWebView2ControllerOptions(profileName, isInPrivate);
129-
CoreWebView2Controller webView2Controller = await _webViewEnvironment.CreateCoreWebView2ControllerWithOptionsAsync(parentHWND, options);
126+
CoreWebView2Controller webView2Controller = await _webViewEnvironment.CreateCoreWebView2ControllerWithOptionsAsync(parentWindow, options);
130127
string profilePath = webView2Controller.CoreWebView2.Profile.ProfilePath;
131-
string profileDirName = profilePath.Substring(profilePath.LastIndexOf('\\') + 1);
128+
string profileDirName = Path.GetFileName(profilePath);
132129
bool inPrivate = webView2Controller.CoreWebView2.Profile.IsInPrivateModeEnabled;
133130
134131
// update window title with profileDirName
135-
UpdateAppTitle();
132+
UpdateAppTitle(profileDirName);
136133
137134
// update window icon
138135
SetAppIcon(inPrivate);

0 commit comments

Comments
 (0)