OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 return result; | 190 return result; |
191 }, | 191 }, |
192 | 192 |
193 __proto__: WebInspector.ContextMenuItem.prototype | 193 __proto__: WebInspector.ContextMenuItem.prototype |
194 } | 194 } |
195 | 195 |
196 /** | 196 /** |
197 * @constructor | 197 * @constructor |
198 * @extends {WebInspector.ContextSubMenuItem} | 198 * @extends {WebInspector.ContextSubMenuItem} |
199 * @param {!Event} event | 199 * @param {!Event} event |
200 * @param {!Window=} opt_window | |
201 */ | 200 */ |
202 WebInspector.ContextMenu = function(event, opt_window) | 201 WebInspector.ContextMenu = function(event) |
203 { | 202 { |
204 WebInspector.ContextSubMenuItem.call(this, this, ""); | 203 WebInspector.ContextSubMenuItem.call(this, this, ""); |
205 /** @type {!Array.<!Promise.<!WebInspector.ContextMenu.Provider> >} */ | 204 /** @type {!Array.<!Promise.<!WebInspector.ContextMenu.Provider> >} */ |
206 this._pendingPromises = []; | 205 this._pendingPromises = []; |
207 /** @type {!Array.<!Promise.<!Object> >} */ | 206 /** @type {!Array.<!Promise.<!Object> >} */ |
208 this._pendingTargets = []; | 207 this._pendingTargets = []; |
209 this._event = event; | 208 this._event = event; |
210 this._x = event.x; | 209 this._x = event.x; |
211 this._y = event.y; | 210 this._y = event.y; |
212 this._handlers = {}; | 211 this._handlers = {}; |
213 this._id = 0; | 212 this._id = 0; |
214 this._window = opt_window || window; | |
215 } | 213 } |
216 | 214 |
217 WebInspector.ContextMenu.initialize = function() | 215 WebInspector.ContextMenu.initialize = function() |
218 { | 216 { |
219 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.SetUseSoftMenu, setUseSoftMenu); | 217 InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Event
s.SetUseSoftMenu, setUseSoftMenu); |
220 /** | 218 /** |
221 * @param {!WebInspector.Event} event | 219 * @param {!WebInspector.Event} event |
222 */ | 220 */ |
223 function setUseSoftMenu(event) | 221 function setUseSoftMenu(event) |
224 { | 222 { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 _innerShow: function() | 271 _innerShow: function() |
274 { | 272 { |
275 var menuObject = this._buildDescriptor(); | 273 var menuObject = this._buildDescriptor(); |
276 | 274 |
277 if (menuObject.length) { | 275 if (menuObject.length) { |
278 WebInspector._contextMenu = this; | 276 WebInspector._contextMenu = this; |
279 if (WebInspector.ContextMenu._useSoftMenu || InspectorFrontendHost.i
sHostedMode()) { | 277 if (WebInspector.ContextMenu._useSoftMenu || InspectorFrontendHost.i
sHostedMode()) { |
280 var softMenu = new WebInspector.SoftContextMenu(menuObject, this
._itemSelected.bind(this)); | 278 var softMenu = new WebInspector.SoftContextMenu(menuObject, this
._itemSelected.bind(this)); |
281 softMenu.show(this._x, this._y); | 279 softMenu.show(this._x, this._y); |
282 } else { | 280 } else { |
283 InspectorFrontendHost.showContextMenuAtPoint(this._x, this._y, m
enuObject, this._window); | 281 InspectorFrontendHost.showContextMenuAtPoint(this._x, this._y, m
enuObject); |
284 InspectorFrontendHost.events.addEventListener(InspectorFrontendH
ostAPI.Events.ContextMenuCleared, this._menuCleared, this); | 282 InspectorFrontendHost.events.addEventListener(InspectorFrontendH
ostAPI.Events.ContextMenuCleared, this._menuCleared, this); |
285 InspectorFrontendHost.events.addEventListener(InspectorFrontendH
ostAPI.Events.ContextMenuItemSelected, this._onItemSelected, this); | 283 InspectorFrontendHost.events.addEventListener(InspectorFrontendH
ostAPI.Events.ContextMenuItemSelected, this._onItemSelected, this); |
286 } | 284 } |
287 } | 285 } |
288 }, | 286 }, |
289 | 287 |
290 /** | 288 /** |
291 * @param {number} id | 289 * @param {number} id |
292 * @param {function(?)} handler | 290 * @param {function(?)} handler |
293 */ | 291 */ |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 } | 349 } |
352 | 350 |
353 WebInspector.ContextMenu.Provider.prototype = { | 351 WebInspector.ContextMenu.Provider.prototype = { |
354 /** | 352 /** |
355 * @param {!Event} event | 353 * @param {!Event} event |
356 * @param {!WebInspector.ContextMenu} contextMenu | 354 * @param {!WebInspector.ContextMenu} contextMenu |
357 * @param {!Object} target | 355 * @param {!Object} target |
358 */ | 356 */ |
359 appendApplicableItems: function(event, contextMenu, target) { } | 357 appendApplicableItems: function(event, contextMenu, target) { } |
360 } | 358 } |
OLD | NEW |