| 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 windows API. | |
| 6 | |
| 7 (function() { | |
| 8 | |
| 9 native function GetChromeHidden(); | |
| 10 | |
| 11 GetChromeHidden().registerCustomHook('windows', function(api) { | |
| 12 var apiFunctions = api.apiFunctions; | |
| 13 | |
| 14 apiFunctions.setUpdateArgumentsPreValidate('get', function() { | |
| 15 // Old signature: | |
| 16 // get(int windowId, function callback); | |
| 17 // New signature: | |
| 18 // get(int windowId, object populate, function callback); | |
| 19 if (arguments.length == 2 && typeof(arguments[1]) == 'function') { | |
| 20 // If the old signature is used, add a null populate object. | |
| 21 newArgs = [arguments[0], null, arguments[1]]; | |
| 22 } else { | |
| 23 newArgs = arguments; | |
| 24 } | |
| 25 return newArgs; | |
| 26 }); | |
| 27 | |
| 28 apiFunctions.setUpdateArgumentsPreValidate('getCurrent', function() { | |
| 29 // Old signature: | |
| 30 // getCurrent(function callback); | |
| 31 // New signature: | |
| 32 // getCurrent(object populate, function callback); | |
| 33 if (arguments.length == 1 && typeof(arguments[0]) == 'function') { | |
| 34 // If the old signature is used, add a null populate object. | |
| 35 newArgs = [null, arguments[0]]; | |
| 36 } else { | |
| 37 newArgs = arguments; | |
| 38 } | |
| 39 return newArgs; | |
| 40 }); | |
| 41 | |
| 42 apiFunctions.setUpdateArgumentsPreValidate('getLastFocused', function() { | |
| 43 // Old signature: | |
| 44 // getLastFocused(function callback); | |
| 45 // New signature: | |
| 46 // getLastFocused(object populate, function callback); | |
| 47 if (arguments.length == 1 && typeof(arguments[0]) == 'function') { | |
| 48 // If the old signature is used, add a null populate object. | |
| 49 newArgs = [null, arguments[0]]; | |
| 50 } else { | |
| 51 newArgs = arguments; | |
| 52 } | |
| 53 return newArgs; | |
| 54 }); | |
| 55 | |
| 56 apiFunctions.setUpdateArgumentsPreValidate('getAll', function() { | |
| 57 // Old signature: | |
| 58 // getAll(function callback); | |
| 59 // New signature: | |
| 60 // getAll(object populate, function callback); | |
| 61 if (arguments.length == 1 && typeof(arguments[0]) == 'function') { | |
| 62 // If the old signature is used, add a null populate object. | |
| 63 newArgs = [null, arguments[0]]; | |
| 64 } else { | |
| 65 newArgs = arguments; | |
| 66 } | |
| 67 return newArgs; | |
| 68 }); | |
| 69 }); | |
| 70 | |
| 71 })(); | |
| OLD | NEW |