OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "ui/base/ime/chromeos/ime_keyboard.h" | 8 #include "ui/base/ime/chromeos/ime_keyboard.h" |
9 | 9 |
10 namespace chromeos { | 10 namespace chromeos { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 } | 68 } |
69 | 69 |
70 void ImeKeyboard::AddObserver(Observer* observer) { | 70 void ImeKeyboard::AddObserver(Observer* observer) { |
71 observers_.AddObserver(observer); | 71 observers_.AddObserver(observer); |
72 } | 72 } |
73 | 73 |
74 void ImeKeyboard::RemoveObserver(Observer* observer) { | 74 void ImeKeyboard::RemoveObserver(Observer* observer) { |
75 observers_.RemoveObserver(observer); | 75 observers_.RemoveObserver(observer); |
76 } | 76 } |
77 | 77 |
78 bool ImeKeyboard::SetCurrentKeyboardLayoutByName( | |
79 const std::string& layout_name) { | |
80 for (ImeKeyboard::Observer& observer : observers_) { | |
reveman
2017/06/09 14:53:19
nit: no need for {}
jclinton
2017/06/09 16:36:03
Done.
| |
81 observer.OnLayoutChanged(layout_name); | |
82 } | |
83 | |
84 return true; | |
85 } | |
86 | |
78 void ImeKeyboard::SetCapsLockEnabled(bool enable_caps_lock) { | 87 void ImeKeyboard::SetCapsLockEnabled(bool enable_caps_lock) { |
79 bool old_state = caps_lock_is_enabled_; | 88 bool old_state = caps_lock_is_enabled_; |
80 caps_lock_is_enabled_ = enable_caps_lock; | 89 caps_lock_is_enabled_ = enable_caps_lock; |
81 if (old_state != enable_caps_lock) { | 90 if (old_state != enable_caps_lock) { |
82 for (ImeKeyboard::Observer& observer : observers_) | 91 for (ImeKeyboard::Observer& observer : observers_) |
83 observer.OnCapsLockChanged(enable_caps_lock); | 92 observer.OnCapsLockChanged(enable_caps_lock); |
84 } | 93 } |
85 } | 94 } |
86 | 95 |
87 bool ImeKeyboard::CapsLockIsEnabled() { | 96 bool ImeKeyboard::CapsLockIsEnabled() { |
(...skipping 11 matching lines...) Expand all Loading... | |
99 bool ImeKeyboard::IsAltGrAvailable() const { | 108 bool ImeKeyboard::IsAltGrAvailable() const { |
100 for (size_t i = 0; i < arraysize(kAltGrLayoutIds); ++i) { | 109 for (size_t i = 0; i < arraysize(kAltGrLayoutIds); ++i) { |
101 if (last_layout_ == kAltGrLayoutIds[i]) | 110 if (last_layout_ == kAltGrLayoutIds[i]) |
102 return true; | 111 return true; |
103 } | 112 } |
104 return false; | 113 return false; |
105 } | 114 } |
106 | 115 |
107 } // namespace input_method | 116 } // namespace input_method |
108 } // namespace chromeos | 117 } // namespace chromeos |
OLD | NEW |