| 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("windows.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("windows.getCurrent", | |
| 29 function() { | |
| 30 // Old signature: | |
| 31 // getCurrent(function callback); | |
| 32 // New signature: | |
| 33 // getCurrent(object populate, function callback); | |
| 34 if (arguments.length == 1 && typeof(arguments[0]) == "function") { | |
| 35 // If the old signature is used, add a null populate object. | |
| 36 newArgs = [null, arguments[0]]; | |
| 37 } else { | |
| 38 newArgs = arguments; | |
| 39 } | |
| 40 return newArgs; | |
| 41 }); | |
| 42 | |
| 43 apiFunctions.setUpdateArgumentsPreValidate("windows.getLastFocused", | |
| 44 function() { | |
| 45 // Old signature: | |
| 46 // getLastFocused(function callback); | |
| 47 // New signature: | |
| 48 // getLastFocused(object populate, function callback); | |
| 49 if (arguments.length == 1 && typeof(arguments[0]) == "function") { | |
| 50 // If the old signature is used, add a null populate object. | |
| 51 newArgs = [null, arguments[0]]; | |
| 52 } else { | |
| 53 newArgs = arguments; | |
| 54 } | |
| 55 return newArgs; | |
| 56 }); | |
| 57 | |
| 58 apiFunctions.setUpdateArgumentsPreValidate("windows.getAll", function() { | |
| 59 // Old signature: | |
| 60 // getAll(function callback); | |
| 61 // New signature: | |
| 62 // getAll(object populate, function callback); | |
| 63 if (arguments.length == 1 && typeof(arguments[0]) == "function") { | |
| 64 // If the old signature is used, add a null populate object. | |
| 65 newArgs = [null, arguments[0]]; | |
| 66 } else { | |
| 67 newArgs = arguments; | |
| 68 } | |
| 69 return newArgs; | |
| 70 }); | |
| 71 }); | |
| 72 | |
| 73 })(); | |
| OLD | NEW |