Revert of Fix missing GN dependencies. (patchset #4 id:60001 of https://codereview...
[chromium-blink-merge.git] / ui / base / ime / input_method_auralinux.h
blob34722217fec1ac7d8c66598ecae21f50bc780c4f
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 #ifndef UI_BASE_IME_INPUT_METHOD_AURALINUX_H_
6 #define UI_BASE_IME_INPUT_METHOD_AURALINUX_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/base/ime/composition_text.h"
10 #include "ui/base/ime/input_method_base.h"
11 #include "ui/base/ime/linux/linux_input_method_context.h"
13 namespace ui {
15 // A ui::InputMethod implementation for Aura on Linux platforms. The
16 // implementation details are separated to ui::LinuxInputMethodContext
17 // interface.
18 class UI_BASE_IME_EXPORT InputMethodAuraLinux
19 : public InputMethodBase,
20 public LinuxInputMethodContextDelegate {
21 public:
22 explicit InputMethodAuraLinux(internal::InputMethodDelegate* delegate);
23 ~InputMethodAuraLinux() override;
25 LinuxInputMethodContext* GetContextForTesting(bool is_simple);
27 // Overriden from InputMethod.
28 bool OnUntranslatedIMEMessage(const base::NativeEvent& event,
29 NativeEventResult* result) override;
30 bool DispatchKeyEvent(const ui::KeyEvent& event) override;
31 void OnTextInputTypeChanged(const TextInputClient* client) override;
32 void OnCaretBoundsChanged(const TextInputClient* client) override;
33 void CancelComposition(const TextInputClient* client) override;
34 void OnInputLocaleChanged() override;
35 std::string GetInputLocale() override;
36 bool IsActive() override;
37 bool IsCandidatePopupOpen() const override;
38 void OnFocus() override;
39 void OnBlur() override;
41 // Overriden from ui::LinuxInputMethodContextDelegate
42 void OnCommit(const base::string16& text) override;
43 void OnPreeditChanged(const CompositionText& composition_text) override;
44 void OnPreeditEnd() override;
45 void OnPreeditStart() override{};
47 protected:
48 // Overridden from InputMethodBase.
49 void OnWillChangeFocusedClient(TextInputClient* focused_before,
50 TextInputClient* focused) override;
51 void OnDidChangeFocusedClient(TextInputClient* focused_before,
52 TextInputClient* focused) override;
54 private:
55 bool HasInputMethodResult();
56 bool NeedInsertChar() const;
57 void SendFakeProcessKeyEvent(int flags) const;
58 void ConfirmCompositionText();
59 void UpdateContextFocusState();
60 void ResetContext();
62 scoped_ptr<LinuxInputMethodContext> context_;
63 scoped_ptr<LinuxInputMethodContext> context_simple_;
65 base::string16 result_text_;
67 ui::CompositionText composition_;
69 // The current text input type used to indicates if |context_| and
70 // |context_simple_| are focused or not.
71 TextInputType text_input_type_;
73 // Indicates if currently in sync mode when handling a key event.
74 // This is used in OnXXX callbacks from GTK IM module.
75 bool is_sync_mode_;
77 // Indicates if the composition text is changed or deleted.
78 bool composition_changed_;
80 // If it's true then all input method result received before the next key
81 // event will be discarded.
82 bool suppress_next_result_;
84 DISALLOW_COPY_AND_ASSIGN(InputMethodAuraLinux);
87 } // namespace ui
89 #endif // UI_BASE_IME_INPUT_METHOD_AURALINUX_H_