Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Implements chrome.windows.create #295

Merged
merged 5 commits into from
Oct 15, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion atom/common/api/resources/windows_bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,16 @@ binding.registerCustomHook(function (bindingsAPI, extensionId) {
})

apiFunctions.setHandleRequest('create', function (createData, cb) {
console.warn('chrome.windows.create is not supported yet')
var responseId = ++id
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should be using ipc.guid() here. The integer ids can be duplicated across windows. Please update other uses in this file as well.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you have time please also update browser_action_bindings.js in a separate PR

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like also context_menu_bindings.js

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed 3a9b420

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure will do

cb && ipc.once('chrome-windows-create-response-' + responseId, function (evt, win, error) {
if (error) {
lastError.run('windows.create', error, '', cb)
} else {
cb(win)
}
})

ipc.send('chrome-windows-create', responseId, createData)
})

apiFunctions.setHandleRequest('getCurrent', function () {
Expand Down
4 changes: 4 additions & 0 deletions lib/browser/api/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,10 @@ var windowInfo = function (win, populateTabs) {
}
}

ipcMain.on('chrome-windows-create', function (evt, responseId, createData) {
process.emit('chrome-windows-create-action', responseId, createData, evt)
})

ipcMain.on('chrome-windows-get-current', function (evt, responseId, getInfo) {
var response = {
id: -1,
Expand Down