Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2203)

Unified Diff: ash/system/chromeos/tray_caps_lock.cc

Issue 231753002: Fixing caps lock problems under ChromeOS where the tray does not properly follow the real caps lock… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/system/chromeos/tray_caps_lock.cc
diff --git a/ash/system/chromeos/tray_caps_lock.cc b/ash/system/chromeos/tray_caps_lock.cc
index 7142a8ecb54e6c52d03a07bc19502e73bd3bcab9..9f4ad87653b1c50c45d2b52ece679bdc9d2ab090 100644
--- a/ash/system/chromeos/tray_caps_lock.cc
+++ b/ash/system/chromeos/tray_caps_lock.cc
@@ -129,24 +129,27 @@ TrayCapsLock::TrayCapsLock(SystemTray* system_tray)
detailed_(NULL),
caps_lock_enabled_(CapsLockIsEnabled()),
message_shown_(false) {
- // Make sure the event is processed by this before the IME.
- Shell::GetInstance()->PrependPreTargetHandler(this);
+ chromeos::input_method::XKeyboard* xkeyboard =
+ chromeos::input_method::InputMethodManager::Get()->GetXKeyboard();
+ xkeyboard->AddObserver(this);
}
TrayCapsLock::~TrayCapsLock() {
- Shell::GetInstance()->RemovePreTargetHandler(this);
+ chromeos::input_method::XKeyboard* xkeyboard =
+ chromeos::input_method::InputMethodManager::Get()->GetXKeyboard();
+ xkeyboard->RemoveObserver(this);
}
-void TrayCapsLock::OnCapsLockChanged(bool enabled) {
- if (tray_view())
- tray_view()->SetVisible(enabled);
+void TrayCapsLock::OnCapsLockChanged() {
+ caps_lock_enabled_ = !caps_lock_enabled_;
Daniel Erat 2014/04/09 20:27:00 i don't like this -- it seems like it's too easy t
Mr4D (OOO till 08-26) 2014/04/09 23:27:02 Done!
- caps_lock_enabled_ = enabled;
+ if (tray_view())
+ tray_view()->SetVisible(caps_lock_enabled_);
if (default_) {
- default_->Update(enabled);
+ default_->Update(caps_lock_enabled_);
} else {
- if (enabled) {
+ if (caps_lock_enabled_) {
if (!message_shown_) {
Shell::GetInstance()->metrics()->RecordUserMetricsAction(
ash::UMA_STATUS_AREA_CAPS_LOCK_POPUP);
@@ -159,11 +162,6 @@ void TrayCapsLock::OnCapsLockChanged(bool enabled) {
}
}
-void TrayCapsLock::OnKeyEvent(ui::KeyEvent* key) {
- if (key->type() == ui::ET_KEY_PRESSED && key->key_code() == ui::VKEY_CAPITAL)
- OnCapsLockChanged(!caps_lock_enabled_);
-}
-
bool TrayCapsLock::GetInitialVisibility() {
return CapsLockIsEnabled();
}

Powered by Google App Engine
This is Rietveld 408576698