OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Custom bindings for the runtime API. | |
6 | |
7 var extensionNatives = requireNative('extension'); | |
8 var GetExtensionViews = extensionNatives.GetExtensionViews; | |
9 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | |
10 var sendRequest = require('sendRequest').sendRequest; | |
11 | |
12 chromeHidden.registerCustomHook('experimental.runtime', function(bindingsAPI) { | |
13 var apiFunctions = bindingsAPI.apiFunctions; | |
14 | |
15 apiFunctions.setCustomCallback('getBackgroundPage', | |
16 function(name, request, response) { | |
17 if (request.callback) { | |
18 var bg = GetExtensionViews(-1, 'BACKGROUND')[0] || null; | |
19 request.callback(bg); | |
20 } | |
21 request.callback = null; | |
22 }); | |
23 }); | |
OLD | NEW |