diff options
| author | Daniel MacDougall | 2012-03-28 02:01:24 -0700 | 
|---|---|---|
| committer | Daniel MacDougall | 2012-03-28 02:13:42 -0700 | 
| commit | 2d92b45b28146e1ea46f87038827027ce1e00b51 (patch) | |
| tree | cf6dbf075e64e92c2e67a8715d33218e4286d6f5 | |
| parent | a26c50d33493782ec6cb19cbec9c12e5e48a0f8f (diff) | |
| download | vimium-2d92b45b28146e1ea46f87038827027ce1e00b51.tar.bz2 | |
Add browser icon that displays enabled/disabled state
| -rw-r--r-- | background_page.html | 13 | ||||
| -rw-r--r-- | icons/icon48.png | bin | 4222 -> 4254 bytes | |||
| -rw-r--r-- | icons/icon48disabled.png | bin | 0 -> 3648 bytes | |||
| -rw-r--r-- | manifest.json | 5 | 
4 files changed, 17 insertions, 1 deletions
| diff --git a/background_page.html b/background_page.html index aed9617b..881024c3 100644 --- a/background_page.html +++ b/background_page.html @@ -332,6 +332,14 @@      delete framesForTab[tab.id];    } +  function updateIconState(tabId) { +    if (openTabs[tabId]) { +      var isEnabled = isEnabledForUrl({url: openTabs[tabId].url}).isEnabledForUrl; +      var iconPath = isEnabled ? "icons/icon48.png" : "icons/icon48disabled.png"; +      chrome.browserAction.setIcon({path: iconPath}); +    } +  } +    function handleUpdateScrollPosition(request, sender) {      updateScrollPosition(sender.tab, request.scrollX, request.scrollY);    } @@ -345,6 +353,7 @@    chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {      if (changeInfo.status != "loading") { return; } // only do this once per URL change      updateOpenTabs(tab); +    updateIconState(tabId);    });    chrome.tabs.onAttached.addListener(function(tabId, attachedInfo) { @@ -383,6 +392,10 @@      delete framesForTab[tabId];    }); +  chrome.tabs.onActiveChanged.addListener(function(tabId, selectInfo) { +    updateIconState(tabId); +  }); +    chrome.windows.onRemoved.addListener(function(windowId) {      delete tabQueue[windowId];    }); diff --git a/icons/icon48.png b/icons/icon48.pngBinary files differ index 6a3202f0..9eb94d4f 100644 --- a/icons/icon48.png +++ b/icons/icon48.png diff --git a/icons/icon48disabled.png b/icons/icon48disabled.pngBinary files differ new file mode 100644 index 00000000..fa6279d3 --- /dev/null +++ b/icons/icon48disabled.png diff --git a/manifest.json b/manifest.json index 085caaed..31b9e976 100644 --- a/manifest.json +++ b/manifest.json @@ -29,5 +29,8 @@        "run_at": "document_start",        "all_frames": true      } -  ] +  ], +  "browser_action": { +    "default_icon": "icons/icon48disabled.png" +  }  } | 
