diff options
Diffstat (limited to 'chrome/common/extensions/docs/examples/api/tabs/pin/inject.js')
-rw-r--r-- | chrome/common/extensions/docs/examples/api/tabs/pin/inject.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/chrome/common/extensions/docs/examples/api/tabs/pin/inject.js b/chrome/common/extensions/docs/examples/api/tabs/pin/inject.js new file mode 100644 index 0000000..3117e40 --- /dev/null +++ b/chrome/common/extensions/docs/examples/api/tabs/pin/inject.js @@ -0,0 +1,13 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +window.addEventListener("keydown", function(event) { + // Bind to both command (for Mac) and control (for Win/Linux) + var modifier = event.ctrlKey || event.metaKey; + if (modifier && event.shiftKey && event.keyCode == 80) { + // Send message to background page to toggle tab + chrome.extension.sendRequest({toggle_pin: true}, function(response) { + // Do stuff on successful response + }); + } +}, false); |