Skip to content

Commit

Permalink
Add openOptionsPage binding
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdh committed Oct 28, 2016
1 parent 9b2f304 commit e1368f3
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 0 deletions.
2 changes: 2 additions & 0 deletions atom/atom_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
<include name="IDR_ATOM_WINDOWS_BINDINGS_JS" file="common\api\resources\windows_bindings.js" type="BINDATA" />

<include name="IDR_ATOM_APP_BINDINGS_JS" file="common\api\resources\app_bindings.js" type="BINDATA" />

<include name="IDR_ATOM_RUNTIME_EXTRA_BINDINGS_JS" file="common\api\resources\runtime_extra_bindings.js" type="BINDATA" />
</includes>
</release>
</grit>
4 changes: 4 additions & 0 deletions atom/common/api/resources/_api_features.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
"channel": "stable",
"contexts": ["blessed_extension"]
},
"runtimeExtra": {
"channel": "stable",
"contexts": ["blessed_extension"]
},
"windows": {
"channel": "stable",
"contexts": ["blessed_extension"]
Expand Down
11 changes: 11 additions & 0 deletions atom/common/api/resources/context_menus_bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,14 @@ var binding = {
}

exports.binding = binding;

// TODO (Anthony): Move this to separated binding
var runtime = require('runtime').binding
var tabs = require('tabs').binding

runtime.openOptionsPage = function (cb) {
let manifest = runtime.getManifest()
let optionsPageURL = runtime.getURL(manifest.options_page)
tabs.create({url: optionsPageURL})
cb && cb()
}
9 changes: 9 additions & 0 deletions atom/common/api/resources/runtime_extra_bindings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var runtime = require('runtime').binding
var tabs = require('tabs').binding

runtime.openOptionsPage = function (cb) {
let manifest = runtime.getManifest()
let optionsPageURL = runtime.getURL(manifest.options_page)
tabs.create({url: optionsPageURL})
cb && cb()
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ void AtomExtensionsDispatcherDelegate::PopulateSourceMap(
IDR_ATOM_WINDOWS_BINDINGS_JS);
source_map->RegisterSource("app",
IDR_ATOM_APP_BINDINGS_JS);

source_map->RegisterSource("runtimeExtra",
IDR_ATOM_RUNTIME_EXTRA_BINDINGS_JS);
}

void AtomExtensionsDispatcherDelegate::RequireAdditionalModules(
Expand Down
2 changes: 2 additions & 0 deletions extensions.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
'atom/common/api/resources/ipc_bindings.js',
'atom/common/api/resources/ipc_utils.js',
'atom/common/api/resources/privacy_bindings.js',
'atom/common/api/resources/runtime_extra_bindings.js',
'atom/common/api/resources/tabs_bindings.js',
'atom/common/api/resources/web_frame.json',
'atom/common/api/resources/web_frame_bindings.js',
Expand All @@ -68,6 +69,7 @@
'atom/common/api/resources/ipc_bindings.js',
'atom/common/api/resources/ipc_utils.js',
'atom/common/api/resources/privacy_bindings.js',
'atom/common/api/resources/runtime_extra_bindings.js',
'atom/common/api/resources/tabs_bindings.js',
'atom/common/api/resources/web_frame.json',
'atom/common/api/resources/web_frame_bindings.js',
Expand Down

0 comments on commit e1368f3

Please sign in to comment.