From efada88f419933c5bd1478faada3b4eff3082103 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Tue, 17 Mar 2015 09:18:52 +0000 Subject: Activate vomnibar in window.top; refocus original frame. --- background_scripts/main.coffee | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'background_scripts') diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index fe6cc70b..f031eeaf 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -658,6 +658,15 @@ handleFrameFocused = (request, sender) -> frameIdsForTab[tabId] = [request.frameId, (frameIdsForTab[tabId].filter (id) -> id != request.frameId)...] +# Send a message to a frame (in the sender's tab). The sender should set: +# - request.targetFrameId (the target frame) +# - request.name (the name of the handler in the target frame, e.g. "focusFrame") +# In addition, request.senderFrameId will be set to the frameId of the sender. +sendMessageToFrame = (request, sender) -> + request.senderFrameId = request.frameId + request.frameId = request.targetFrameId + chrome.tabs.sendMessage sender.tab.id, request + # Port handler mapping portHandlers = keyDown: handleKeyDown, @@ -685,6 +694,7 @@ sendRequestHandlers = createMark: Marks.create.bind(Marks) gotoMark: Marks.goto.bind(Marks) setBadge: setBadge + sendMessageToFrame: sendMessageToFrame # We always remove chrome.storage.local/findModeRawQueryListIncognito on startup. chrome.storage.local.remove "findModeRawQueryListIncognito" -- cgit v1.2.3 From aa8d00fd9779d4061431dbdcb7a70b9c39e8049a Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Tue, 17 Mar 2015 09:47:46 +0000 Subject: Activate vomnibar in window.top; simplify messaging. --- background_scripts/main.coffee | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'background_scripts') diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index f031eeaf..b8c015d7 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -658,14 +658,9 @@ handleFrameFocused = (request, sender) -> frameIdsForTab[tabId] = [request.frameId, (frameIdsForTab[tabId].filter (id) -> id != request.frameId)...] -# Send a message to a frame (in the sender's tab). The sender should set: -# - request.targetFrameId (the target frame) -# - request.name (the name of the handler in the target frame, e.g. "focusFrame") -# In addition, request.senderFrameId will be set to the frameId of the sender. -sendMessageToFrame = (request, sender) -> - request.senderFrameId = request.frameId - request.frameId = request.targetFrameId - chrome.tabs.sendMessage sender.tab.id, request +# Send a message to a all frames in the current tab. +sendMessageToFrames = (request, sender) -> + chrome.tabs.sendMessage sender.tab.id, request.message # Port handler mapping portHandlers = @@ -694,7 +689,7 @@ sendRequestHandlers = createMark: Marks.create.bind(Marks) gotoMark: Marks.goto.bind(Marks) setBadge: setBadge - sendMessageToFrame: sendMessageToFrame + sendMessageToFrames: sendMessageToFrames # We always remove chrome.storage.local/findModeRawQueryListIncognito on startup. chrome.storage.local.remove "findModeRawQueryListIncognito" -- cgit v1.2.3 From 9461d30b0d19fd65dc43e18bebec1fe0fd3ee818 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Tue, 17 Mar 2015 10:32:40 +0000 Subject: Activate vomnibar in window.top; hide on focus. --- background_scripts/main.coffee | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'background_scripts') diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index b8c015d7..0b19ce4a 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -657,6 +657,10 @@ handleFrameFocused = (request, sender) -> if frameIdsForTab[tabId]? frameIdsForTab[tabId] = [request.frameId, (frameIdsForTab[tabId].filter (id) -> id != request.frameId)...] + # Inform all frames that a frame has received the focus. + chrome.tabs.sendMessage sender.tab.id, + name: "frameFocused" + frameId: request.frameId # Send a message to a all frames in the current tab. sendMessageToFrames = (request, sender) -> -- cgit v1.2.3 From 8bc811aae1118e28faa7c17e67b039c67f637274 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Tue, 17 Mar 2015 11:42:58 +0000 Subject: Activate vomnibar in window.top; hide on focus, fixed. --- background_scripts/main.coffee | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'background_scripts') diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 0b19ce4a..07e89e08 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -666,6 +666,10 @@ handleFrameFocused = (request, sender) -> sendMessageToFrames = (request, sender) -> chrome.tabs.sendMessage sender.tab.id, request.message +# For debugging only. This allows content scripts to log messages to the background page's console. +bgLog = (request, sender) -> + console.log "#{sender.tab.id}/#{request.frameId}", request.message + # Port handler mapping portHandlers = keyDown: handleKeyDown, @@ -694,6 +698,7 @@ sendRequestHandlers = gotoMark: Marks.goto.bind(Marks) setBadge: setBadge sendMessageToFrames: sendMessageToFrames + log: bgLog # We always remove chrome.storage.local/findModeRawQueryListIncognito on startup. chrome.storage.local.remove "findModeRawQueryListIncognito" -- cgit v1.2.3 From 4399e2e4fffc4faba9f1505dfc0ad3150a948632 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Tue, 17 Mar 2015 12:06:15 +0000 Subject: Activate vomnibar in window.top; more clean up. --- background_scripts/main.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'background_scripts') diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 07e89e08..a64c7e37 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -660,9 +660,9 @@ handleFrameFocused = (request, sender) -> # Inform all frames that a frame has received the focus. chrome.tabs.sendMessage sender.tab.id, name: "frameFocused" - frameId: request.frameId + focusFrameId: request.frameId -# Send a message to a all frames in the current tab. +# Send a message to all frames in the current tab. sendMessageToFrames = (request, sender) -> chrome.tabs.sendMessage sender.tab.id, request.message -- cgit v1.2.3 From 71d33fdeaa5c081de5041a6a0909d452e1564633 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Tue, 17 Mar 2015 13:21:02 +0000 Subject: Activate vomnibar in window.top; fix race condition on close. --- background_scripts/main.coffee | 1 + 1 file changed, 1 insertion(+) (limited to 'background_scripts') diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index a64c7e37..05fad941 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -657,6 +657,7 @@ handleFrameFocused = (request, sender) -> if frameIdsForTab[tabId]? frameIdsForTab[tabId] = [request.frameId, (frameIdsForTab[tabId].filter (id) -> id != request.frameId)...] + console.log frameIdsForTab[tabId] # Inform all frames that a frame has received the focus. chrome.tabs.sendMessage sender.tab.id, name: "frameFocused" -- cgit v1.2.3 From b65f285aa65b2cfbdaefb4d7c445dbd5e684fbbf Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Tue, 17 Mar 2015 14:29:12 +0000 Subject: Activate vomnibar in window.top; more clean up. Clean up, and fixes following code review from @mrmr1993. --- background_scripts/main.coffee | 1 - 1 file changed, 1 deletion(-) (limited to 'background_scripts') diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index 05fad941..a64c7e37 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -657,7 +657,6 @@ handleFrameFocused = (request, sender) -> if frameIdsForTab[tabId]? frameIdsForTab[tabId] = [request.frameId, (frameIdsForTab[tabId].filter (id) -> id != request.frameId)...] - console.log frameIdsForTab[tabId] # Inform all frames that a frame has received the focus. chrome.tabs.sendMessage sender.tab.id, name: "frameFocused" -- cgit v1.2.3 From a469e8265ab5121bdb83935e977c8a89777572b0 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sat, 18 Apr 2015 15:47:38 +0100 Subject: Activate vomnibar in window.top; add "labs" option. --- background_scripts/settings.coffee | 2 ++ 1 file changed, 2 insertions(+) (limited to 'background_scripts') diff --git a/background_scripts/settings.coffee b/background_scripts/settings.coffee index 3528e8a9..50a6a9f4 100644 --- a/background_scripts/settings.coffee +++ b/background_scripts/settings.coffee @@ -114,6 +114,8 @@ root.Settings = Settings = searchEngines: "w: http://www.wikipedia.org/w/index.php?title=Special:Search&search=%s wikipedia" newTabUrl: "chrome://newtab" grabBackFocus: false + # Vimium Labs settings + vomnibarInTopFrame: false settingsVersion: Utils.getCurrentVersion() -- cgit v1.2.3 From 43b55018071d90adcdb4c4f2ff1b56226ae91dab Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Sun, 19 Apr 2015 08:07:11 +0100 Subject: Activate vomnibar in window.top; strip (now) unnecessary setting. --- background_scripts/settings.coffee | 2 -- 1 file changed, 2 deletions(-) (limited to 'background_scripts') diff --git a/background_scripts/settings.coffee b/background_scripts/settings.coffee index 50a6a9f4..3528e8a9 100644 --- a/background_scripts/settings.coffee +++ b/background_scripts/settings.coffee @@ -114,8 +114,6 @@ root.Settings = Settings = searchEngines: "w: http://www.wikipedia.org/w/index.php?title=Special:Search&search=%s wikipedia" newTabUrl: "chrome://newtab" grabBackFocus: false - # Vimium Labs settings - vomnibarInTopFrame: false settingsVersion: Utils.getCurrentVersion() -- cgit v1.2.3 From bfa6c88b41acac4c98d06f324f25f8bb7b328614 Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Thu, 23 Apr 2015 11:07:36 +0100 Subject: Activate vomnibar in window.top; no flicker and tidy up. 1. Rework event handling to eliminate frame flicker (a la #1485). 2. Tidy up logic. Which should make this more robust. --- background_scripts/main.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'background_scripts') diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee index a64c7e37..0c7d9343 100644 --- a/background_scripts/main.coffee +++ b/background_scripts/main.coffee @@ -658,7 +658,7 @@ handleFrameFocused = (request, sender) -> frameIdsForTab[tabId] = [request.frameId, (frameIdsForTab[tabId].filter (id) -> id != request.frameId)...] # Inform all frames that a frame has received the focus. - chrome.tabs.sendMessage sender.tab.id, + chrome.tabs.sendMessage sender.tab.id, name: "frameFocused" focusFrameId: request.frameId -- cgit v1.2.3