| 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 #include <stddef.h> |
| 8 | 9 |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/macros.h" |
| 10 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 11 #include "chrome/app/chrome_command_ids.h" | 13 #include "chrome/app/chrome_command_ids.h" |
| 12 #import "ui/base/accelerators/platform_accelerator_cocoa.h" | 14 #import "ui/base/accelerators/platform_accelerator_cocoa.h" |
| 13 #import "ui/events/cocoa/cocoa_event_utils.h" | 15 #import "ui/events/cocoa/cocoa_event_utils.h" |
| 14 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" | 16 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" |
| 15 | 17 |
| 16 namespace { | 18 namespace { |
| 17 | 19 |
| 18 // These accelerators are not associated with a command_id. | 20 // These accelerators are not associated with a command_id. |
| 19 const struct AcceleratorListing { | 21 const struct AcceleratorListing { |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 NSUInteger mask = platform_accelerator->modifier_mask(); | 184 NSUInteger mask = platform_accelerator->modifier_mask(); |
| 183 BOOL maskEqual = | 185 BOOL maskEqual = |
| 184 (mask == modifiers) || ((mask & (~NSShiftKeyMask)) == modifiers); | 186 (mask == modifiers) || ((mask & (~NSShiftKeyMask)) == modifiers); |
| 185 NSString* string = [NSString stringWithFormat:@"%C", shifted_character]; | 187 NSString* string = [NSString stringWithFormat:@"%C", shifted_character]; |
| 186 if ([string isEqual:key_equivalent] && maskEqual) | 188 if ([string isEqual:key_equivalent] && maskEqual) |
| 187 return &*it; | 189 return &*it; |
| 188 } | 190 } |
| 189 | 191 |
| 190 return NULL; | 192 return NULL; |
| 191 } | 193 } |
| OLD | NEW |