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

Side by Side Diff: chrome/test/chromedriver/keycode_text_conversion_mac.mm

Issue 16917011: mac: Replace base::mac::ScopedCFTypeRef with base::ScopedCFTypeRef. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: with fixed off-by-1 in git-clang-format Created 7 years, 6 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 | « chrome/service/chrome_service_application_mac.mm ('k') | chrome/test/chromedriver/test_util.h » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/test/chromedriver/keycode_text_conversion.h" 5 #include "chrome/test/chromedriver/keycode_text_conversion.h"
6 6
7 #import <Carbon/Carbon.h> 7 #import <Carbon/Carbon.h>
8 8
9 #include <cctype> 9 #include <cctype>
10 10
(...skipping 26 matching lines...) Expand all
37 if (modifiers & kControlKeyModifierMask) 37 if (modifiers & kControlKeyModifierMask)
38 mac_modifiers |= controlKey; 38 mac_modifiers |= controlKey;
39 if (modifiers & kAltKeyModifierMask) 39 if (modifiers & kAltKeyModifierMask)
40 mac_modifiers |= optionKey; 40 mac_modifiers |= optionKey;
41 if (modifiers & kMetaKeyModifierMask) 41 if (modifiers & kMetaKeyModifierMask)
42 mac_modifiers |= cmdKey; 42 mac_modifiers |= cmdKey;
43 // Convert EventRecord modifiers to format UCKeyTranslate accepts. See docs 43 // Convert EventRecord modifiers to format UCKeyTranslate accepts. See docs
44 // on UCKeyTranslate for more info. 44 // on UCKeyTranslate for more info.
45 UInt32 modifier_key_state = (mac_modifiers >> 8) & 0xFF; 45 UInt32 modifier_key_state = (mac_modifiers >> 8) & 0xFF;
46 46
47 base::mac::ScopedCFTypeRef<TISInputSourceRef> input_source_copy( 47 base::ScopedCFTypeRef<TISInputSourceRef> input_source_copy(
48 TISCopyCurrentKeyboardLayoutInputSource()); 48 TISCopyCurrentKeyboardLayoutInputSource());
49 CFDataRef layout_data = static_cast<CFDataRef>(TISGetInputSourceProperty( 49 CFDataRef layout_data = static_cast<CFDataRef>(TISGetInputSourceProperty(
50 input_source_copy, kTISPropertyUnicodeKeyLayoutData)); 50 input_source_copy, kTISPropertyUnicodeKeyLayoutData));
51 51
52 UInt32 dead_key_state = 0; 52 UInt32 dead_key_state = 0;
53 UniCharCount char_count = 0; 53 UniCharCount char_count = 0;
54 UniChar character = 0; 54 UniChar character = 0;
55 OSStatus status = UCKeyTranslate( 55 OSStatus status = UCKeyTranslate(
56 reinterpret_cast<const UCKeyboardLayout*>(CFDataGetBytePtr(layout_data)), 56 reinterpret_cast<const UCKeyboardLayout*>(CFDataGetBytePtr(layout_data)),
57 static_cast<UInt16>(mac_key_code), 57 static_cast<UInt16>(mac_key_code),
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 *necessary_modifiers = kShiftKeyModifierMask; 103 *necessary_modifiers = kShiftKeyModifierMask;
104 found_code = true; 104 found_code = true;
105 } 105 }
106 if (found_code) { 106 if (found_code) {
107 *key_code = code; 107 *key_code = code;
108 break; 108 break;
109 } 109 }
110 } 110 }
111 return found_code; 111 return found_code;
112 } 112 }
OLDNEW
« no previous file with comments | « chrome/service/chrome_service_application_mac.mm ('k') | chrome/test/chromedriver/test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698