| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/cocoa/accelerators_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/accelerators_cocoa.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| 11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
| 12 #import "ui/base/accelerators/platform_accelerator_cocoa.h" | 12 #import "ui/base/accelerators/platform_accelerator_cocoa.h" |
| 13 #import "ui/base/cocoa/cocoa_event_utils.h" | 13 #import "ui/events/cocoa/cocoa_event_utils.h" |
| 14 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" | 14 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // These accelerators are not associated with a command_id. | 18 // These accelerators are not associated with a command_id. |
| 19 const struct AcceleratorListing { | 19 const struct AcceleratorListing { |
| 20 NSUInteger modifiers; // The Cocoa modifiers. | 20 NSUInteger modifiers; // The Cocoa modifiers. |
| 21 ui::KeyboardCode key_code; // The key used for cross-platform compatibility. | 21 ui::KeyboardCode key_code; // The key used for cross-platform compatibility. |
| 22 } kAcceleratorList [] = { | 22 } kAcceleratorList [] = { |
| 23 {NSCommandKeyMask | NSAlternateKeyMask, ui::VKEY_H}, | 23 {NSCommandKeyMask | NSAlternateKeyMask, ui::VKEY_H}, |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 NSUInteger mask = platform_accelerator->modifier_mask(); | 183 NSUInteger mask = platform_accelerator->modifier_mask(); |
| 184 BOOL maskEqual = | 184 BOOL maskEqual = |
| 185 (mask == modifiers) || ((mask & (~NSShiftKeyMask)) == modifiers); | 185 (mask == modifiers) || ((mask & (~NSShiftKeyMask)) == modifiers); |
| 186 NSString* string = [NSString stringWithFormat:@"%C", character]; | 186 NSString* string = [NSString stringWithFormat:@"%C", character]; |
| 187 if ([string isEqual:key_equivalent] && maskEqual) | 187 if ([string isEqual:key_equivalent] && maskEqual) |
| 188 return &*it; | 188 return &*it; |
| 189 } | 189 } |
| 190 | 190 |
| 191 return NULL; | 191 return NULL; |
| 192 } | 192 } |
| OLD | NEW |