| OLD | NEW |
| 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 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 5 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 #include <cstring> | 8 #include <cstring> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/chromeos/chromeos_version.h" |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/process_util.h" | 16 #include "base/process_util.h" |
| 16 #include "base/string_util.h" | 17 #include "base/string_util.h" |
| 17 #include "base/stringprintf.h" | 18 #include "base/stringprintf.h" |
| 18 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 19 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
| 19 #include "chrome/browser/chromeos/input_method/xkeyboard_data.h" | 20 #include "chrome/browser/chromeos/input_method/xkeyboard_data.h" |
| 20 #include "chrome/browser/chromeos/system/runtime_environment.h" | |
| 21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "ui/base/x/x11_util.h" | 22 #include "ui/base/x/x11_util.h" |
| 23 | 23 |
| 24 // These includes conflict with base/tracked_objects.h so must come last. | 24 // These includes conflict with base/tracked_objects.h so must come last. |
| 25 #include <X11/XKBlib.h> | 25 #include <X11/XKBlib.h> |
| 26 #include <X11/Xlib.h> | 26 #include <X11/Xlib.h> |
| 27 #include <glib.h> | 27 #include <glib.h> |
| 28 | 28 |
| 29 using content::BrowserThread; | 29 using content::BrowserThread; |
| 30 | 30 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // A queue for executing setxkbmap one by one. | 120 // A queue for executing setxkbmap one by one. |
| 121 std::queue<std::string> execute_queue_; | 121 std::queue<std::string> execute_queue_; |
| 122 | 122 |
| 123 std::set<std::string> keep_right_alt_xkb_layout_names_; | 123 std::set<std::string> keep_right_alt_xkb_layout_names_; |
| 124 std::set<std::string> caps_lock_remapped_xkb_layout_names_; | 124 std::set<std::string> caps_lock_remapped_xkb_layout_names_; |
| 125 | 125 |
| 126 DISALLOW_COPY_AND_ASSIGN(XKeyboardImpl); | 126 DISALLOW_COPY_AND_ASSIGN(XKeyboardImpl); |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 XKeyboardImpl::XKeyboardImpl(const InputMethodUtil& util) | 129 XKeyboardImpl::XKeyboardImpl(const InputMethodUtil& util) |
| 130 : is_running_on_chrome_os_( | 130 : is_running_on_chrome_os_(base::chromeos::IsRunningOnChromeOS()) { |
| 131 system::runtime_environment::IsRunningOnChromeOS()) { | |
| 132 num_lock_mask_ = GetNumLockMask(); | 131 num_lock_mask_ = GetNumLockMask(); |
| 133 | 132 |
| 134 #if defined(USE_AURA) | 133 #if defined(USE_AURA) |
| 135 // web_input_event_aurax11.cc seems to assume that Mod2Mask is always assigned | 134 // web_input_event_aurax11.cc seems to assume that Mod2Mask is always assigned |
| 136 // to Num Lock. | 135 // to Num Lock. |
| 137 // TODO(yusukes): Check the assumption is really okay. If not, modify the Aura | 136 // TODO(yusukes): Check the assumption is really okay. If not, modify the Aura |
| 138 // code, and then remove the CHECK below. | 137 // code, and then remove the CHECK below. |
| 139 CHECK(!is_running_on_chrome_os_ || (num_lock_mask_ == Mod2Mask)); | 138 CHECK(!is_running_on_chrome_os_ || (num_lock_mask_ == Mod2Mask)); |
| 140 #endif | 139 #endif |
| 141 | 140 |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 return false; | 568 return false; |
| 570 } | 569 } |
| 571 | 570 |
| 572 // static | 571 // static |
| 573 XKeyboard* XKeyboard::Create(const InputMethodUtil& util) { | 572 XKeyboard* XKeyboard::Create(const InputMethodUtil& util) { |
| 574 return new XKeyboardImpl(util); | 573 return new XKeyboardImpl(util); |
| 575 } | 574 } |
| 576 | 575 |
| 577 } // namespace input_method | 576 } // namespace input_method |
| 578 } // namespace chromeos | 577 } // namespace chromeos |
| OLD | NEW |