1// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5chrome.commands.onCommand.addListener(function(command) {
6  if (command == "toggle-pin") {
7    // Get the currently selected tab
8    chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
9      // Toggle the pinned status
10      var current = tabs[0]
11      chrome.tabs.update(current.id, {'pinned': !current.pinned});
12    });
13  }
14});
15