diff options
| author | Stephen Blott | 2016-03-05 08:41:43 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-03-05 08:41:45 +0000 |
| commit | b883af74450faf3683b8077d6ba09864f5632b26 (patch) | |
| tree | a0148f4aa71bbea69dd7c0db7f138a695cc20c07 /content_scripts | |
| parent | fbf7791894cb2708774e8870f623a8211e3a0790 (diff) | |
| download | vimium-b883af74450faf3683b8077d6ba09864f5632b26.tar.bz2 | |
Generalise topFrame commands.
This generalises the mechanism by which commands are always run in the
tab's main/top frame. Currently, that's just the Vomnibar.
This is a precursor to moving other UI components to the main/top frame.
It should be fairly trivial to move the help page to the main frame.
The HUD might be trickier.
Mention: @mrmr1993.
Diffstat (limited to 'content_scripts')
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 71535b19..972911c5 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -116,10 +116,9 @@ class NormalMode extends KeyHandlerMode You have asked Vimium to perform #{count} repetitions of the command: #{registryEntry.description}.\n Are you sure you want to continue?""" - # The Vomnibar needs special handling because it is always activated in the tab's main frame. - if registryEntry.command.startsWith "Vomnibar." + if registryEntry.topFrame chrome.runtime.sendMessage - handler: "sendMessageToFrames", message: {name: "openVomnibar", sourceFrameId: frameId, registryEntry} + handler: "sendMessageToFrames", message: {name: "runInTopFrame", sourceFrameId: frameId, registryEntry} else if registryEntry.background chrome.runtime.sendMessage {handler: "runBackgroundCommand", frameId, registryEntry, count} else if registryEntry.passCountToFunction @@ -150,7 +149,7 @@ initializePreDomReady = -> # A frame has received the focus. We don't care here (the Vomnibar/UI-component handles this). frameFocused: -> checkEnabledAfterURLChange: checkEnabledAfterURLChange - openVomnibar: ({sourceFrameId, registryEntry}) -> + runInTopFrame: ({sourceFrameId, registryEntry}) -> Utils.invokeCommandString registryEntry.command, [sourceFrameId, registryEntry] if DomUtils.isTopFrame() chrome.runtime.onMessage.addListener (request, sender, sendResponse) -> |
