Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(47)

Side by Side Diff: chrome/browser/global_keyboard_shortcuts_mac.mm

Issue 655413002: Convert ARRAYSIZE_UNSAFE -> arraysize in chrome/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <AppKit/NSEvent.h> 5 #include <AppKit/NSEvent.h>
6 #include <Carbon/Carbon.h> 6 #include <Carbon/Carbon.h>
7 7
8 #include "chrome/browser/global_keyboard_shortcuts_mac.h" 8 #include "chrome/browser/global_keyboard_shortcuts_mac.h"
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // Alphabetic characters aren't mirrored, go with the raw character. 212 // Alphabetic characters aren't mirrored, go with the raw character.
213 // [A previous partial comment said something about Dvorak?] 213 // [A previous partial comment said something about Dvorak?]
214 if (isalpha(rawChar)) 214 if (isalpha(rawChar))
215 return rawChar; 215 return rawChar;
216 216
217 // http://crbug.com/42517 217 // http://crbug.com/42517
218 // http://crbug.com/315379 218 // http://crbug.com/315379
219 // In RTL keyboard layouts, Cocoa mirrors characters in the string 219 // In RTL keyboard layouts, Cocoa mirrors characters in the string
220 // returned by [event charactersIgnoringModifiers]. In this case, return 220 // returned by [event charactersIgnoringModifiers]. In this case, return
221 // the raw (unmirrored) char. 221 // the raw (unmirrored) char.
222 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kCharMapping); ++i) { 222 for (size_t i = 0; i < arraysize(kCharMapping); ++i) {
223 if (rawChar == kCharMapping[i].rawChar && 223 if (rawChar == kCharMapping[i].rawChar &&
224 noModifiersChar == kCharMapping[i].unmodChar) { 224 noModifiersChar == kCharMapping[i].unmodChar) {
225 return kCharMapping[i].targetChar; 225 return kCharMapping[i].targetChar;
226 } 226 }
227 } 227 }
228 228
229 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8). 229 // opt/alt modifier is set (e.g. on german layout we want '{' for opt-8).
230 if ([event modifierFlags] & NSAlternateKeyMask) 230 if ([event modifierFlags] & NSAlternateKeyMask)
231 return rawChar; 231 return rawChar;
232 } 232 }
233 233
234 return noModifiersChar; 234 return noModifiersChar;
235 } 235 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_protocols_unittest.cc ('k') | chrome/browser/global_keyboard_shortcuts_mac_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698