Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / base / ime / input_method_minimal.cc
blob9466c4044db88d1adac6caf5a0a663ada21d6ffe
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ui/base/ime/input_method_minimal.h"
7 #include "ui/base/ime/text_input_client.h"
8 #include "ui/events/event.h"
9 #include "ui/events/event_constants.h"
11 namespace ui {
13 InputMethodMinimal::InputMethodMinimal(
14 internal::InputMethodDelegate* delegate) {
15 SetDelegate(delegate);
18 InputMethodMinimal::~InputMethodMinimal() {}
20 bool InputMethodMinimal::OnUntranslatedIMEMessage(
21 const base::NativeEvent& event,
22 NativeEventResult* result) {
23 return false;
26 bool InputMethodMinimal::DispatchKeyEvent(const ui::KeyEvent& event) {
27 DCHECK(event.type() == ET_KEY_PRESSED || event.type() == ET_KEY_RELEASED);
29 // If no text input client, do nothing.
30 if (!GetTextInputClient())
31 return DispatchKeyEventPostIME(event);
33 // Insert the character.
34 const bool handled = DispatchKeyEventPostIME(event);
35 if (event.type() == ET_KEY_PRESSED && GetTextInputClient()) {
36 const uint16 ch = event.GetCharacter();
37 if (ch) {
38 GetTextInputClient()->InsertChar(ch, event.flags());
39 return true;
42 return handled;
45 void InputMethodMinimal::OnCaretBoundsChanged(const TextInputClient* client) {}
47 void InputMethodMinimal::CancelComposition(const TextInputClient* client) {}
49 void InputMethodMinimal::OnInputLocaleChanged() {}
51 std::string InputMethodMinimal::GetInputLocale() {
52 return std::string();
55 bool InputMethodMinimal::IsActive() {
56 return true;
59 bool InputMethodMinimal::IsCandidatePopupOpen() const {
60 return false;
63 } // namespace ui