OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 |
| 5 |
| 6 /** |
| 7 * @fileoverview Utilities for handling window disposition. |
| 8 */ |
| 9 |
| 10 |
| 11 /** |
| 12 * The JavaScript button event value for a middle click. |
| 13 * @type {number} |
| 14 * @const |
| 15 */ |
| 16 var MIDDLE_MOUSE_BUTTON = 1; |
| 17 |
| 18 |
| 19 /** |
| 20 * Gets the desired navigation behavior from a event. This function works both |
| 21 * with mouse and keyboard events. |
| 22 * @param {Event} e The event object. |
| 23 * @return {WindowOpenDisposition} The desired navigation behavior. |
| 24 */ |
| 25 function getDispositionFromEvent(e) { |
| 26 var middleButton = e.button == MIDDLE_MOUSE_BUTTON; |
| 27 return chrome.embeddedSearch.newTabPage.getDispositionFromClick(middleButton, |
| 28 e.altKey, |
| 29 e.ctrlKey, |
| 30 e.metaKey, |
| 31 e.shiftKey); |
| 32 } |
OLD | NEW |