OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_TEST_MUS_INPUT_METHOD_MUS_TEST_API_H_ | 5 #ifndef UI_AURA_TEST_MUS_INPUT_METHOD_MUS_TEST_API_H_ |
6 #define UI_AURA_TEST_MUS_INPUT_METHOD_MUS_TEST_API_H_ | 6 #define UI_AURA_TEST_MUS_INPUT_METHOD_MUS_TEST_API_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/aura/mus/input_method_mus.h" | 9 #include "ui/aura/mus/input_method_mus.h" |
10 | 10 |
11 namespace aura { | 11 namespace aura { |
12 | 12 |
13 class InputMethodMusTestApi { | 13 class InputMethodMusTestApi { |
14 public: | 14 public: |
15 static void SetInputMethod(InputMethodMus* input_method_mus, | 15 static void SetInputMethod(InputMethodMus* input_method_mus, |
16 ui::mojom::InputMethod* input_method) { | 16 ui::mojom::InputMethod* input_method) { |
17 input_method_mus->input_method_ = input_method; | 17 input_method_mus->input_method_ = input_method; |
18 } | 18 } |
19 | 19 |
20 static void CallSendKeyEventToInputMethod( | 20 static void CallSendKeyEventToInputMethod( |
21 InputMethodMus* input_method_mus, | 21 InputMethodMus* input_method_mus, |
22 const ui::KeyEvent& event, | 22 const ui::KeyEvent& event, |
23 std::unique_ptr<InputMethodMus::EventResultCallback> ack_callback) { | 23 std::unique_ptr<InputMethodMus::AckCallback> ack_callback) { |
24 input_method_mus->SendKeyEventToInputMethod(event, std::move(ack_callback)); | 24 input_method_mus->SendKeyEventToInputMethod(event, std::move(ack_callback)); |
25 } | 25 } |
26 | 26 |
27 static void Disable(InputMethodMus* input_method) { | 27 static void Disable(InputMethodMus* input_method) { |
28 DCHECK(input_method->pending_callbacks_.empty()); | 28 DCHECK(input_method->pending_callbacks_.empty()); |
29 input_method->ime_server_.reset(); | 29 input_method->ime_server_.reset(); |
30 } | 30 } |
31 | 31 |
32 static void CallOnDidChangeFocusedClient(InputMethodMus* input_method, | 32 static void CallOnDidChangeFocusedClient(InputMethodMus* input_method, |
33 ui::TextInputClient* focused_before, | 33 ui::TextInputClient* focused_before, |
34 ui::TextInputClient* focused) { | 34 ui::TextInputClient* focused) { |
35 input_method->OnDidChangeFocusedClient(focused_before, focused); | 35 input_method->OnDidChangeFocusedClient(focused_before, focused); |
36 } | 36 } |
37 | 37 |
38 private: | 38 private: |
39 DISALLOW_IMPLICIT_CONSTRUCTORS(InputMethodMusTestApi); | 39 DISALLOW_IMPLICIT_CONSTRUCTORS(InputMethodMusTestApi); |
40 }; | 40 }; |
41 | 41 |
42 } // namespace aura | 42 } // namespace aura |
43 | 43 |
44 #endif // UI_AURA_TEST_MUS_INPUT_METHOD_MUS_TEST_API_H_ | 44 #endif // UI_AURA_TEST_MUS_INPUT_METHOD_MUS_TEST_API_H_ |
OLD | NEW |