Chromium Code Reviews| Index: chrome/browser/ui/ash/caps_lock_handler.cc |
| diff --git a/chrome/browser/ui/ash/caps_lock_handler.cc b/chrome/browser/ui/ash/caps_lock_handler.cc |
| index 8da9ad4ed6ce3325a855ad6815232233c29c1517..6c709bd9becce786262cf5c6444bfd1171e54594 100644 |
| --- a/chrome/browser/ui/ash/caps_lock_handler.cc |
| +++ b/chrome/browser/ui/ash/caps_lock_handler.cc |
| @@ -37,12 +37,11 @@ CapsLockHandler::~CapsLockHandler() { |
| #endif |
| } |
| -bool CapsLockHandler::HandleToggleCapsLock() { |
| +bool CapsLockHandler::IsCapsLockEnabled() { |
| #if defined(OS_CHROMEOS) |
| DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| if (is_running_on_chromeos_) { |
| - xkeyboard_->SetCapsLockEnabled(!caps_lock_is_on_); |
| - return true; // consume the shortcut key. |
| + return xkeyboard_->CapsLockIsEnabled(); |
|
Daniel Erat
2012/08/26 22:32:47
should you just be returning caps_lock_is_on_ here
mazda
2012/08/27 16:06:40
It seems better. Thanks.
|
| } |
| #else |
| NOTIMPLEMENTED(); |
| @@ -50,6 +49,30 @@ bool CapsLockHandler::HandleToggleCapsLock() { |
| return false; |
| } |
| +void CapsLockHandler::SetCapsLockEnabled(bool enabled) { |
| +#if defined(OS_CHROMEOS) |
| + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| + if (is_running_on_chromeos_) { |
| + xkeyboard_->SetCapsLockEnabled(enabled); |
| + return; |
| + } |
| +#else |
| + NOTIMPLEMENTED(); |
| +#endif |
| +} |
| + |
| +void CapsLockHandler::ToggleCapsLock() { |
| +#if defined(OS_CHROMEOS) |
| + DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| + if (is_running_on_chromeos_) { |
| + xkeyboard_->SetCapsLockEnabled(!caps_lock_is_on_); |
| + return; |
| + } |
| +#else |
| + NOTIMPLEMENTED(); |
| +#endif |
| +} |
| + |
| #if defined(OS_CHROMEOS) |
| void CapsLockHandler::OnCapsLockChange(bool enabled) { |
| caps_lock_is_on_ = enabled; |