| 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 binding for the experimental offscreenTabs API. | 5 // Custom binding for the experimental offscreenTabs API. |
| 6 | 6 |
| 7 var binding = require('binding').Binding.create('experimental.offscreenTabs'); | 7 var binding = require('binding').Binding.create('experimental.offscreenTabs'); |
| 8 | 8 |
| 9 binding.registerCustomHook( | 9 binding.registerCustomHook( |
| 10 'experimental.offscreenTabs', function(api) { | 10 'experimental.offscreenTabs', function(api) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 button: e.button, | 38 button: e.button, |
| 39 }; | 39 }; |
| 40 maybeCopy(e, 'wheelDeltaX', result); | 40 maybeCopy(e, 'wheelDeltaX', result); |
| 41 maybeCopy(e, 'wheelDeltaY', result); | 41 maybeCopy(e, 'wheelDeltaY', result); |
| 42 return result; | 42 return result; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 // We are making a copy of |arr|, but applying |func| to index 1. | 45 // We are making a copy of |arr|, but applying |func| to index 1. |
| 46 function validate(arr, func) { | 46 function validate(arr, func) { |
| 47 var newArr = []; | 47 var newArr = []; |
| 48 for (var i = 0; i < arr.length; i++) | 48 for (var i = 0; i < arr.length; i++) { |
| 49 newArr.push(i == 1 && typeof(arr) == 'object' ? func(arr[i]) : arr[i]); | 49 $Array.push(newArr, |
| 50 i == 1 && typeof(arr) == 'object' ? func(arr[i]) : arr[i]); |
| 51 } |
| 50 return newArr; | 52 return newArr; |
| 51 } | 53 } |
| 52 | 54 |
| 53 apiFunctions.setUpdateArgumentsPreValidate( | 55 apiFunctions.setUpdateArgumentsPreValidate( |
| 54 'sendKeyboardEvent', | 56 'sendKeyboardEvent', |
| 55 function() { return validate(arguments, keyboardEventFilter); }); | 57 function() { return validate(arguments, keyboardEventFilter); }); |
| 56 apiFunctions.setUpdateArgumentsPreValidate( | 58 apiFunctions.setUpdateArgumentsPreValidate( |
| 57 'sendMouseEvent', | 59 'sendMouseEvent', |
| 58 function() { return validate(arguments, mouseEventFilter); }); | 60 function() { return validate(arguments, mouseEventFilter); }); |
| 59 }); | 61 }); |
| 60 | 62 |
| 61 exports.binding = binding.generate(); | 63 exports.binding = binding.generate(); |
| OLD | NEW |