Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / base / ime / input_method_auralinux.h
blobc1076b6d218e81c36cc3ef4e684ffcbb7605f059
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 void Init(bool focused) override;
29 bool OnUntranslatedIMEMessage(const base::NativeEvent& event,
30 NativeEventResult* result) override;
31 bool DispatchKeyEvent(const ui::KeyEvent& event) override;
32 void OnTextInputTypeChanged(const TextInputClient* client) override;
33 void OnCaretBoundsChanged(const TextInputClient* client) override;
34 void CancelComposition(const TextInputClient* client) override;
35 void OnInputLocaleChanged() override;
36 std::string GetInputLocale() override;
37 bool IsActive() override;
38 bool IsCandidatePopupOpen() const override;
39 void OnFocus() override;
40 void OnBlur() override;
42 // Overriden from ui::LinuxInputMethodContextDelegate
43 void OnCommit(const base::string16& text) override;
44 void OnPreeditChanged(const CompositionText& composition_text) override;
45 void OnPreeditEnd() override;
46 void OnPreeditStart() override{};
48 protected:
49 // Overridden from InputMethodBase.
50 void OnWillChangeFocusedClient(TextInputClient* focused_before,
51 TextInputClient* focused) override;
52 void OnDidChangeFocusedClient(TextInputClient* focused_before,
53 TextInputClient* focused) override;
55 private:
56 bool HasInputMethodResult();
57 bool NeedInsertChar() const;
58 void SendFakeProcessKeyEvent(int flags) const;
59 void ConfirmCompositionText();
60 void UpdateContextFocusState();
61 void ResetContext();
63 scoped_ptr<LinuxInputMethodContext> context_;
64 scoped_ptr<LinuxInputMethodContext> context_simple_;
66 base::string16 result_text_;
68 ui::CompositionText composition_;
70 // The current text input type used to indicates if |context_| and
71 // |context_simple_| are focused or not.
72 TextInputType text_input_type_;
74 // Indicates if currently in sync mode when handling a key event.
75 // This is used in OnXXX callbacks from GTK IM module.
76 bool is_sync_mode_;
78 // Indicates if the composition text is changed or deleted.
79 bool composition_changed_;
81 // If it's true then all input method result received before the next key
82 // event will be discarded.
83 bool suppress_next_result_;
85 DISALLOW_COPY_AND_ASSIGN(InputMethodAuraLinux);
88 } // namespace ui
90 #endif // UI_BASE_IME_INPUT_METHOD_AURALINUX_H_