aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2015-03-17 09:47:46 +0000
committerStephen Blott2015-03-17 09:47:46 +0000
commitaa8d00fd9779d4061431dbdcb7a70b9c39e8049a (patch)
tree0666dd79baa0a5855ecbc515250880ccafa9f54d
parente65f4d4e8a498e34a18c64898cb7425caee9fdc0 (diff)
downloadvimium-aa8d00fd9779d4061431dbdcb7a70b9c39e8049a.tar.bz2
Activate vomnibar in window.top; simplify messaging.
-rw-r--r--background_scripts/main.coffee13
-rw-r--r--content_scripts/ui_component.coffee10
2 files changed, 9 insertions, 14 deletions
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"
diff --git a/content_scripts/ui_component.coffee b/content_scripts/ui_component.coffee
index 3a4af6b5..82398727 100644
--- a/content_scripts/ui_component.coffee
+++ b/content_scripts/ui_component.coffee
@@ -54,11 +54,11 @@ class UIComponent
@onFocus = null
if focusWindow and @options?.frameId?
chrome.runtime.sendMessage
- handler: "sendMessageToFrame"
- frameId: frameId
- targetFrameId: @options.frameId
- name: "focusFrame"
- highlight: true # true for debugging; should be false when live.
+ handler: "sendMessageToFrames"
+ message:
+ name: "focusFrame"
+ frameId: @options.frameId
+ highlight: true # true for debugging; should be false when live.
@options = null
@showing = false