Index: ui/webui/resources/js/cr/ui/menu_button.js |
diff --git a/ui/webui/resources/js/cr/ui/menu_button.js b/ui/webui/resources/js/cr/ui/menu_button.js |
index e7f9804309c452f633e4dd7c203d809554584023..a688581afd53a201c6bb2e77a518411f9e46e7b3 100644 |
--- a/ui/webui/resources/js/cr/ui/menu_button.js |
+++ b/ui/webui/resources/js/cr/ui/menu_button.js |
@@ -181,9 +181,11 @@ cr.define('cr.ui', function() { |
this.menu.updateCommands(this); |
- var event = document.createEvent('UIEvents'); |
- event.initUIEvent('menushow', true, true, window, null); |
- |
+ var event = new UIEvent('menushow',{ |
+ bubbles: true, |
+ cancelable: true, |
+ view: window |
+ }); |
if (!this.dispatchEvent(event)) |
return; |
@@ -228,6 +230,13 @@ cr.define('cr.ui', function() { |
this.showingEvents_.removeAll(); |
this.focus(); |
+ var event = new UIEvent('menuhide', { |
+ bubbles: true, |
+ cancelable: false, |
+ view: window |
+ }); |
+ this.dispatchEvent(event); |
+ |
// On windows we might hide the menu in a right mouse button up and if |
// that is the case we wait some short period before we allow the menu |
// to be shown again. |