OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <webview> contextMenus API. | 5 // Custom binding for <webview> contextMenus API. |
6 // Note that this file mimics custom bindings for chrome.contextMenus API | 6 // Note that this file mimics custom bindings for chrome.contextMenus API |
7 // which resides in context_menus_custom_bindings.js. The functions in this file | 7 // which resides in context_menus_custom_bindings.js. The functions in this file |
8 // have an extra instanceId parameter in the beginning, which corresponds to the | 8 // have an extra instanceId parameter in the beginning, which corresponds to the |
9 // id of the <webview>. | 9 // id of the <webview>. |
10 // | 10 // |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 }); | 92 }); |
93 | 93 |
94 apiFunctions.setCustomCallback('contextMenusUpdate', | 94 apiFunctions.setCustomCallback('contextMenusUpdate', |
95 function(name, request, response) { | 95 function(name, request, response) { |
96 if (chrome.runtime.lastError) { | 96 if (chrome.runtime.lastError) { |
97 return; | 97 return; |
98 } | 98 } |
99 var instanceId = request.args[0]; | 99 var instanceId = request.args[0]; |
100 var id = request.args[1]; | 100 var id = request.args[1]; |
101 if (request.args[2].onclick) { | 101 if (request.args[2].onclick) { |
102 contextMenus.handlersForId(instanceId, id)[id] = request.args[2].onclick; | 102 webviewContextMenus.handlersForId(instanceId, id)[id] = |
| 103 request.args[2].onclick; |
103 } | 104 } |
104 }); | 105 }); |
105 | 106 |
106 apiFunctions.setCustomCallback('contextMenusRemove', | 107 apiFunctions.setCustomCallback('contextMenusRemove', |
107 function(name, request, response) { | 108 function(name, request, response) { |
108 if (chrome.runtime.lastError) { | 109 if (chrome.runtime.lastError) { |
109 return; | 110 return; |
110 } | 111 } |
111 var instanceId = request.args[0]; | 112 var instanceId = request.args[0]; |
112 var id = request.args[1]; | 113 var id = request.args[1]; |
113 delete webviewContextMenus.handlersForId(instanceId, id)[id]; | 114 delete webviewContextMenus.handlersForId(instanceId, id)[id]; |
114 }); | 115 }); |
115 | 116 |
116 apiFunctions.setCustomCallback('contextMenusRemoveAll', | 117 apiFunctions.setCustomCallback('contextMenusRemoveAll', |
117 function(name, request, response) { | 118 function(name, request, response) { |
118 if (chrome.runtime.lastError) { | 119 if (chrome.runtime.lastError) { |
119 return; | 120 return; |
120 } | 121 } |
121 var instanceId = request.args[0]; | 122 var instanceId = request.args[0]; |
122 webviewContextMenus.stringIdHandlers[instanceId] = {}; | 123 webviewContextMenus.stringIdHandlers[instanceId] = {}; |
123 webviewContextMenus.generatedIdHandlers[instanceId] = {}; | 124 webviewContextMenus.generatedIdHandlers[instanceId] = {}; |
124 }); | 125 }); |
125 | 126 |
126 }); | 127 }); |
127 | 128 |
128 exports.WebView = binding.generate(); | 129 exports.WebView = binding.generate(); |
OLD | NEW |