Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: extensions/renderer/resources/context_menus_handlers.js

Issue 1914643003: [Extensions] Update last_error.js, send_request.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // Implementation of custom bindings for the contextMenus API. 5 // Implementation of custom bindings for the contextMenus API.
6 // This is used to implement the contextMenus API for extensions and for the 6 // This is used to implement the contextMenus API for extensions and for the
7 // <webview> tag (see chrome_web_view_experimental.js). 7 // <webview> tag (see chrome_web_view_experimental.js).
8 8
9 var contextMenuNatives = requireNative('context_menus'); 9 var contextMenuNatives = requireNative('context_menus');
10 var sendRequest = require('sendRequest').sendRequest; 10 var sendRequest = require('sendRequest').sendRequest;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 var id = info.menuItemId; 82 var id = info.menuItemId;
83 var onclick = contextMenus.handlersForId(instanceId, id)[id]; 83 var onclick = contextMenus.handlersForId(instanceId, id)[id];
84 if (onclick) { 84 if (onclick) {
85 $Function.apply(onclick, null, arguments); 85 $Function.apply(onclick, null, arguments);
86 } 86 }
87 }); 87 });
88 }; 88 };
89 89
90 // To be used with apiFunctions.setHandleRequest 90 // To be used with apiFunctions.setHandleRequest
91 var requestHandlers = {}; 91 var requestHandlers = { __proto__: null };
92 // To be used with apiFunctions.setCustomCallback 92 // To be used with apiFunctions.setCustomCallback
93 var callbacks = {}; 93 var callbacks = { __proto__: null };
94 94
95 requestHandlers.create = function() { 95 requestHandlers.create = function() {
96 var createProperties = isWebview ? arguments[1] : arguments[0]; 96 var createProperties = isWebview ? arguments[1] : arguments[0];
97 createProperties.generatedId = contextMenuNatives.GetNextContextMenuId(); 97 createProperties.generatedId = contextMenuNatives.GetNextContextMenuId();
98 var optArgs = { 98 var optArgs = {
99 __proto__: null,
99 customCallback: this.customCallback, 100 customCallback: this.customCallback,
100 }; 101 };
101 sendRequest(this.name, arguments, this.definition.parameters, optArgs); 102 sendRequest(this.name, arguments, this.definition.parameters, optArgs);
102 return contextMenus.getIdFromCreateProperties(createProperties); 103 return contextMenus.getIdFromCreateProperties(createProperties);
103 }; 104 };
104 105
105 callbacks.create = 106 callbacks.create =
106 createCustomCallback(function(instanceId, createProperties) { 107 createCustomCallback(function(instanceId, createProperties) {
107 var id = contextMenus.getIdFromCreateProperties(createProperties); 108 var id = contextMenus.getIdFromCreateProperties(createProperties);
108 var onclick = createProperties.onclick; 109 var onclick = createProperties.onclick;
(...skipping 23 matching lines...) Expand all
132 delete contextMenus.handlers[instanceId]; 133 delete contextMenus.handlers[instanceId];
133 }); 134 });
134 135
135 return { 136 return {
136 requestHandlers: requestHandlers, 137 requestHandlers: requestHandlers,
137 callbacks: callbacks 138 callbacks: callbacks
138 }; 139 };
139 } 140 }
140 141
141 exports.$set('create', createContextMenusHandlers); 142 exports.$set('create', createContextMenusHandlers);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698