OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Custom bindings for the app_window API. | 5 // Custom bindings for the app_window API. |
6 | 6 |
7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); | 7 var chromeHidden = requireNative('chrome_hidden').GetChromeHidden(); |
8 var sendRequest = require('sendRequest').sendRequest; | 8 var sendRequest = require('sendRequest').sendRequest; |
9 var appWindowNatives = requireNative('app_window'); | 9 var appWindowNatives = requireNative('app_window'); |
10 var GetView = appWindowNatives.GetView; | |
10 | 11 |
11 chromeHidden.registerCustomHook('appWindow', function() { | 12 chromeHidden.registerCustomHook('appWindow', function(bindingsAPI) { |
12 var internal_appWindow_create = chrome.appWindow.create; | 13 var apiFunctions = bindingsAPI.apiFunctions; |
13 chrome.appWindow.create = function(url, opts, cb) { | 14 apiFunctions.setCustomCallback('create', function (name, request, response) { |
14 internal_appWindow_create(url, opts, function(view_id) { | 15 var dom = null; |
15 var dom = appWindowNatives.GetView(view_id); | 16 if (response) |
16 cb(dom); | 17 dom = GetView(response); |
17 }); | 18 if (request.callback) |
18 }; | 19 request.callback(dom); |
20 request.callback = null; | |
not at google - send to devlin
2012/05/28 04:46:43
nits: no space in "function (", rename variable "r
jeremya
2012/05/28 06:49:01
Done. Why delete instead of = null?
not at google - send to devlin
2012/05/28 06:52:55
Personal preference, I think it's neater in this c
jeremya
2012/05/28 07:06:45
. o O ( I wonder if one is more or less optimal fo
not at google - send to devlin
2012/05/28 08:05:54
Probably not worth thinking about too much :)
| |
21 }) | |
19 }); | 22 }); |
OLD | NEW |