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

Side by Side Diff: ui/views/mus/input_method_mus.h

Issue 2412593002: IME for Mus: Send ack for key events after IME driver processes the event. (Closed)
Patch Set: Addressed feedback. Created 4 years, 2 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 #include "ui/base/ime/input_method_base.h" 5 #include "ui/base/ime/input_method_base.h"
6 6
7 #ifndef UI_VIEWS_MUS_INPUT_METHOD_MUS_H_ 7 #ifndef UI_VIEWS_MUS_INPUT_METHOD_MUS_H_
8 #define UI_VIEWS_MUS_INPUT_METHOD_MUS_H_ 8 #define UI_VIEWS_MUS_INPUT_METHOD_MUS_H_
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "mojo/public/cpp/bindings/strong_binding.h" 11 #include "mojo/public/cpp/bindings/strong_binding.h"
12 #include "services/shell/public/cpp/connector.h" 12 #include "services/shell/public/cpp/connector.h"
13 #include "services/ui/public/interfaces/ime.mojom.h" 13 #include "services/ui/public/interfaces/ime.mojom.h"
14 #include "ui/views/mus/mus_export.h" 14 #include "ui/views/mus/mus_export.h"
15 15
16 namespace ui { 16 namespace ui {
17 class Window; 17 class Window;
18 } // namespace mojo 18 namespace mojom {
19 enum class EventResult;
20 } // namespace mojom
21 } // namespace ui
19 22
20 namespace views { 23 namespace views {
21 24
22 class TextInputClientImpl; 25 class TextInputClientImpl;
23 26
24 class VIEWS_MUS_EXPORT InputMethodMus : public ui::InputMethodBase { 27 class VIEWS_MUS_EXPORT InputMethodMus : public ui::InputMethodBase {
25 public: 28 public:
26 InputMethodMus(ui::internal::InputMethodDelegate* delegate, 29 InputMethodMus(ui::internal::InputMethodDelegate* delegate,
27 ui::Window* window); 30 ui::Window* window);
28 ~InputMethodMus() override; 31 ~InputMethodMus() override;
29 32
30 void Init(shell::Connector* connector); 33 void Init(shell::Connector* connector);
31 34
32 // Overridden from ui::InputMethod: 35 // Overridden from ui::InputMethod:
33 void OnFocus() override; 36 void OnFocus() override;
34 void OnBlur() override; 37 void OnBlur() override;
35 bool OnUntranslatedIMEMessage(const base::NativeEvent& event, 38 bool OnUntranslatedIMEMessage(const base::NativeEvent& event,
36 NativeEventResult* result) override; 39 NativeEventResult* result) override;
37 void DispatchKeyEvent(ui::KeyEvent* event) override; 40 void DispatchKeyEvent(ui::KeyEvent* event) override;
38 void OnTextInputTypeChanged(const ui::TextInputClient* client) override; 41 void OnTextInputTypeChanged(const ui::TextInputClient* client) override;
39 void OnCaretBoundsChanged(const ui::TextInputClient* client) override; 42 void OnCaretBoundsChanged(const ui::TextInputClient* client) override;
40 void CancelComposition(const ui::TextInputClient* client) override; 43 void CancelComposition(const ui::TextInputClient* client) override;
41 void OnInputLocaleChanged() override; 44 void OnInputLocaleChanged() override;
42 bool IsCandidatePopupOpen() const override; 45 bool IsCandidatePopupOpen() const override;
43 46
47 void DispatchKeyEvent(
sky 2016/10/14 22:15:51 move above overrides?
48 ui::KeyEvent* event,
49 std::unique_ptr<base::Callback<void(ui::mojom::EventResult)>>
50 ack_callback);
51
44 private: 52 private:
45 friend TextInputClientImpl; 53 friend TextInputClientImpl;
46 54
47 // Overridden from ui::InputMethodBase: 55 // Overridden from ui::InputMethodBase:
48 void OnDidChangeFocusedClient(ui::TextInputClient* focused_before, 56 void OnDidChangeFocusedClient(ui::TextInputClient* focused_before,
49 ui::TextInputClient* focused) override; 57 ui::TextInputClient* focused) override;
50 58
51 void UpdateTextInputType(); 59 void UpdateTextInputType();
60 void ProcessKeyEventCallback(
61 const ui::KeyEvent& event,
62 std::unique_ptr<base::Callback<void(ui::mojom::EventResult)>>
63 ack_callback,
64 bool handled);
52 65
53 // The toplevel window which is not owned by this class. This may be null 66 // The toplevel window which is not owned by this class. This may be null
54 // for tests. 67 // for tests.
55 ui::Window* window_; 68 ui::Window* window_;
56 69
57 ui::mojom::IMEServerPtr ime_server_; 70 ui::mojom::IMEServerPtr ime_server_;
58 ui::mojom::InputMethodPtr input_method_; 71 ui::mojom::InputMethodPtr input_method_;
59 std::unique_ptr<TextInputClientImpl> text_input_client_; 72 std::unique_ptr<TextInputClientImpl> text_input_client_;
60 73
61 DISALLOW_COPY_AND_ASSIGN(InputMethodMus); 74 DISALLOW_COPY_AND_ASSIGN(InputMethodMus);
62 }; 75 };
63 76
64 } // namespace views 77 } // namespace views
65 78
66 #endif // UI_VIEWS_MUS_INPUT_METHOD_MUS_H_ 79 #endif // UI_VIEWS_MUS_INPUT_METHOD_MUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698