diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 97fbbd15803b..4f168c1cd03e 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -193,10 +193,20 @@ struct Converter { 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 { 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; } diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index 9bf9dd3ad741..938a54159759 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -44,9 +44,10 @@ class WebContents : public mate::TrackableObject, public content::WebContentsObserver { public: enum Type { + BACKGROUND_PAGE, // A DevTools extension background page. BROWSER_WINDOW, // Used by BrowserWindow. - WEB_VIEW, // Used by . REMOTE, // Thin wrap around an existing WebContents. + WEB_VIEW, // Used by . }; // For node.js callback function type: function(error, buffer) diff --git a/lib/browser/chrome-extension.js b/lib/browser/chrome-extension.js index bff436409b4a..78d6516c3f8a 100644 --- a/lib/browser/chrome-extension.js +++ b/lib/browser/chrome-extension.js @@ -73,6 +73,7 @@ const startBackgroundPages = function (manifest) { const html = new Buffer(`${scripts}`) const contents = webContents.create({ + type: 'backgroundPage', commandLineSwitches: ['--background-page'] }) backgroundPages[manifest.extensionId] = { html: html, webContents: contents }