Add background page web contents type

This commit is contained in:
Kevin Sawicki 2016-06-14 09:27:36 -07:00
parent ee0bab6389
commit f29801ad2b
3 changed files with 19 additions and 5 deletions

View file

@ -193,10 +193,20 @@ struct Converter<atom::api::WebContents::Type> {
atom::api::WebContents::Type val) {
std::string type = "";
switch (val) {
case atom::api::WebContents::Type::BROWSER_WINDOW: type = "window"; break;
case atom::api::WebContents::Type::WEB_VIEW: type = "webview"; break;
case atom::api::WebContents::Type::REMOTE: type = "remote"; break;
default: break;
case atom::api::WebContents::Type::BACKGROUND_PAGE:
type = "backgroundPage";
break;
case atom::api::WebContents::Type::BROWSER_WINDOW:
type = "window";
break;
case atom::api::WebContents::Type::REMOTE:
type = "remote";
break;
case atom::api::WebContents::Type::WEB_VIEW:
type = "webview";
break;
default:
break;
}
return mate::ConvertToV8(isolate, type);
}
@ -208,6 +218,8 @@ struct Converter<atom::api::WebContents::Type> {
return false;
if (type == "webview") {
*out = atom::api::WebContents::Type::WEB_VIEW;
} else if (type == "backgroundPage") {
*out = atom::api::WebContents::Type::BACKGROUND_PAGE;
} else {
return false;
}