Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8441)

Unified Diff: chrome/renderer/resources/extensions/app_window_custom_bindings.js

Issue 10456003: Make 'options' and callback arg to chrome.appWindow.create optional. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/resources/extensions/app_window_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/app_window_custom_bindings.js b/chrome/renderer/resources/extensions/app_window_custom_bindings.js
index 85b0c482d310deb8adcc945d62d42358dcb5df34..d9b93469e00080f4e1ef8055f87eaa9c1245522b 100644
--- a/chrome/renderer/resources/extensions/app_window_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/app_window_custom_bindings.js
@@ -7,13 +7,16 @@
var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
var sendRequest = require('sendRequest').sendRequest;
var appWindowNatives = requireNative('app_window');
+var GetView = appWindowNatives.GetView;
-chromeHidden.registerCustomHook('appWindow', function() {
- var internal_appWindow_create = chrome.appWindow.create;
- chrome.appWindow.create = function(url, opts, cb) {
- internal_appWindow_create(url, opts, function(view_id) {
- var dom = appWindowNatives.GetView(view_id);
- cb(dom);
- });
- };
+chromeHidden.registerCustomHook('appWindow', function(bindingsAPI) {
+ var apiFunctions = bindingsAPI.apiFunctions;
+ apiFunctions.setCustomCallback('create', function (name, request, response) {
+ var dom = null;
+ if (response)
+ dom = GetView(response);
+ if (request.callback)
+ request.callback(dom);
+ 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 :)
+ })
});

Powered by Google App Engine
This is Rietveld 408576698