OLD | NEW |
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 /** | 5 /** |
6 * @fileoverview The recently closed menu: button, model data, and menu. | 6 * @fileoverview The recently closed menu: button, model data, and menu. |
7 */ | 7 */ |
8 | 8 |
9 cr.define('ntp', function() { | 9 cr.define('ntp', function() { |
10 'use strict'; | 10 'use strict'; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 var index = Array.prototype.indexOf.call(a.parentNode.children, a); | 94 var index = Array.prototype.indexOf.call(a.parentNode.children, a); |
95 var orig = e.originalEvent; | 95 var orig = e.originalEvent; |
96 var params = [data.sessionId, | 96 var params = [data.sessionId, |
97 index, | 97 index, |
98 orig.type == 'click' ? orig.button : 0, | 98 orig.type == 'click' ? orig.button : 0, |
99 orig.altKey, | 99 orig.altKey, |
100 orig.ctrlKey, | 100 orig.ctrlKey, |
101 orig.metaKey, | 101 orig.metaKey, |
102 orig.shiftKey]; | 102 orig.shiftKey]; |
103 chrome.send('reopenTab', params); | 103 chrome.send('reopenTab', params); |
104 | |
105 // We are likely deleted by this point! | |
106 e.stopPropagation(); | |
107 e.preventDefault(); | |
108 } | 104 } |
109 a.addEventListener('activate', onActivated); | 105 a.addEventListener('activate', onActivated); |
| 106 a.addEventListener('click', function(e) { e.preventDefault(); }); |
110 | 107 |
111 this.menu.appendChild(a); | 108 this.menu.appendChild(a); |
112 cr.ui.decorate(a, MenuItem); | 109 cr.ui.decorate(a, MenuItem); |
113 }, | 110 }, |
114 }; | 111 }; |
115 | 112 |
116 return { | 113 return { |
117 RecentMenuButton: RecentMenuButton, | 114 RecentMenuButton: RecentMenuButton, |
118 }; | 115 }; |
119 }); | 116 }); |
OLD | NEW |