| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/ime/test_ime_driver/test_ime_driver.h" | 5 #include "services/ui/ime/test_ime_driver/test_ime_driver.h" |
| 6 | 6 |
| 7 #include "services/ui/public/interfaces/ime/ime.mojom.h" | 7 #include "services/ui/public/interfaces/ime/ime.mojom.h" |
| 8 | 8 |
| 9 namespace ui { | 9 namespace ui { |
| 10 namespace test { | 10 namespace test { |
| 11 | 11 |
| 12 class TestInputMethod : public mojom::InputMethod { | 12 class TestInputMethod : public mojom::InputMethod { |
| 13 public: | 13 public: |
| 14 explicit TestInputMethod(mojom::TextInputClientPtr client) | 14 explicit TestInputMethod(mojom::TextInputClientPtr client) |
| 15 : client_(std::move(client)) {} | 15 : client_(std::move(client)) {} |
| 16 ~TestInputMethod() override {} | 16 ~TestInputMethod() override {} |
| 17 | 17 |
| 18 private: | 18 private: |
| 19 // mojom::InputMethod: | 19 // mojom::InputMethod: |
| 20 void OnTextInputModeChanged(TextInputMode text_input_mode) override {} | |
| 21 void OnTextInputTypeChanged(TextInputType text_input_type) override {} | 20 void OnTextInputTypeChanged(TextInputType text_input_type) override {} |
| 22 void OnCaretBoundsChanged(const gfx::Rect& caret_bounds) override {} | 21 void OnCaretBoundsChanged(const gfx::Rect& caret_bounds) override {} |
| 23 void ProcessKeyEvent(std::unique_ptr<Event> key_event, | 22 void ProcessKeyEvent(std::unique_ptr<Event> key_event, |
| 24 const ProcessKeyEventCallback& callback) override { | 23 const ProcessKeyEventCallback& callback) override { |
| 25 DCHECK(key_event->IsKeyEvent()); | 24 DCHECK(key_event->IsKeyEvent()); |
| 26 | 25 |
| 27 if (key_event->AsKeyEvent()->is_char()) { | 26 if (key_event->AsKeyEvent()->is_char()) { |
| 28 client_->InsertChar(std::move(key_event)); | 27 client_->InsertChar(std::move(key_event)); |
| 29 callback.Run(true); | 28 callback.Run(true); |
| 30 } else { | 29 } else { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 51 new TestInputMethod(std::move(client)), | 50 new TestInputMethod(std::move(client)), |
| 52 std::move(input_method_request))); | 51 std::move(input_method_request))); |
| 53 } | 52 } |
| 54 | 53 |
| 55 void TestIMEDriver::CancelSession(int32_t session_id) { | 54 void TestIMEDriver::CancelSession(int32_t session_id) { |
| 56 input_method_bindings_.erase(session_id); | 55 input_method_bindings_.erase(session_id); |
| 57 } | 56 } |
| 58 | 57 |
| 59 } // namespace test | 58 } // namespace test |
| 60 } // namespace ui | 59 } // namespace ui |
| OLD | NEW |