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

Side by Side Diff: ui/base/keycodes/keyboard_code_conversion_mac.mm

Issue 10808072: ui: No need to typedef testing::Test in unittests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: typos Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « ui/aura/window_property.h ('k') | ui/base/resource/resource_bundle_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #import "ui/base/keycodes/keyboard_code_conversion_mac.h" 5 #import "ui/base/keycodes/keyboard_code_conversion_mac.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8
8 #import <Carbon/Carbon.h> 9 #import <Carbon/Carbon.h>
9 10
10 #include "base/logging.h" 11 #include "base/logging.h"
11 12
12 namespace ui { 13 namespace ui {
13 14
14 namespace { 15 namespace {
15 16
16 // A struct to hold a Windows keycode to Mac virtual keycode mapping. 17 // A struct to hold a Windows keycode to Mac virtual keycode mapping.
17 struct KeyCodeMap { 18 struct KeyCodeMap {
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 /* 0x7E */ VKEY_UP, // Up Arrow 441 /* 0x7E */ VKEY_UP, // Up Arrow
441 /* 0x7F */ VKEY_UNKNOWN // n/a 442 /* 0x7F */ VKEY_UNKNOWN // n/a
442 }; 443 };
443 444
444 if (keyCode >= 0x80) 445 if (keyCode >= 0x80)
445 return VKEY_UNKNOWN; 446 return VKEY_UNKNOWN;
446 447
447 return kKeyboardCodes[keyCode]; 448 return kKeyboardCodes[keyCode];
448 } 449 }
449 450
450 } // anonymous namespace 451 } // namespace
451 452
452 int MacKeyCodeForWindowsKeyCode(KeyboardCode keycode, 453 int MacKeyCodeForWindowsKeyCode(KeyboardCode keycode,
453 NSUInteger flags, 454 NSUInteger flags,
454 unichar* character, 455 unichar* character,
455 unichar* characterIgnoringModifiers) { 456 unichar* characterIgnoringModifiers) {
456 KeyCodeMap from; 457 KeyCodeMap from;
457 from.keycode = keycode; 458 from.keycode = keycode;
458 459
459 const KeyCodeMap* ptr = std::lower_bound( 460 const KeyCodeMap* ptr = std::lower_bound(
460 kKeyCodesMap, kKeyCodesMap + arraysize(kKeyCodesMap), from); 461 kKeyCodesMap, kKeyCodesMap + arraysize(kKeyCodesMap), from);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 characters = [event charactersIgnoringModifiers]; 549 characters = [event charactersIgnoringModifiers];
549 if ([characters length] > 0) 550 if ([characters length] > 0)
550 code = KeyboardCodeFromCharCode([characters characterAtIndex:0]); 551 code = KeyboardCodeFromCharCode([characters characterAtIndex:0]);
551 if (code) 552 if (code)
552 return code; 553 return code;
553 } 554 }
554 return KeyboardCodeFromKeyCode([event keyCode]); 555 return KeyboardCodeFromKeyCode([event keyCode]);
555 } 556 }
556 557
557 } // namespace ui 558 } // namespace ui
OLDNEW
« no previous file with comments | « ui/aura/window_property.h ('k') | ui/base/resource/resource_bundle_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698