Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: ui/base/ime/input_method_auralinux.h

Issue 1257603006: Refactoring for the InputMethod & InputMethodDelegate interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed Sadrul's comment. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/base/ime/input_method.h ('k') | ui/base/ime/input_method_auralinux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 #ifndef UI_BASE_IME_INPUT_METHOD_AURALINUX_H_ 5 #ifndef UI_BASE_IME_INPUT_METHOD_AURALINUX_H_
6 #define UI_BASE_IME_INPUT_METHOD_AURALINUX_H_ 6 #define UI_BASE_IME_INPUT_METHOD_AURALINUX_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "ui/base/ime/composition_text.h" 9 #include "ui/base/ime/composition_text.h"
10 #include "ui/base/ime/input_method_base.h" 10 #include "ui/base/ime/input_method_base.h"
11 #include "ui/base/ime/linux/linux_input_method_context.h" 11 #include "ui/base/ime/linux/linux_input_method_context.h"
12 12
13 namespace ui { 13 namespace ui {
14 14
15 // A ui::InputMethod implementation for Aura on Linux platforms. The 15 // A ui::InputMethod implementation for Aura on Linux platforms. The
16 // implementation details are separated to ui::LinuxInputMethodContext 16 // implementation details are separated to ui::LinuxInputMethodContext
17 // interface. 17 // interface.
18 class UI_BASE_IME_EXPORT InputMethodAuraLinux 18 class UI_BASE_IME_EXPORT InputMethodAuraLinux
19 : public InputMethodBase, 19 : public InputMethodBase,
20 public LinuxInputMethodContextDelegate { 20 public LinuxInputMethodContextDelegate {
21 public: 21 public:
22 explicit InputMethodAuraLinux(internal::InputMethodDelegate* delegate); 22 explicit InputMethodAuraLinux(internal::InputMethodDelegate* delegate);
23 ~InputMethodAuraLinux() override; 23 ~InputMethodAuraLinux() override;
24 24
25 LinuxInputMethodContext* GetContextForTesting(bool is_simple); 25 LinuxInputMethodContext* GetContextForTesting(bool is_simple);
26 26
27 // Overriden from InputMethod. 27 // Overriden from InputMethod.
28 bool OnUntranslatedIMEMessage(const base::NativeEvent& event, 28 bool OnUntranslatedIMEMessage(const base::NativeEvent& event,
29 NativeEventResult* result) override; 29 NativeEventResult* result) override;
30 bool DispatchKeyEvent(const ui::KeyEvent& event) override; 30 void DispatchKeyEvent(ui::KeyEvent* event) override;
31 void OnTextInputTypeChanged(const TextInputClient* client) override; 31 void OnTextInputTypeChanged(const TextInputClient* client) override;
32 void OnCaretBoundsChanged(const TextInputClient* client) override; 32 void OnCaretBoundsChanged(const TextInputClient* client) override;
33 void CancelComposition(const TextInputClient* client) override; 33 void CancelComposition(const TextInputClient* client) override;
34 void OnInputLocaleChanged() override; 34 void OnInputLocaleChanged() override;
35 std::string GetInputLocale() override; 35 std::string GetInputLocale() override;
36 bool IsCandidatePopupOpen() const override; 36 bool IsCandidatePopupOpen() const override;
37 void OnFocus() override; 37 void OnFocus() override;
38 void OnBlur() override; 38 void OnBlur() override;
39 39
40 // Overriden from ui::LinuxInputMethodContextDelegate 40 // Overriden from ui::LinuxInputMethodContextDelegate
41 void OnCommit(const base::string16& text) override; 41 void OnCommit(const base::string16& text) override;
42 void OnPreeditChanged(const CompositionText& composition_text) override; 42 void OnPreeditChanged(const CompositionText& composition_text) override;
43 void OnPreeditEnd() override; 43 void OnPreeditEnd() override;
44 void OnPreeditStart() override{}; 44 void OnPreeditStart() override{};
45 45
46 protected: 46 protected:
47 // Overridden from InputMethodBase. 47 // Overridden from InputMethodBase.
48 void OnWillChangeFocusedClient(TextInputClient* focused_before, 48 void OnWillChangeFocusedClient(TextInputClient* focused_before,
49 TextInputClient* focused) override; 49 TextInputClient* focused) override;
50 void OnDidChangeFocusedClient(TextInputClient* focused_before, 50 void OnDidChangeFocusedClient(TextInputClient* focused_before,
51 TextInputClient* focused) override; 51 TextInputClient* focused) override;
52 52
53 private: 53 private:
54 bool HasInputMethodResult(); 54 bool HasInputMethodResult();
55 bool NeedInsertChar() const; 55 bool NeedInsertChar() const;
56 bool SendFakeProcessKeyEvent(int flags) const; 56 ui::EventDispatchDetails SendFakeProcessKeyEvent(ui::KeyEvent* event) const;
57 void ConfirmCompositionText(); 57 void ConfirmCompositionText();
58 void UpdateContextFocusState(); 58 void UpdateContextFocusState();
59 void ResetContext(); 59 void ResetContext();
60 60
61 scoped_ptr<LinuxInputMethodContext> context_; 61 scoped_ptr<LinuxInputMethodContext> context_;
62 scoped_ptr<LinuxInputMethodContext> context_simple_; 62 scoped_ptr<LinuxInputMethodContext> context_simple_;
63 63
64 base::string16 result_text_; 64 base::string16 result_text_;
65 65
66 ui::CompositionText composition_; 66 ui::CompositionText composition_;
67 67
68 // The current text input type used to indicates if |context_| and 68 // The current text input type used to indicates if |context_| and
69 // |context_simple_| are focused or not. 69 // |context_simple_| are focused or not.
70 TextInputType text_input_type_; 70 TextInputType text_input_type_;
71 71
72 // Indicates if currently in sync mode when handling a key event. 72 // Indicates if currently in sync mode when handling a key event.
73 // This is used in OnXXX callbacks from GTK IM module. 73 // This is used in OnXXX callbacks from GTK IM module.
74 bool is_sync_mode_; 74 bool is_sync_mode_;
75 75
76 // Indicates if the composition text is changed or deleted. 76 // Indicates if the composition text is changed or deleted.
77 bool composition_changed_; 77 bool composition_changed_;
78 78
79 // If it's true then all input method result received before the next key 79 // If it's true then all input method result received before the next key
80 // event will be discarded. 80 // event will be discarded.
81 bool suppress_next_result_; 81 bool suppress_next_result_;
82 82
83 // The pointer to a boolean value which indicates whether this InputMethod
84 // instance is destroyed. This is used in DispatchKeyEvent to detect whether
85 // DispatchKeyEventPostIME will cause destruction of this InputMethod
86 // instance. See crbug.com/513917.
87 bool* destroyed_ptr_;
88
89 DISALLOW_COPY_AND_ASSIGN(InputMethodAuraLinux); 83 DISALLOW_COPY_AND_ASSIGN(InputMethodAuraLinux);
90 }; 84 };
91 85
92 } // namespace ui 86 } // namespace ui
93 87
94 #endif // UI_BASE_IME_INPUT_METHOD_AURALINUX_H_ 88 #endif // UI_BASE_IME_INPUT_METHOD_AURALINUX_H_
OLDNEW
« no previous file with comments | « ui/base/ime/input_method.h ('k') | ui/base/ime/input_method_auralinux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698