| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h" | 5 #include "ui/events/ozone/layout/xkb/xkb_keyboard_layout_engine.h" |
| 6 | 6 |
| 7 #include <xkbcommon/xkbcommon-names.h> | 7 #include <xkbcommon/xkbcommon-names.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 xkb_context_include_path_append(context.get(), "/usr/share/X11/xkb"); | 645 xkb_context_include_path_append(context.get(), "/usr/share/X11/xkb"); |
| 646 scoped_ptr<xkb_keymap, XkbKeymapDeleter> keymap; | 646 scoped_ptr<xkb_keymap, XkbKeymapDeleter> keymap; |
| 647 keymap.reset(xkb_keymap_new_from_names(context.get(), &names, | 647 keymap.reset(xkb_keymap_new_from_names(context.get(), &names, |
| 648 XKB_KEYMAP_COMPILE_NO_FLAGS)); | 648 XKB_KEYMAP_COMPILE_NO_FLAGS)); |
| 649 if (keymap) { | 649 if (keymap) { |
| 650 scoped_ptr<char, base::FreeDeleter> keymap_str( | 650 scoped_ptr<char, base::FreeDeleter> keymap_str( |
| 651 xkb_keymap_get_as_string(keymap.get(), XKB_KEYMAP_FORMAT_TEXT_V1)); | 651 xkb_keymap_get_as_string(keymap.get(), XKB_KEYMAP_FORMAT_TEXT_V1)); |
| 652 reply_runner->PostTask(FROM_HERE, base::Bind(reply_callback, layout_name, | 652 reply_runner->PostTask(FROM_HERE, base::Bind(reply_callback, layout_name, |
| 653 base::Passed(&keymap_str))); | 653 base::Passed(&keymap_str))); |
| 654 } else { | 654 } else { |
| 655 LOG(ERROR) << "Keymap file failed to load: " << layout_name; | 655 LOG(FATAL) << "Keymap file failed to load: " << layout_name; |
| 656 } | 656 } |
| 657 } | 657 } |
| 658 #endif | 658 #endif |
| 659 | 659 |
| 660 } // anonymous namespace | 660 } // anonymous namespace |
| 661 | 661 |
| 662 XkbKeyCodeConverter::XkbKeyCodeConverter() { | 662 XkbKeyCodeConverter::XkbKeyCodeConverter() { |
| 663 } | 663 } |
| 664 | 664 |
| 665 XkbKeyCodeConverter::~XkbKeyCodeConverter() { | 665 XkbKeyCodeConverter::~XkbKeyCodeConverter() { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 scoped_ptr<char, base::FreeDeleter> keymap_str) { | 723 scoped_ptr<char, base::FreeDeleter> keymap_str) { |
| 724 if (keymap_str) { | 724 if (keymap_str) { |
| 725 xkb_keymap* keymap = xkb_map_new_from_string( | 725 xkb_keymap* keymap = xkb_map_new_from_string( |
| 726 xkb_context_.get(), keymap_str.get(), XKB_KEYMAP_FORMAT_TEXT_V1, | 726 xkb_context_.get(), keymap_str.get(), XKB_KEYMAP_FORMAT_TEXT_V1, |
| 727 XKB_KEYMAP_COMPILE_NO_FLAGS); | 727 XKB_KEYMAP_COMPILE_NO_FLAGS); |
| 728 XkbKeymapEntry entry = {layout_name, keymap}; | 728 XkbKeymapEntry entry = {layout_name, keymap}; |
| 729 xkb_keymaps_.push_back(entry); | 729 xkb_keymaps_.push_back(entry); |
| 730 if (layout_name == current_layout_name_) | 730 if (layout_name == current_layout_name_) |
| 731 SetKeymap(keymap); | 731 SetKeymap(keymap); |
| 732 } else { | 732 } else { |
| 733 LOG(ERROR) << "Keymap file failed to load: " << layout_name; | 733 LOG(FATAL) << "Keymap file failed to load: " << layout_name; |
| 734 } | 734 } |
| 735 } | 735 } |
| 736 | 736 |
| 737 bool XkbKeyboardLayoutEngine::UsesISOLevel5Shift() const { | 737 bool XkbKeyboardLayoutEngine::UsesISOLevel5Shift() const { |
| 738 // NOTIMPLEMENTED(); | 738 // NOTIMPLEMENTED(); |
| 739 return false; | 739 return false; |
| 740 } | 740 } |
| 741 | 741 |
| 742 bool XkbKeyboardLayoutEngine::UsesAltGr() const { | 742 bool XkbKeyboardLayoutEngine::UsesAltGr() const { |
| 743 // NOTIMPLEMENTED(); | 743 // NOTIMPLEMENTED(); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 if (close_index == std::string::npos) | 956 if (close_index == std::string::npos) |
| 957 close_index = layout_name.size(); | 957 close_index = layout_name.size(); |
| 958 *layout_variant = layout_name.substr(parentheses_index + 1, | 958 *layout_variant = layout_name.substr(parentheses_index + 1, |
| 959 close_index - parentheses_index - 1); | 959 close_index - parentheses_index - 1); |
| 960 } else if (dash_index != std::string::npos) { | 960 } else if (dash_index != std::string::npos) { |
| 961 *layout_id = layout_name.substr(0, dash_index); | 961 *layout_id = layout_name.substr(0, dash_index); |
| 962 *layout_variant = layout_name.substr(dash_index + 1); | 962 *layout_variant = layout_name.substr(dash_index + 1); |
| 963 } | 963 } |
| 964 } | 964 } |
| 965 } // namespace ui | 965 } // namespace ui |
| OLD | NEW |