From f50a65764158f8bb3954dd3677c0f21628ef6f71 Mon Sep 17 00:00:00 2001 From: "smus@chromium.org" Date: Wed, 16 Mar 2011 21:12:41 +0000 Subject: 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 --- .../common/extensions/docs/examples/api/tabs/pin/inject.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 chrome/common/extensions/docs/examples/api/tabs/pin/inject.js (limited to 'chrome/common/extensions/docs/examples/api/tabs/pin/inject.js') 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); -- cgit v1.1