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

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

Issue 2831583005: Enable Config::MUS to use classic IME instead of servicified IME. (Closed)
Patch Set: Fix compile errors in non ChromeOS. Created 3 years, 8 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 | « no previous file | ui/aura/mus/input_method_mus.cc » ('j') | ui/aura/mus/window_tree_host_mus.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef UI_AURA_MUS_INPUT_METHOD_MUS_H_ 5 #ifndef UI_AURA_MUS_INPUT_METHOD_MUS_H_
6 #define UI_AURA_MUS_INPUT_METHOD_MUS_H_ 6 #define UI_AURA_MUS_INPUT_METHOD_MUS_H_
7 7
8 #include <deque> 8 #include <deque>
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/service_manager/public/cpp/connector.h" 12 #include "services/service_manager/public/cpp/connector.h"
13 #include "services/ui/public/interfaces/ime/ime.mojom.h" 13 #include "services/ui/public/interfaces/ime/ime.mojom.h"
14 #include "ui/aura/aura_export.h" 14 #include "ui/aura/aura_export.h"
15 #include "ui/base/ime/input_method_base.h" 15 #include "ui/base/ime/input_method_base.h"
16 16
17 namespace ui {
18 namespace mojom {
19 enum class EventResult;
20 }
21 }
22
23 namespace aura { 17 namespace aura {
24 18
25 class InputMethodMusTestApi; 19 class InputMethodMusTestApi;
26 class TextInputClientImpl; 20 class TextInputClientImpl;
27 class Window; 21 class Window;
28 22
29 class AURA_EXPORT InputMethodMus : public ui::InputMethodBase { 23 class AURA_EXPORT InputMethodMus : public ui::InputMethodBase {
30 public: 24 public:
31 using EventResultCallback = base::Callback<void(ui::mojom::EventResult)>; 25 using AckCallback = base::Callback<void(bool)>;
sky 2017/04/20 20:18:49 Is there a reason to remove the type? Having an ex
32 26
33 InputMethodMus(ui::internal::InputMethodDelegate* delegate, Window* window); 27 InputMethodMus(ui::internal::InputMethodDelegate* delegate, Window* window);
34 ~InputMethodMus() override; 28 ~InputMethodMus() override;
35 29
36 void Init(service_manager::Connector* connector); 30 void Init(service_manager::Connector* connector);
37 void DispatchKeyEvent(ui::KeyEvent* event, 31 void DispatchKeyEvent(ui::KeyEvent* event,
38 std::unique_ptr<EventResultCallback> ack_callback); 32 std::unique_ptr<AckCallback> ack_callback);
39 33
40 // Overridden from ui::InputMethod: 34 // Overridden from ui::InputMethod:
41 void OnFocus() override; 35 void OnFocus() override;
42 void OnBlur() override; 36 void OnBlur() override;
43 bool OnUntranslatedIMEMessage(const base::NativeEvent& event, 37 bool OnUntranslatedIMEMessage(const base::NativeEvent& event,
44 NativeEventResult* result) override; 38 NativeEventResult* result) override;
45 void DispatchKeyEvent(ui::KeyEvent* event) override; 39 void DispatchKeyEvent(ui::KeyEvent* event) override;
46 void OnTextInputTypeChanged(const ui::TextInputClient* client) override; 40 void OnTextInputTypeChanged(const ui::TextInputClient* client) override;
47 void OnCaretBoundsChanged(const ui::TextInputClient* client) override; 41 void OnCaretBoundsChanged(const ui::TextInputClient* client) override;
48 void CancelComposition(const ui::TextInputClient* client) override; 42 void CancelComposition(const ui::TextInputClient* client) override;
49 void OnInputLocaleChanged() override; 43 void OnInputLocaleChanged() override;
50 bool IsCandidatePopupOpen() const override; 44 bool IsCandidatePopupOpen() const override;
51 45
52 private: 46 private:
53 friend class InputMethodMusTestApi; 47 friend class InputMethodMusTestApi;
54 friend TextInputClientImpl; 48 friend TextInputClientImpl;
55 49
56 // Called from DispatchKeyEvent() to call to the InputMethod. 50 // Called from DispatchKeyEvent() to call to the InputMethod.
57 void SendKeyEventToInputMethod( 51 void SendKeyEventToInputMethod(const ui::KeyEvent& event,
58 const ui::KeyEvent& event, 52 std::unique_ptr<AckCallback> ack_callback);
59 std::unique_ptr<EventResultCallback> ack_callback);
60 53
61 // Overridden from ui::InputMethodBase: 54 // Overridden from ui::InputMethodBase:
62 void OnDidChangeFocusedClient(ui::TextInputClient* focused_before, 55 void OnDidChangeFocusedClient(ui::TextInputClient* focused_before,
63 ui::TextInputClient* focused) override; 56 ui::TextInputClient* focused) override;
64 57
65 void UpdateTextInputType(); 58 void UpdateTextInputType();
66 59
67 // Runs all pending callbacks with UNHANDLED. This is called during shutdown, 60 // Runs all pending callbacks with UNHANDLED. This is called during shutdown,
68 // or any time |input_method_ptr_| is reset to ensure we don't leave mus 61 // or any time |input_method_ptr_| is reset to ensure we don't leave mus
69 // waiting for an ack. 62 // waiting for an ack.
(...skipping 12 matching lines...) Expand all
82 ui::mojom::IMEServerPtr ime_server_; 75 ui::mojom::IMEServerPtr ime_server_;
83 ui::mojom::InputMethodPtr input_method_ptr_; 76 ui::mojom::InputMethodPtr input_method_ptr_;
84 // Typically this is the same as |input_method_ptr_|, but it may be mocked 77 // Typically this is the same as |input_method_ptr_|, but it may be mocked
85 // in tests. 78 // in tests.
86 ui::mojom::InputMethod* input_method_ = nullptr; 79 ui::mojom::InputMethod* input_method_ = nullptr;
87 std::unique_ptr<TextInputClientImpl> text_input_client_; 80 std::unique_ptr<TextInputClientImpl> text_input_client_;
88 81
89 // Callbacks supplied to DispatchKeyEvent() are added here while awaiting 82 // Callbacks supplied to DispatchKeyEvent() are added here while awaiting
90 // the response from the server. These are removed when the response is 83 // the response from the server. These are removed when the response is
91 // received (ProcessKeyEventCallback()). 84 // received (ProcessKeyEventCallback()).
92 std::deque<std::unique_ptr<EventResultCallback>> pending_callbacks_; 85 std::deque<std::unique_ptr<AckCallback>> pending_callbacks_;
93 86
94 DISALLOW_COPY_AND_ASSIGN(InputMethodMus); 87 DISALLOW_COPY_AND_ASSIGN(InputMethodMus);
95 }; 88 };
96 89
97 } // namespace aura 90 } // namespace aura
98 91
99 #endif // UI_AURA_MUS_INPUT_METHOD_MUS_H_ 92 #endif // UI_AURA_MUS_INPUT_METHOD_MUS_H_
OLDNEW
« no previous file with comments | « no previous file | ui/aura/mus/input_method_mus.cc » ('j') | ui/aura/mus/window_tree_host_mus.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698