| 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 bindings for the contextMenus API. | 5 // Custom bindings for the contextMenus API. |
| 6 | 6 |
| 7 var contextMenus = requireNative('context_menus'); | 7 var contextMenus = requireNative('context_menus'); |
| 8 var GetNextContextMenuId = contextMenus.GetNextContextMenuId; | 8 var GetNextContextMenuId = contextMenus.GetNextContextMenuId; |
| 9 var sendRequest = require('sendRequest').sendRequest; | 9 var sendRequest = require('sendRequest').sendRequest; |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 if (onclick) { | 41 if (onclick) { |
| 42 onclick.apply(null, arguments); | 42 onclick.apply(null, arguments); |
| 43 } | 43 } |
| 44 }); | 44 }); |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 apiFunctions.setHandleRequest('create', function() { | 47 apiFunctions.setHandleRequest('create', function() { |
| 48 var args = arguments; | 48 var args = arguments; |
| 49 var id = GetNextContextMenuId(); | 49 var id = GetNextContextMenuId(); |
| 50 args[0].generatedId = id; | 50 args[0].generatedId = id; |
| 51 sendRequest(this.name, | 51 var optArgs = { |
| 52 args, | 52 customCallback: this.customCallback, |
| 53 this.definition.parameters, | 53 }; |
| 54 {customCallback: this.customCallback}); | 54 sendRequest(this.name, args, this.definition.parameters, optArgs); |
| 55 return chromeHidden.contextMenus.getIdFromCreateProperties(args[0]); | 55 return chromeHidden.contextMenus.getIdFromCreateProperties(args[0]); |
| 56 }); | 56 }); |
| 57 | 57 |
| 58 apiFunctions.setCustomCallback('create', function(name, request, response) { | 58 apiFunctions.setCustomCallback('create', function(name, request, response) { |
| 59 if (chrome.runtime.lastError) { | 59 if (chrome.runtime.lastError) { |
| 60 return; | 60 return; |
| 61 } | 61 } |
| 62 | 62 |
| 63 var id = chromeHidden.contextMenus.getIdFromCreateProperties( | 63 var id = chromeHidden.contextMenus.getIdFromCreateProperties( |
| 64 request.args[0]); | 64 request.args[0]); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 91 | 91 |
| 92 apiFunctions.setCustomCallback('removeAll', | 92 apiFunctions.setCustomCallback('removeAll', |
| 93 function(name, request, response) { | 93 function(name, request, response) { |
| 94 if (chrome.runtime.lastError) { | 94 if (chrome.runtime.lastError) { |
| 95 return; | 95 return; |
| 96 } | 96 } |
| 97 chromeHidden.contextMenus.generatedIdHandlers = {}; | 97 chromeHidden.contextMenus.generatedIdHandlers = {}; |
| 98 chromeHidden.contextMenus.stringIdHandlers = {}; | 98 chromeHidden.contextMenus.stringIdHandlers = {}; |
| 99 }); | 99 }); |
| 100 }); | 100 }); |
| OLD | NEW |