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

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

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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
(Empty)
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.
4
5 #ifndef UI_BASE_IME_INPUT_METHOD_AURALINUX_H_
6 #define UI_BASE_IME_INPUT_METHOD_AURALINUX_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/base/ime/input_method_base.h"
10 #include "ui/base/ime/linux/linux_input_method_context.h"
11
12 namespace ui {
13
14 // A ui::InputMethod implementation for Aura on Linux platforms. The
15 // implementation details are separated to ui::LinuxInputMethodContext
16 // interface.
17 class UI_BASE_EXPORT InputMethodAuraLinux
18 : public InputMethodBase,
19 public LinuxInputMethodContextDelegate {
20 public:
21 explicit InputMethodAuraLinux(internal::InputMethodDelegate* delegate);
22 virtual ~InputMethodAuraLinux();
23
24 // Overriden from InputMethod.
25 virtual void Init(bool focused) override;
26 virtual bool OnUntranslatedIMEMessage(const base::NativeEvent& event,
27 NativeEventResult* result) override;
28 virtual bool DispatchKeyEvent(const ui::KeyEvent& event) override;
29 virtual void OnTextInputTypeChanged(const TextInputClient* client) override;
30 virtual void OnCaretBoundsChanged(const TextInputClient* client) override;
31 virtual void CancelComposition(const TextInputClient* client) override;
32 virtual void OnInputLocaleChanged() override;
33 virtual std::string GetInputLocale() override;
34 virtual bool IsActive() override;
35 virtual bool IsCandidatePopupOpen() const override;
36
37 // Overriden from ui::LinuxInputMethodContextDelegate
38 virtual void OnCommit(const base::string16& text) override;
39 virtual void OnPreeditChanged(const CompositionText& composition_text)
40 override;
41 virtual void OnPreeditEnd() override;
42 virtual void OnPreeditStart() override;
43
44 protected:
45 // Overridden from InputMethodBase.
46 virtual void OnDidChangeFocusedClient(TextInputClient* focused_before,
47 TextInputClient* focused) override;
48
49 private:
50 // Allows to fire a VKEY_PROCESSKEY key event.
51 void AllowToFireProcessKey(const ui::KeyEvent& event);
52 // Fires a VKEY_PROCESSKEY key event if allowed.
53 void MaybeFireProcessKey();
54 // Stops firing VKEY_PROCESSKEY key events.
55 void StopFiringProcessKey();
56
57 scoped_ptr<LinuxInputMethodContext> input_method_context_;
58
59 // IBus in async mode eagerly consumes all the key events first regardless of
60 // whether the underlying IME consumes the key event or not, and makes
61 // gtk_im_context_filter_keypress() always return true, and later pushes
62 // the key event back to the GDK event queue when it turns out that the
63 // underlying IME doesn't consume the key event.
64 //
65 // Thus we have to defer a decision whether or not to dispatch a
66 // VKEY_PROCESSKEY key event. Unlike other InputMethod's subclasses,
67 // DispatchKeyEvent() in this class does not directly dispatch a
68 // VKEY_PROCESSKEY event, OnCommit or OnPreedit{Start,Changed,End} dispatch
69 // a VKEY_PROCESSKEY event instead.
70 //
71 // Because of this hack, there could be chances that we accidentally dispatch
72 // VKEY_PROCESSKEY events and other key events in out of order.
73 //
74 // |allowed_to_fire_vkey_process_key_| is used not to dispatch a
75 // VKEY_PROCESSKEY event twice for a single key event.
76 bool allowed_to_fire_vkey_process_key_;
77 int vkey_processkey_flags_;
78
79 DISALLOW_COPY_AND_ASSIGN(InputMethodAuraLinux);
80 };
81
82 } // namespace ui
83
84 #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