diff options
author | smus@chromium.org <smus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-16 21:12:41 +0000 |
---|---|---|
committer | smus@chromium.org <smus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-16 21:12:41 +0000 |
commit | f50a65764158f8bb3954dd3677c0f21628ef6f71 (patch) | |
tree | c27b8ddbb982235a7d2747028c64c88c344a9b8e /chrome/common/extensions/docs/examples/api/tabs/pin/inject.js | |
parent | aca5a97af1eabd1e4668379225388cb853018ebd (diff) | |
download | chromium_src-f50a65764158f8bb3954dd3677c0f21628ef6f71.zip chromium_src-f50a65764158f8bb3954dd3677c0f21628ef6f71.tar.gz chromium_src-f50a65764158f8bb3954dd3677c0f21628ef6f71.tar.bz2 |
Added a sample Chrome Extension that uses the Tab Pinning API.
Enables a new keyboard shortcut (Ctrl + Shift + P) to toggle pinning and unpinning of the current tab.
BUG=62699
TEST=None
Review URL: http://codereview.chromium.org/6651004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78433 0039d316-1c4b-4281-b951-d872f2087c98
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); |