| OLD | NEW |
| 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/test_util.h" | 5 #include "chrome/test/chromedriver/test_util.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "build/build_config.h" |
| 9 | 10 |
| 10 RestoreKeyboardLayoutOnDestruct::RestoreKeyboardLayoutOnDestruct() { | 11 RestoreKeyboardLayoutOnDestruct::RestoreKeyboardLayoutOnDestruct() { |
| 11 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
| 12 layout_ = GetKeyboardLayout(NULL); | 13 layout_ = GetKeyboardLayout(NULL); |
| 13 #elif defined(OS_MACOSX) | 14 #elif defined(OS_MACOSX) |
| 14 layout_.reset(TISCopyCurrentKeyboardInputSource()); | 15 layout_.reset(TISCopyCurrentKeyboardInputSource()); |
| 15 #elif defined(OS_LINUX) | 16 #elif defined(OS_LINUX) |
| 16 NOTIMPLEMENTED(); | 17 NOTIMPLEMENTED(); |
| 17 #endif | 18 #endif |
| 18 } | 19 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 49 CFDictionaryAddValue(filter_dict, kTISPropertyInputSourceID, id_ref); | 50 CFDictionaryAddValue(filter_dict, kTISPropertyInputSourceID, id_ref); |
| 50 base::ScopedCFTypeRef<CFArrayRef> sources( | 51 base::ScopedCFTypeRef<CFArrayRef> sources( |
| 51 TISCreateInputSourceList(filter_dict, true)); | 52 TISCreateInputSourceList(filter_dict, true)); |
| 52 if (CFArrayGetCount(sources) != 1) | 53 if (CFArrayGetCount(sources) != 1) |
| 53 return false; | 54 return false; |
| 54 TISInputSourceRef source = (TISInputSourceRef)CFArrayGetValueAtIndex( | 55 TISInputSourceRef source = (TISInputSourceRef)CFArrayGetValueAtIndex( |
| 55 sources, 0); | 56 sources, 0); |
| 56 return TISSelectInputSource(source) == noErr; | 57 return TISSelectInputSource(source) == noErr; |
| 57 } | 58 } |
| 58 #endif // defined(OS_MACOSX) | 59 #endif // defined(OS_MACOSX) |
| OLD | NEW |