forked from sanyaade-mobiledev/chromium.src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathime_keyboard.cc
105 lines (91 loc) · 1.87 KB
/
ime_keyboard.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromeos/ime/ime_keyboard.h"
namespace chromeos {
namespace input_method {
namespace {
const char *kISOLevel5ShiftLayoutIds[] = {
"ca(multix)",
"de(neo)",
};
const char *kAltGrLayoutIds[] = {
"be",
"be",
"be",
"bg",
"bg(phonetic)",
"br",
"ca",
"ca(eng)",
"ca(multix)",
"ch",
"ch(fr)",
"cz",
"de",
"de(neo)",
"dk",
"ee",
"es",
"es(cat)",
"fi",
"fr",
"gb(dvorak)",
"gb(extd)",
"gr",
"hr",
"il",
"it",
"latam",
"lt",
"no",
"pl",
"pt",
"ro",
"se",
"si",
"sk",
"tr",
"ua",
"us(altgr-intl)",
"us(intl)",
};
} // namespace
ImeKeyboard::ImeKeyboard()
: caps_lock_is_enabled_(false) {
}
ImeKeyboard::~ImeKeyboard() {
}
void ImeKeyboard::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}
void ImeKeyboard::RemoveObserver(Observer* observer) {
observers_.RemoveObserver(observer);
}
void ImeKeyboard::SetCapsLockEnabled(bool enable_caps_lock) {
bool old_state = caps_lock_is_enabled_;
caps_lock_is_enabled_ = enable_caps_lock;
if (old_state != enable_caps_lock) {
FOR_EACH_OBSERVER(ImeKeyboard::Observer, observers_,
OnCapsLockChanged(enable_caps_lock));
}
}
bool ImeKeyboard::CapsLockIsEnabled() {
return caps_lock_is_enabled_;
}
bool ImeKeyboard::IsISOLevel5ShiftAvailable() const {
for (size_t i = 0; i < arraysize(kISOLevel5ShiftLayoutIds); ++i) {
if (last_layout_ == kISOLevel5ShiftLayoutIds[i])
return true;
}
return false;
}
bool ImeKeyboard::IsAltGrAvailable() const {
for (size_t i = 0; i < arraysize(kAltGrLayoutIds); ++i) {
if (last_layout_ == kAltGrLayoutIds[i])
return true;
}
return false;
}
} // namespace input_method
} // namespace chromeos