aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts
diff options
context:
space:
mode:
authormrmr19932017-09-21 21:46:39 +0100
committermrmr19932017-09-21 21:46:39 +0100
commit7fa22da6954d28dbd578b0cd490ada638d98b373 (patch)
tree0e72947e9adf112caf4b13bf125a2e79907524cd /background_scripts
parenta8337e93b33cfbaba17c4a237fe7330f27145c0c (diff)
downloadvimium-7fa22da6954d28dbd578b0cd490ada638d98b373.tar.bz2
Add openUrlInNewWindow command
Diffstat (limited to 'background_scripts')
-rw-r--r--background_scripts/main.coffee11
1 files changed, 11 insertions, 0 deletions
diff --git a/background_scripts/main.coffee b/background_scripts/main.coffee
index eeda263a..8afecd4f 100644
--- a/background_scripts/main.coffee
+++ b/background_scripts/main.coffee
@@ -117,6 +117,16 @@ TabOperations =
catch
callback.apply this, arguments
+ # Opens request.url in new window and switches to it.
+ openUrlInNewWindow: (request, callback = (->)) ->
+ winConfig =
+ url: Utils.convertToUrl request.url
+ active: true
+ winConfig.active = request.active if request.active?
+ # Firefox does not support "about:newtab" in chrome.tabs.create.
+ delete tabConfig["url"] if tabConfig["url"] == Settings.defaults.newTabUrl
+ chrome.windows.create winConfig, callback
+
toggleMuteTab = do ->
muteTab = (tab) -> chrome.tabs.update tab.id, {muted: !tab.mutedInfo.muted}
@@ -416,6 +426,7 @@ sendRequestHandlers =
# with Chrome-specific URLs like "view-source:http:..".
getCurrentTabUrl: ({tab}) -> tab.url
openUrlInNewTab: (request) -> TabOperations.openUrlInNewTab request
+ openUrlInNewWindow: (request) -> TabOperations.openUrlInNewWindow request
openUrlInIncognito: (request) -> chrome.windows.create incognito: true, url: Utils.convertToUrl request.url
openUrlInCurrentTab: TabOperations.openUrlInCurrentTab
openOptionsPageInNewTab: (request) ->