aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authorStephen Blott2015-02-09 14:17:03 +0000
committerStephen Blott2015-02-09 14:17:03 +0000
commit9f20c33adf75e2e78b35e2cd16f2a0925a72c577 (patch)
treef94654449c387b8b94d34051b2557a0ec99ee8bb /background_scripts
parenta2ab96e858ddb5ec0b9f17e47936b2a571e90ab4 (diff)
parentb0ffde36732eee6a6b114927d45ae4d1e7ab0107 (diff)
downloadvimium-9f20c33adf75e2e78b35e2cd16f2a0925a72c577.tar.bz2
Merge branch 'find-mode-history-for-incognito-mode'
Conflicts: background_scripts/main.coffee
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/main.coffee20
-rw-r--r--background_scripts/settings.coffee9
2 files changed, 28 insertions, 1 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index 5a126ceb..8f51b374 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -172,7 +172,10 @@ upgradeNotificationClosed = (request) ->
# We return null to avoid the return value from the copy operations being passed to sendResponse.
#
copyToClipboard = (request) -> Clipboard.copy(request.data); null
+<<<<<<< HEAD
pasteFromClipboard = (request) -> Clipboard.paste(); null
+=======
+>>>>>>> @{-1}
#
# Selects the tab with the ID specified in request.id
@@ -384,7 +387,7 @@ root.updateActiveState = updateActiveState = (tabId) ->
setBrowserActionIcon(tabId,disabledIcon)
# Propagate the new state only if it has changed.
if (isCurrentlyEnabled != enabled || currentPasskeys != passKeys)
- chrome.tabs.sendMessage(tabId, { name: "setState", enabled: enabled, passKeys: passKeys })
+ chrome.tabs.sendMessage(tabId, { name: "setState", enabled: enabled, passKeys: passKeys, incognito: tab.incognito })
else
# We didn't get a response from the front end, so Vimium isn't running.
setBrowserActionIcon(tabId,disabledIcon)
@@ -658,6 +661,21 @@ sendRequestHandlers =
gotoMark: Marks.goto.bind(Marks)
setBadge: setBadge
+# We always remove chrome.storage.local/findModeRawQueryListIncognito on startup.
+chrome.storage.local.remove "findModeRawQueryListIncognito"
+
+# Remove chrome.storage.local/findModeRawQueryListIncognito if there are no remaining incognito-mode tabs.
+# Since the common case is that there are none to begin with, we first check whether the key is set at all.
+chrome.tabs.onRemoved.addListener (tabId) ->
+ chrome.storage.local.get "findModeRawQueryListIncognito", (items) ->
+ if items.findModeRawQueryListIncognito
+ chrome.windows.getAll { populate: true }, (windows) ->
+ for window in windows
+ for tab in window.tabs
+ return if tab.incognito and tab.id != tabId
+ # There are no remaining incognito-mode tabs, and findModeRawQueryListIncognito is set.
+ chrome.storage.local.remove "findModeRawQueryListIncognito"
+
# Convenience function for development use.
window.runTests = -> open(chrome.runtime.getURL('tests/dom_tests/dom_tests.html'))
diff --git a/background_scripts/settings.coffee b/background_scripts/settings.coffee
index 2fc3b43d..f43bd4bc 100644
--- a/background_scripts/settings.coffee
+++ b/background_scripts/settings.coffee
@@ -121,3 +121,12 @@ root.Settings = Settings =
if Utils.compareVersions("1.42", Settings.get("settingsVersion")) != -1
Settings.set("scrollStepSize", parseFloat Settings.get("scrollStepSize"))
Settings.set("settingsVersion", Utils.getCurrentVersion())
+
+# Migration (after 1.49, 2015/2/1).
+# Legacy setting: findModeRawQuery (a string).
+# New setting: findModeRawQueryList (a list of strings), now stored in chrome.storage.local (not localStorage).
+chrome.storage.local.get "findModeRawQueryList", (items) ->
+ unless chrome.runtime.lastError or items.findModeRawQueryList
+ rawQuery = Settings.get "findModeRawQuery"
+ chrome.storage.local.set findModeRawQueryList: (if rawQuery then [ rawQuery ] else [])
+