1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/base/ime/chromeos/ime_keyboard.h"
8 namespace input_method
{
11 const char *kISOLevel5ShiftLayoutIds
[] = {
16 const char *kAltGrLayoutIds
[] = {
60 ImeKeyboard::ImeKeyboard()
61 : caps_lock_is_enabled_(false) {
64 ImeKeyboard::~ImeKeyboard() {
67 void ImeKeyboard::AddObserver(Observer
* observer
) {
68 observers_
.AddObserver(observer
);
71 void ImeKeyboard::RemoveObserver(Observer
* observer
) {
72 observers_
.RemoveObserver(observer
);
75 void ImeKeyboard::SetCapsLockEnabled(bool enable_caps_lock
) {
76 bool old_state
= caps_lock_is_enabled_
;
77 caps_lock_is_enabled_
= enable_caps_lock
;
78 if (old_state
!= enable_caps_lock
) {
79 FOR_EACH_OBSERVER(ImeKeyboard::Observer
, observers_
,
80 OnCapsLockChanged(enable_caps_lock
));
84 bool ImeKeyboard::CapsLockIsEnabled() {
85 return caps_lock_is_enabled_
;
88 bool ImeKeyboard::IsISOLevel5ShiftAvailable() const {
89 for (size_t i
= 0; i
< arraysize(kISOLevel5ShiftLayoutIds
); ++i
) {
90 if (last_layout_
== kISOLevel5ShiftLayoutIds
[i
])
96 bool ImeKeyboard::IsAltGrAvailable() const {
97 for (size_t i
= 0; i
< arraysize(kAltGrLayoutIds
); ++i
) {
98 if (last_layout_
== kAltGrLayoutIds
[i
])
104 } // namespace input_method
105 } // namespace chromeos