| 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_) |
| 81 observer.OnLayoutChanged(layout_name); |
| 82 return true; |
| 83 } |
| 84 |
| 78 void ImeKeyboard::SetCapsLockEnabled(bool enable_caps_lock) { | 85 void ImeKeyboard::SetCapsLockEnabled(bool enable_caps_lock) { |
| 79 bool old_state = caps_lock_is_enabled_; | 86 bool old_state = caps_lock_is_enabled_; |
| 80 caps_lock_is_enabled_ = enable_caps_lock; | 87 caps_lock_is_enabled_ = enable_caps_lock; |
| 81 if (old_state != enable_caps_lock) { | 88 if (old_state != enable_caps_lock) { |
| 82 for (ImeKeyboard::Observer& observer : observers_) | 89 for (ImeKeyboard::Observer& observer : observers_) |
| 83 observer.OnCapsLockChanged(enable_caps_lock); | 90 observer.OnCapsLockChanged(enable_caps_lock); |
| 84 } | 91 } |
| 85 } | 92 } |
| 86 | 93 |
| 87 bool ImeKeyboard::CapsLockIsEnabled() { | 94 bool ImeKeyboard::CapsLockIsEnabled() { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 99 bool ImeKeyboard::IsAltGrAvailable() const { | 106 bool ImeKeyboard::IsAltGrAvailable() const { |
| 100 for (size_t i = 0; i < arraysize(kAltGrLayoutIds); ++i) { | 107 for (size_t i = 0; i < arraysize(kAltGrLayoutIds); ++i) { |
| 101 if (last_layout_ == kAltGrLayoutIds[i]) | 108 if (last_layout_ == kAltGrLayoutIds[i]) |
| 102 return true; | 109 return true; |
| 103 } | 110 } |
| 104 return false; | 111 return false; |
| 105 } | 112 } |
| 106 | 113 |
| 107 } // namespace input_method | 114 } // namespace input_method |
| 108 } // namespace chromeos | 115 } // namespace chromeos |
| OLD | NEW |