| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/base/ime/input_method_base.h" | 5 #include "ui/base/ime/input_method_base.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "ui/base/ime/ime_bridge.h" | 11 #include "ui/base/ime/ime_bridge.h" |
| 12 #include "ui/base/ime/input_method_delegate.h" | 12 #include "ui/base/ime/input_method_delegate.h" |
| 13 #include "ui/base/ime/input_method_observer.h" | 13 #include "ui/base/ime/input_method_observer.h" |
| 14 #include "ui/base/ime/text_input_client.h" | 14 #include "ui/base/ime/text_input_client.h" |
| 15 #include "ui/events/event.h" | 15 #include "ui/events/event.h" |
| 16 | 16 |
| 17 namespace ui { | 17 namespace ui { |
| 18 | 18 |
| 19 InputMethodBase::InputMethodBase() | 19 InputMethodBase::InputMethodBase() |
| 20 : delegate_(nullptr), text_input_client_(nullptr) {} | 20 : sending_key_event_(false), |
| 21 delegate_(nullptr), |
| 22 text_input_client_(nullptr) {} |
| 21 | 23 |
| 22 InputMethodBase::~InputMethodBase() { | 24 InputMethodBase::~InputMethodBase() { |
| 23 FOR_EACH_OBSERVER(InputMethodObserver, | 25 FOR_EACH_OBSERVER(InputMethodObserver, |
| 24 observer_list_, | 26 observer_list_, |
| 25 OnInputMethodDestroyed(this)); | 27 OnInputMethodDestroyed(this)); |
| 26 if (ui::IMEBridge::Get() && | 28 if (ui::IMEBridge::Get() && |
| 27 ui::IMEBridge::Get()->GetInputContextHandler() == this) | 29 ui::IMEBridge::Get()->GetInputContextHandler() == this) |
| 28 ui::IMEBridge::Get()->SetInputContextHandler(nullptr); | 30 ui::IMEBridge::Get()->SetInputContextHandler(nullptr); |
| 29 } | 31 } |
| 30 | 32 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 if (visible) | 190 if (visible) |
| 189 GetTextInputClient()->SetCompositionText(composition_); | 191 GetTextInputClient()->SetCompositionText(composition_); |
| 190 else | 192 else |
| 191 GetTextInputClient()->ClearCompositionText(); | 193 GetTextInputClient()->ClearCompositionText(); |
| 192 } | 194 } |
| 193 SendFakeProcessKeyEvent(false); | 195 SendFakeProcessKeyEvent(false); |
| 194 } | 196 } |
| 195 | 197 |
| 196 void InputMethodBase::DeleteSurroundingText(int32_t offset, uint32_t length) {} | 198 void InputMethodBase::DeleteSurroundingText(int32_t offset, uint32_t length) {} |
| 197 | 199 |
| 200 void InputMethodBase::SendKeyEvent(KeyEvent* event) { |
| 201 sending_key_event_ = true; |
| 202 DispatchKeyEvent(event); |
| 203 sending_key_event_ = false; |
| 204 } |
| 205 |
| 198 } // namespace ui | 206 } // namespace ui |
| OLD | NEW |