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

Unified Diff: chromeos/ime/xkeyboard.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
« chromeos/ime/fake_xkeyboard.h ('K') | « chromeos/ime/xkeyboard.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/ime/xkeyboard.cc
diff --git a/chromeos/ime/xkeyboard.cc b/chromeos/ime/xkeyboard.cc
index b2f55f14443e77a403ce47d27889b11c3a7fc658..7747ce0736ee3585197951213d38ce7513556f98 100644
--- a/chromeos/ime/xkeyboard.cc
+++ b/chromeos/ime/xkeyboard.cc
@@ -117,6 +117,10 @@ class XKeyboardImpl : public XKeyboard {
XKeyboardImpl();
virtual ~XKeyboardImpl() {}
+ // Adds/removes observer.
+ virtual void AddObserver(Observer* observer) OVERRIDE;
+ virtual void RemoveObserver(Observer* observer) OVERRIDE;
+
// Overridden from XKeyboard:
virtual bool SetCurrentKeyboardLayoutByName(
const std::string& layout_name) OVERRIDE;
@@ -169,6 +173,8 @@ class XKeyboardImpl : public XKeyboard {
base::WeakPtrFactory<XKeyboardImpl> weak_factory_;
+ ObserverList<Observer> observers_;
+
DISALLOW_COPY_AND_ASSIGN(XKeyboardImpl);
};
@@ -193,6 +199,14 @@ XKeyboardImpl::XKeyboardImpl()
current_caps_lock_status_ = CapsLockIsEnabled();
}
+void XKeyboardImpl::AddObserver(XKeyboard::Observer* observer) {
+ observers_.AddObserver(observer);
+}
+
+void XKeyboardImpl::RemoveObserver(XKeyboard::Observer* observer) {
+ observers_.RemoveObserver(observer);
+}
+
unsigned int XKeyboardImpl::GetNumLockMask() {
DCHECK(thread_checker_.CalledOnValidThread());
static const unsigned int kBadMask = 0;
@@ -378,6 +392,9 @@ bool XKeyboardImpl::SetAutoRepeatRate(const AutoRepeatRate& rate) {
}
void XKeyboardImpl::SetCapsLockEnabled(bool enable_caps_lock) {
+ if (current_caps_lock_status_ != enable_caps_lock)
+ FOR_EACH_OBSERVER(XKeyboard::Observer, observers_,
+ OnCapsLockChanged());
SetLockedModifiers(enable_caps_lock);
}
« chromeos/ime/fake_xkeyboard.h ('K') | « chromeos/ime/xkeyboard.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698