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

Side by Side 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: fix Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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, view_id) {
Mihai Parparita -not on Chrome 2012/05/29 06:14:42 Nit: view_id should be called viewId per the JS st
14 internal_appWindow_create(url, opts, function(view_id) { 15 var view = null;
15 var dom = appWindowNatives.GetView(view_id); 16 if (view_id)
16 cb(dom); 17 view = GetView(view_id);
17 }); 18 if (request.callback) {
Mihai Parparita -not on Chrome 2012/05/29 06:14:42 Nit: This can become an early return at the start
18 }; 19 request.callback(view);
20 delete request.callback;
21 }
22 })
19 }); 23 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698