webview: fix partition attribute

This commit is contained in:
Robo 2015-08-06 20:31:05 +05:30
parent c65ccb6857
commit d180d3b168
7 changed files with 74 additions and 13 deletions

View file

@ -159,16 +159,20 @@ WebContents::WebContents(const mate::Dictionary& options) {
type_ = is_guest ? WEB_VIEW : BROWSER_WINDOW;
auto browser_context = AtomBrowserMainParts::Get()->browser_context();
content::WebContents* web_contents;
if (is_guest) {
content::SiteInstance* site_instance = content::SiteInstance::CreateForURL(
browser_context, GURL("chrome-guest://fake-host"));
GURL guest_site;
options.Get("partition", &guest_site);
auto 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);
guest_delegate_.reset(new WebViewGuestDelegate);
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);
}

View file

@ -43,7 +43,8 @@ struct Converter<atom::WebViewManager::WebViewInfo> {
return options.Get("nodeIntegration", &(out->node_integration)) &&
options.Get("plugins", &(out->plugins)) &&
options.Get("disableWebSecurity", &(out->disable_web_security));
options.Get("disableWebSecurity", &(out->disable_web_security)) &&
options.Get("partitionId", &(out->partition_id));
}
};