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 // |
11 // TODO(lazyboy): Share common code /w context_menus_custom_bindings.js. | 11 // TODO(lazyboy): Share common code /w context_menus_custom_bindings.js. |
12 | 12 |
13 var EventBindings = require('event_bindings'); | 13 var EventBindings = require('event_bindings'); |
14 var binding = require('binding').Binding.create('webViewInternal'); | 14 var binding = require('binding').Binding.create('chromeWebViewInternal'); |
15 var contextMenuNatives = requireNative('context_menus'); | 15 var contextMenuNatives = requireNative('context_menus'); |
16 var sendRequest = require('sendRequest').sendRequest; | 16 var sendRequest = require('sendRequest').sendRequest; |
17 | 17 |
18 binding.registerCustomHook(function(bindingsAPI) { | 18 binding.registerCustomHook(function(bindingsAPI) { |
19 var apiFunctions = bindingsAPI.apiFunctions; | 19 var apiFunctions = bindingsAPI.apiFunctions; |
20 | 20 |
21 var webviewContextMenus = {}; | 21 var webviewContextMenus = {}; |
22 webviewContextMenus.generatedIdHandlers = {}; | 22 webviewContextMenus.generatedIdHandlers = {}; |
23 webviewContextMenus.stringIdHandlers = {}; | 23 webviewContextMenus.stringIdHandlers = {}; |
24 | 24 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 if (chrome.runtime.lastError) { | 120 if (chrome.runtime.lastError) { |
121 return; | 121 return; |
122 } | 122 } |
123 var instanceId = request.args[0]; | 123 var instanceId = request.args[0]; |
124 webviewContextMenus.stringIdHandlers[instanceId] = {}; | 124 webviewContextMenus.stringIdHandlers[instanceId] = {}; |
125 webviewContextMenus.generatedIdHandlers[instanceId] = {}; | 125 webviewContextMenus.generatedIdHandlers[instanceId] = {}; |
126 }); | 126 }); |
127 | 127 |
128 }); | 128 }); |
129 | 129 |
130 exports.WebView = binding.generate(); | 130 exports.ChromeWebView = binding.generate(); |
OLD | NEW |