       params.x_apiKey = bitly.apiKey
       params.x_login  = bitly.username
     params
+  getUsage: ->
+    store.get 'bitly.usage'
   input: ->
     null
   isEnabled: ->
     store.get 'bitly.enabled'
   method: 'GET'
-  name: 'bit.ly'
+  name: 'bitly'
   output: (resp) ->
     JSON.parse(resp).data.url
+  title: 'bit.ly'
   url: ->
     'http://api.bitly.com/v3/shorten'
 ,

      $('#loadDiv', popup.document).hide()
      $('#item', popup.document).show()

# Update the context menu items to reflect the currently enabled templates.  
# If the context menu option has been disabled by the user, just remove all of
# the existing menu items.
updateContextMenu = ->
  # Ensure that any previously added context menu items are removed.
  chrome.contextMenus.removeAll ->
    # Called whenever a menu item is clicked.  
    # Send a self request, passing along the available information.
    onMenuClick = (info, tab) ->
      onRequest
        data: info
        type: 'menu'
    if store.get 'contextMenu'
      # Create and add the top-level Template menu.
      parentId = chrome.contextMenus.create
        contexts: ['all']
        title:    i18n.get 'name'
      # Create and add a sub-menu item for each enabled template.
      for template in ext.templates when template.enabled
        menuId = chrome.contextMenus.create
          contexts: ['all']
          onclick:  onMenuClick
          parentId: parentId
          title:    template.title
        template.menuId = menuId

# Update the statistical information.
updateStatistics = ->
  store.modify 'stats', (stats) =>
    # Determine which template has the greatest usage.
    maxUsage = 0

      req.onreadystatechange = ->
        if req.readyState is 4
          if req.status is 200
            updateUrlShortenerUsage service.name
            callback?(
              shortUrl:  service.output req.responseText
              shortener: title
              success:   yes
            )
          else
            # Something went wrong so let's tell the user.
            callback?(
              message:   i18n.get 'shortener_error', title
              shortener: title
              success:   no
            )
      # Finally, send the HTTP request.
