diff options
| author | Stephen Blott | 2016-02-20 17:23:48 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-02-20 17:23:48 +0000 |
| commit | f435bb93aaa91228b1cac7c92cc2995bbf88257f (patch) | |
| tree | ae34f39490f1e631dbb015d5a873207b8f91f3dd | |
| parent | 0a6fb464f44bc4db242183ad137e9f80f793ec62 (diff) | |
| parent | 041b441073be2a554af94b23ea16535391cc1f29 (diff) | |
| download | vimium-f435bb93aaa91228b1cac7c92cc2995bbf88257f.tar.bz2 | |
Merge branch 'windows-onFocusChanged'
| -rw-r--r-- | CREDITS | 1 | ||||
| -rw-r--r-- | background_scripts/bg_utils.coffee | 5 | ||||
| -rw-r--r-- | tests/unit_tests/test_chrome_stubs.coffee | 2 |
3 files changed, 8 insertions, 0 deletions
@@ -44,5 +44,6 @@ Contributors: Shiyong Chen <billbill290@gmail.com> (github: UncleBill) Utkarsh Upadhyay <musically.ut@gmail.com) (github: musically-ut) Michael Salihi <admin@prestance-informatique.fr> (github: PrestanceDesign) + Dahan Gong <gdh1995@qq.com> (github: gdh1995) Feel free to add real names in addition to GitHub usernames. diff --git a/background_scripts/bg_utils.coffee b/background_scripts/bg_utils.coffee index 96c1282a..ca042686 100644 --- a/background_scripts/bg_utils.coffee +++ b/background_scripts/bg_utils.coffee @@ -18,6 +18,11 @@ class TabRecency @deregister removedTabId @register addedTabId + chrome.windows.onFocusChanged.addListener (wnd) => + if wnd != chrome.windows.WINDOW_ID_NONE + chrome.tabs.query {windowId: wnd, active: true}, (tabs) => + @register tabs[0].id if tabs[0] + register: (tabId) -> currentTime = new Date() # Register tabId if it has been visited for at least @timeDelta ms. Tabs which are visited only for a diff --git a/tests/unit_tests/test_chrome_stubs.coffee b/tests/unit_tests/test_chrome_stubs.coffee index 8b816cd4..bbcd01e7 100644 --- a/tests/unit_tests/test_chrome_stubs.coffee +++ b/tests/unit_tests/test_chrome_stubs.coffee @@ -60,6 +60,8 @@ exports.chrome = onRemoved: addListener: () -> true getAll: () -> true + onFocusChanged: + addListener: () -> true browserAction: setBadgeBackgroundColor: -> |
