#include "ui/base/ime/input_method_minimal.h"
#include <stdint.h>
#include "ui/base/ime/text_input_client.h"
#include "ui/events/event.h"
#include "ui/events/types/event_type.h"
namespace ui {
InputMethodMinimal::InputMethodMinimal(
ImeKeyEventDispatcher* ime_key_event_dispatcher)
: InputMethodBase(ime_key_event_dispatcher) {}
InputMethodMinimal::~InputMethodMinimal() {}
ui::EventDispatchDetails InputMethodMinimal::DispatchKeyEvent(
ui::KeyEvent* event) {
DCHECK(event->type() == EventType::kKeyPressed ||
event->type() == EventType::kKeyReleased);
if (!GetTextInputClient())
return DispatchKeyEventPostIME(event);
ui::EventDispatchDetails dispatch_details = DispatchKeyEventPostIME(event);
if (!event->stopped_propagation() && !dispatch_details.dispatcher_destroyed &&
event->type() == EventType::kKeyPressed && GetTextInputClient()) {
const uint16_t ch = event->GetCharacter();
if (ch) {
GetTextInputClient()->InsertChar(*event);
event->StopPropagation();
}
}
return dispatch_details;
}
void InputMethodMinimal::OnCaretBoundsChanged(const TextInputClient* client) {}
void InputMethodMinimal::CancelComposition(const TextInputClient* client) {}
bool InputMethodMinimal::IsCandidatePopupOpen() const {
return false;
}
}