     window.location.href = window.location.origin
 
   toggleViewSource: ->
-    chrome.extension.sendMessage { handler: "getCurrentTabUrl" }, (url) ->
+    chrome.runtime.sendMessage { handler: "getCurrentTabUrl" }, (url) ->
       if (url.substr(0, 12) == "view-source:")
         url = url.substr(12, url.length - 12)
       else
         url = "view-source:" + url
-      chrome.extension.sendMessage({ handler: "openUrlInNewTab", url: url, selected: true })
+      chrome.runtime.sendMessage({ handler: "openUrlInNewTab", url: url, selected: true })
 
   copyCurrentUrl: ->
     # TODO(ilya): When the following bug is fixed, revisit this approach of sending back to the background
     # page to copy.
     # http://code.google.com/p/chromium/issues/detail?id=55188
-    chrome.extension.sendMessage { handler: "getCurrentTabUrl" }, (url) ->
-      chrome.extension.sendMessage { handler: "copyToClipboard", data: url }
+    chrome.runtime.sendMessage { handler: "getCurrentTabUrl" }, (url) ->
+      chrome.runtime.sendMessage { handler: "copyToClipboard", data: url }
 
     HUD.showForDuration("Yanked URL", 1000)
 

    getActiveState: -> { enabled: isEnabledForUrl }
    disableVimium: disableVimium

  chrome.extension.onMessage.addListener (request, sender, sendResponse) ->
    # in the options page, we will receive requests from both content and background scripts. ignore those
    # from the former.
    return if sender.tab and not sender.tab.url.startsWith 'chrome-extension://'

  refreshCompletionKeys()

  # Send the key to the key handler in the background page.
  keyPort = chrome.runtime.connect({ name: "keyDown" })

  requestHandlers =
    hideUpgradeNotification: -> HUD.hideUpgradeNotification()
