OLD | NEW |
1 <script> | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
2 // Global accessor that the popup uses. | 5 // Global accessor that the popup uses. |
3 var addresses = {}; | 6 var addresses = {}; |
4 var selectedAddress = null; | 7 var selectedAddress = null; |
5 var selectedId = null; | 8 var selectedId = null; |
6 | 9 |
7 function updateAddress(tabId) { | 10 function updateAddress(tabId) { |
8 chrome.tabs.sendRequest(tabId, {}, function(address) { | 11 chrome.tabs.sendRequest(tabId, {}, function(address) { |
9 addresses[tabId] = address; | 12 addresses[tabId] = address; |
10 if (!address) { | 13 if (!address) { |
11 chrome.pageAction.hide(tabId); | 14 chrome.pageAction.hide(tabId); |
(...skipping 20 matching lines...) Expand all Loading... |
32 | 35 |
33 chrome.tabs.onSelectionChanged.addListener(function(tabId, info) { | 36 chrome.tabs.onSelectionChanged.addListener(function(tabId, info) { |
34 selectedId = tabId; | 37 selectedId = tabId; |
35 updateSelected(tabId); | 38 updateSelected(tabId); |
36 }); | 39 }); |
37 | 40 |
38 // Ensure the current selected tab is set up. | 41 // Ensure the current selected tab is set up. |
39 chrome.tabs.getSelected(null, function(tab) { | 42 chrome.tabs.getSelected(null, function(tab) { |
40 updateAddress(tab.id); | 43 updateAddress(tab.id); |
41 }); | 44 }); |
42 </script> | |
OLD | NEW |