| 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> |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 break; | 276 break; |
| 277 } | 277 } |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 XkbFreeKeyboard(xkb_desc, 0, True /* free all components */); | 280 XkbFreeKeyboard(xkb_desc, 0, True /* free all components */); |
| 281 return real_mask; | 281 return real_mask; |
| 282 } | 282 } |
| 283 | 283 |
| 284 void XKeyboardImpl::GetLockedModifiers(bool* out_caps_lock_enabled, | 284 void XKeyboardImpl::GetLockedModifiers(bool* out_caps_lock_enabled, |
| 285 bool* out_num_lock_enabled) { | 285 bool* out_num_lock_enabled) { |
| 286 // For now, don't call CHECK() here to make | 286 // The method might be called by browser_tests running on Linux. |
| 287 // TabRestoreServiceTest.DontRestorePrintPreviewTab test happy. | 287 if (!is_running_on_chrome_os_ || (out_num_lock_enabled && !num_lock_mask_)) { |
| 288 // TODO(yusukes): Fix the test, then fix the if(!BrowserThread...) line below. | 288 VLOG(1) << "Cannot get locked modifiers."; |
| 289 // CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
| 290 | |
| 291 if (!BrowserThread::CurrentlyOn(BrowserThread::UI) || | |
| 292 (out_num_lock_enabled && !num_lock_mask_)) { | |
| 293 VLOG(1) << "Cannot get locked modifiers. Num Lock mask unknown."; | |
| 294 if (out_caps_lock_enabled) { | 289 if (out_caps_lock_enabled) { |
| 295 *out_caps_lock_enabled = false; | 290 *out_caps_lock_enabled = false; |
| 296 } | 291 } |
| 297 if (out_num_lock_enabled) { | 292 if (out_num_lock_enabled) { |
| 298 *out_num_lock_enabled = false; | 293 *out_num_lock_enabled = false; |
| 299 } | 294 } |
| 300 return; | 295 return; |
| 301 } | 296 } |
| 302 | 297 |
| 298 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 303 XkbStateRec status; | 299 XkbStateRec status; |
| 304 XkbGetState(ui::GetXDisplay(), XkbUseCoreKbd, &status); | 300 XkbGetState(ui::GetXDisplay(), XkbUseCoreKbd, &status); |
| 305 if (out_caps_lock_enabled) { | 301 if (out_caps_lock_enabled) { |
| 306 *out_caps_lock_enabled = status.locked_mods & LockMask; | 302 *out_caps_lock_enabled = status.locked_mods & LockMask; |
| 307 } | 303 } |
| 308 if (out_num_lock_enabled) { | 304 if (out_num_lock_enabled) { |
| 309 *out_num_lock_enabled = status.locked_mods & num_lock_mask_; | 305 *out_num_lock_enabled = status.locked_mods & num_lock_mask_; |
| 310 } | 306 } |
| 311 } | 307 } |
| 312 | 308 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 return false; | 551 return false; |
| 556 } | 552 } |
| 557 | 553 |
| 558 // static | 554 // static |
| 559 XKeyboard* XKeyboard::Create(const InputMethodUtil& util) { | 555 XKeyboard* XKeyboard::Create(const InputMethodUtil& util) { |
| 560 return new XKeyboardImpl(util); | 556 return new XKeyboardImpl(util); |
| 561 } | 557 } |
| 562 | 558 |
| 563 } // namespace input_method | 559 } // namespace input_method |
| 564 } // namespace chromeos | 560 } // namespace chromeos |
| OLD | NEW |