use embedders' browser context when partition is not specified
This commit is contained in:
parent
150b540e72
commit
da5bac42f3
3 changed files with 13 additions and 7 deletions
|
@ -159,12 +159,17 @@ WebContents::WebContents(const mate::Dictionary& options) {
|
|||
|
||||
type_ = is_guest ? WEB_VIEW : BROWSER_WINDOW;
|
||||
|
||||
content::BrowserContext* browser_context =
|
||||
AtomBrowserMainParts::Get()->browser_context();
|
||||
content::WebContents* web_contents;
|
||||
if (is_guest) {
|
||||
GURL guest_site;
|
||||
options.Get("partition", &guest_site);
|
||||
auto browser_context =
|
||||
AtomBrowserMainParts::Get()->GetBrowserContextForPartition(guest_site);
|
||||
// use hosts' browser_context when no partition is specified.
|
||||
if (!guest_site.query().empty()) {
|
||||
browser_context = AtomBrowserMainParts::Get()
|
||||
->GetBrowserContextForPartition(guest_site);
|
||||
}
|
||||
auto site_instance =
|
||||
content::SiteInstance::CreateForURL(browser_context, guest_site);
|
||||
content::WebContents::CreateParams params(browser_context, site_instance);
|
||||
|
@ -172,7 +177,6 @@ WebContents::WebContents(const mate::Dictionary& options) {
|
|||
params.guest_delegate = guest_delegate_.get();
|
||||
web_contents = content::WebContents::Create(params);
|
||||
} else {
|
||||
auto browser_context = AtomBrowserMainParts::Get()->browser_context();
|
||||
content::WebContents::CreateParams params(browser_context);
|
||||
web_contents = content::WebContents::Create(params);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue