summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs/examples/api/tabs/pin/inject.js
blob: 3117e40ab5259d05bd96e654f098ec77dcfcdb98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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);