summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 16:40:31 +0000
committerarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-07 16:40:31 +0000
commit9997409a1d70d0f44936ce49227520406b543c6d (patch)
treeea1345e30cc61c223c7c5f231f2074fe0f6fee08
parentee43144e80ffecfa97e4226628483e66536eba48 (diff)
downloadchromium_src-9997409a1d70d0f44936ce49227520406b543c6d.zip
chromium_src-9997409a1d70d0f44936ce49227520406b543c6d.tar.gz
chromium_src-9997409a1d70d0f44936ce49227520406b543c6d.tar.bz2
NTP: Add a workaround for the case where we reopen a window and a tooltip is
shown in the background window. BUG=23967 TEST=Open two windows with at least two tabs. Open one more window and go to the NTP. Close the first two windows. Now click on the first link in the Recently closed section. This reopens a window. Now move the mouse so you can see the NTP again. There should be no tooltip for the Recently closed item Review URL: http://codereview.chromium.org/263002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28261 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/new_new_tab.js30
1 files changed, 15 insertions, 15 deletions
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js
index add6213..7bf6a61 100644
--- a/chrome/browser/resources/new_new_tab.js
+++ b/chrome/browser/resources/new_new_tab.js
@@ -1149,16 +1149,6 @@ function handleIfEnterKey(f) {
};
}
-function maybeOpenFile(e) {
- var el = findAncestor(e.target, function(el) {
- return el.fileId !== undefined;
- });
- if (el) {
- chrome.send('openFile', [String(el.fileId)]);
- e.preventDefault();
- }
-}
-
function maybeReopenTab(e) {
var el = findAncestor(e.target, function(el) {
return el.sessionId !== undefined;
@@ -1166,6 +1156,13 @@ function maybeReopenTab(e) {
if (el) {
chrome.send('reopenTab', [String(el.sessionId)]);
e.preventDefault();
+
+ // HACK(arv): After the window onblur event happens we get a mouseover event
+ // on the next item and we want to make sure that we do not show a tooltip
+ // for that.
+ window.setTimeout(function() {
+ windowTooltip.hide();
+ }, 2 * WindowTooltip.DELAY);
}
}
@@ -1182,9 +1179,6 @@ function maybeShowWindowTooltip(e) {
var recentlyClosedElement = $('recently-closed');
-recentlyClosedElement.addEventListener('click', maybeOpenFile);
-recentlyClosedElement.addEventListener('keydown',
- handleIfEnterKey(maybeOpenFile));
recentlyClosedElement.addEventListener('click', maybeReopenTab);
recentlyClosedElement.addEventListener('keydown',
@@ -1211,6 +1205,12 @@ WindowTooltip.trackMouseMove_ = function(e) {
WindowTooltip.clientY = e.clientY;
};
+/**
+ * Time in ms to delay before the tooltip is shown.
+ * @type {number}
+ */
+WindowTooltip.DELAY = 300;
+
WindowTooltip.prototype = {
timer: 0,
handleMouseOver: function(e, linkEl, tabs) {
@@ -1222,13 +1222,13 @@ WindowTooltip.prototype = {
this.linkEl_.addEventListener('blur', this.boundHide_);
}
this.timer = window.setTimeout(bind(this.show, this, e.type, linkEl, tabs),
- 300);
+ WindowTooltip.DELAY);
},
show: function(type, linkEl, tabs) {
window.addEventListener('blur', this.boundHide_);
this.linkEl_.removeEventListener('mousemove',
WindowTooltip.trackMouseMove_);
- clearTimeout(this.timer);
+ window.clearTimeout(this.timer);
this.renderItems(tabs);
var rect = linkEl.getBoundingClientRect();