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

Side by Side Diff: ui/webui/resources/js/cr/ui/context_menu_handler.js

Issue 2786793002: Roll closure compiler (Closed)
Patch Set: Rerun with java 1.7 Created 3 years, 8 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 (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 // require: event_target.js 5 // require: event_target.js
6 6
7 cr.define('cr.ui', function() { 7 cr.define('cr.ui', function() {
8 /** @const */ var EventTarget = cr.EventTarget; 8 /** @const */ var EventTarget = cr.EventTarget;
9 /** @const */ var Menu = cr.ui.Menu; 9 /** @const */ var Menu = cr.ui.Menu;
10 10
11 /** 11 /**
12 * Handles context menus. 12 * Handles context menus.
13 * @constructor 13 * @constructor
14 * @extends {cr.EventTarget} 14 * @extends {cr.EventTarget}
15 * @implements {EventListener} 15 * @implements {EventListener}
16 */ 16 */
17 function ContextMenuHandler() { 17 function ContextMenuHandler() {
18 /** @private {!EventTracker} */
18 this.showingEvents_ = new EventTracker(); 19 this.showingEvents_ = new EventTracker();
19 } 20 }
20 21
21 ContextMenuHandler.prototype = { 22 ContextMenuHandler.prototype = {
22 __proto__: EventTarget.prototype, 23 __proto__: EventTarget.prototype,
23 24
24 /** 25 /**
25 * The menu that we are currently showing. 26 * The menu that we are currently showing.
26 * @type {cr.ui.Menu} 27 * @type {cr.ui.Menu}
27 */ 28 */
(...skipping 13 matching lines...) Expand all
41 if (!menu.hasVisibleItems()) 42 if (!menu.hasVisibleItems())
42 return; 43 return;
43 44
44 this.menu_ = menu; 45 this.menu_ = menu;
45 menu.classList.remove('hide-delayed'); 46 menu.classList.remove('hide-delayed');
46 menu.show({x: e.screenX, y: e.screenY}); 47 menu.show({x: e.screenX, y: e.screenY});
47 menu.contextElement = e.currentTarget; 48 menu.contextElement = e.currentTarget;
48 49
49 // When the menu is shown we steal a lot of events. 50 // When the menu is shown we steal a lot of events.
50 var doc = menu.ownerDocument; 51 var doc = menu.ownerDocument;
51 var win = doc.defaultView; 52 var win = /** @type {!Window} */ (doc.defaultView);
52 this.showingEvents_.add(doc, 'keydown', this, true); 53 this.showingEvents_.add(doc, 'keydown', this, true);
53 this.showingEvents_.add(doc, 'mousedown', this, true); 54 this.showingEvents_.add(doc, 'mousedown', this, true);
54 this.showingEvents_.add(doc, 'touchstart', this, true); 55 this.showingEvents_.add(doc, 'touchstart', this, true);
55 this.showingEvents_.add(doc, 'focus', this); 56 this.showingEvents_.add(doc, 'focus', this);
56 this.showingEvents_.add(win, 'popstate', this); 57 this.showingEvents_.add(win, 'popstate', this);
57 this.showingEvents_.add(win, 'resize', this); 58 this.showingEvents_.add(win, 'resize', this);
58 this.showingEvents_.add(win, 'blur', this); 59 this.showingEvents_.add(win, 'blur', this);
59 this.showingEvents_.add(menu, 'contextmenu', this); 60 this.showingEvents_.add(menu, 'contextmenu', this);
60 this.showingEvents_.add(menu, 'activate', this); 61 this.showingEvents_.add(menu, 'activate', this);
61 this.positionMenu_(e, menu); 62 this.positionMenu_(e, menu);
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 * The singleton context menu handler. 284 * The singleton context menu handler.
284 * @type {!ContextMenuHandler} 285 * @type {!ContextMenuHandler}
285 */ 286 */
286 var contextMenuHandler = new ContextMenuHandler; 287 var contextMenuHandler = new ContextMenuHandler;
287 288
288 // Export 289 // Export
289 return { 290 return {
290 contextMenuHandler: contextMenuHandler, 291 contextMenuHandler: contextMenuHandler,
291 }; 292 };
292 }); 293 });
OLDNEW
« no previous file with comments | « third_party/closure_compiler/externs/chrome_extensions.js ('k') | ui/webui/resources/js/cr/ui/tree.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698