| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_TEST_CHROMEDRIVER_TEST_UTIL_H_ | |
| 6 #define CHROME_TEST_CHROMEDRIVER_TEST_UTIL_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "build/build_config.h" | |
| 12 | |
| 13 #if defined(OS_WIN) | |
| 14 #include <windows.h> | |
| 15 #elif defined(OS_MACOSX) | |
| 16 #include <Carbon/Carbon.h> | |
| 17 #include "base/mac/scoped_cftyperef.h" | |
| 18 #endif | |
| 19 | |
| 20 // Restores the keyboard layout that was active at this object's creation | |
| 21 // when this object goes out of scope. | |
| 22 class RestoreKeyboardLayoutOnDestruct { | |
| 23 public: | |
| 24 RestoreKeyboardLayoutOnDestruct(); | |
| 25 ~RestoreKeyboardLayoutOnDestruct(); | |
| 26 | |
| 27 private: | |
| 28 #if defined(OS_WIN) | |
| 29 HKL layout_; | |
| 30 #elif defined(OS_MACOSX) | |
| 31 base::ScopedCFTypeRef<TISInputSourceRef> layout_; | |
| 32 #endif | |
| 33 | |
| 34 DISALLOW_COPY_AND_ASSIGN(RestoreKeyboardLayoutOnDestruct); | |
| 35 }; | |
| 36 | |
| 37 #if defined(OS_WIN) | |
| 38 // Loads and activates the given keyboard layout. |input_locale_identifier| | |
| 39 // is composed of a device and language ID. Returns true on success. | |
| 40 // See http://msdn.microsoft.com/en-us/library/dd318693(v=vs.85).aspx | |
| 41 // Example: "00000409" is the default en-us keyboard layout. | |
| 42 bool SwitchKeyboardLayout(const std::string& input_locale_identifier); | |
| 43 #endif // defined(OS_WIN) | |
| 44 | |
| 45 #if defined(OS_MACOSX) | |
| 46 // Selects the input source for the given input source ID. Returns true on | |
| 47 // success. | |
| 48 // Example: "com.apple.keyboardlayout.US" is the default en-us keyboard layout. | |
| 49 bool SwitchKeyboardLayout(const std::string& input_source_id); | |
| 50 #endif // defined(OS_MACOSX) | |
| 51 | |
| 52 #endif // CHROME_TEST_CHROMEDRIVER_TEST_UTIL_H_ | |
| OLD | NEW |