| 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 "mojo/public/cpp/bindings/strong_binding.h" |
| 7 #include "services/ui/public/interfaces/ime/ime.mojom.h" | 8 #include "services/ui/public/interfaces/ime/ime.mojom.h" |
| 8 | 9 |
| 9 namespace ui { | 10 namespace ui { |
| 10 namespace test { | 11 namespace test { |
| 11 | 12 |
| 12 class TestInputMethod : public mojom::InputMethod { | 13 class TestInputMethod : public mojom::InputMethod { |
| 13 public: | 14 public: |
| 14 explicit TestInputMethod(mojom::TextInputClientPtr client) | 15 explicit TestInputMethod(mojom::TextInputClientPtr client) |
| 15 : client_(std::move(client)) {} | 16 : client_(std::move(client)) {} |
| 16 ~TestInputMethod() override {} | 17 ~TestInputMethod() override {} |
| (...skipping 17 matching lines...) Expand all Loading... |
| 34 | 35 |
| 35 mojom::TextInputClientPtr client_; | 36 mojom::TextInputClientPtr client_; |
| 36 | 37 |
| 37 DISALLOW_COPY_AND_ASSIGN(TestInputMethod); | 38 DISALLOW_COPY_AND_ASSIGN(TestInputMethod); |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 TestIMEDriver::TestIMEDriver() {} | 41 TestIMEDriver::TestIMEDriver() {} |
| 41 | 42 |
| 42 TestIMEDriver::~TestIMEDriver() {} | 43 TestIMEDriver::~TestIMEDriver() {} |
| 43 | 44 |
| 44 void TestIMEDriver::StartSession(int32_t session_id, | 45 void TestIMEDriver::StartSession(mojom::StartSessionDetailsPtr details) { |
| 45 mojom::StartSessionDetailsPtr details) { | 46 mojo::MakeStrongBinding( |
| 46 input_method_bindings_[session_id].reset( | 47 base::MakeUnique<TestInputMethod>(std::move(details->client)), |
| 47 new mojo::Binding<mojom::InputMethod>( | 48 std::move(details->input_method_request)); |
| 48 new TestInputMethod(std::move(details->client)), | |
| 49 std::move(details->input_method_request))); | |
| 50 } | |
| 51 | |
| 52 void TestIMEDriver::CancelSession(int32_t session_id) { | |
| 53 input_method_bindings_.erase(session_id); | |
| 54 } | 49 } |
| 55 | 50 |
| 56 } // namespace test | 51 } // namespace test |
| 57 } // namespace ui | 52 } // namespace ui |
| OLD | NEW |