| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2009 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 #import "chrome/common/cocoa_utils.h" | |
| 6 | |
| 7 namespace event_utils { | |
| 8 | |
| 9 // Translates modifier flags from an NSEvent into a WindowOpenDisposition. For | |
| 10 // example, holding down Cmd (Apple) will cause pages to be opened in a new | |
| 11 // foreground tab. Pass this the result of -[NSEvent modifierFlags]. | |
| 12 WindowOpenDisposition DispositionFromEventFlags(NSUInteger modifiers) { | |
| 13 if (modifiers & NSCommandKeyMask) { | |
| 14 return (modifiers & NSShiftKeyMask) ? | |
| 15 NEW_BACKGROUND_TAB : NEW_FOREGROUND_TAB; | |
| 16 } | |
| 17 | |
| 18 if (modifiers & NSShiftKeyMask) | |
| 19 return NEW_WINDOW; | |
| 20 // TODO: Browser::OpenURLAtIndex does not support SAVE_TO_DISK, so we can't | |
| 21 // offer to download the page. See DCHECK() and TODOs there. | |
| 22 return (false /* modifiers & NSAlternateKeyMask */) ? | |
| 23 SAVE_TO_DISK : CURRENT_TAB; | |
| 24 } | |
| 25 | |
| 26 } // namespace event_utils | |
| OLD | NEW |