| 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 "chrome/browser/ui/views/ime_driver/ime_driver_mus.h" | 5 #include "chrome/browser/ui/views/ime_driver/ime_driver_mus.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/ui/views/ime_driver/remote_text_input_client.h" | 8 #include "chrome/browser/ui/views/ime_driver/remote_text_input_client.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "content/public/common/service_manager_connection.h" | 10 #include "content/public/common/service_manager_connection.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 ui::mojom::IMERegistrarPtr ime_registrar; | 35 ui::mojom::IMERegistrarPtr ime_registrar; |
| 36 content::ServiceManagerConnection::GetForProcess() | 36 content::ServiceManagerConnection::GetForProcess() |
| 37 ->GetConnector() | 37 ->GetConnector() |
| 38 ->BindInterface(ui::mojom::kServiceName, &ime_registrar); | 38 ->BindInterface(ui::mojom::kServiceName, &ime_registrar); |
| 39 ime_registrar->RegisterDriver(std::move(ime_driver_ptr)); | 39 ime_registrar->RegisterDriver(std::move(ime_driver_ptr)); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void IMEDriver::StartSession(int32_t session_id, | 42 void IMEDriver::StartSession(int32_t session_id, |
| 43 ui::mojom::StartSessionDetailsPtr details) { | 43 ui::mojom::StartSessionDetailsPtr details) { |
| 44 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
| 45 ui::mojom::InputMethodRequest request = |
| 46 std::move(details->input_method_request); |
| 45 std::unique_ptr<RemoteTextInputClient> remote_client = | 47 std::unique_ptr<RemoteTextInputClient> remote_client = |
| 46 base::MakeUnique<RemoteTextInputClient>( | 48 base::MakeUnique<RemoteTextInputClient>(std::move(details)); |
| 47 std::move(details->client), details->text_input_type, | |
| 48 details->text_input_mode, details->text_direction, | |
| 49 details->text_input_flags, details->caret_bounds); | |
| 50 input_method_bindings_[session_id] = | 49 input_method_bindings_[session_id] = |
| 51 base::MakeUnique<mojo::Binding<ui::mojom::InputMethod>>( | 50 base::MakeUnique<mojo::Binding<ui::mojom::InputMethod>>( |
| 52 new InputMethodBridge(std::move(remote_client)), | 51 new InputMethodBridge(std::move(remote_client)), std::move(request)); |
| 53 std::move(details->input_method_request)); | |
| 54 #else | 52 #else |
| 55 input_method_bindings_[session_id] = | 53 input_method_bindings_[session_id] = |
| 56 base::MakeUnique<mojo::Binding<ui::mojom::InputMethod>>( | 54 base::MakeUnique<mojo::Binding<ui::mojom::InputMethod>>( |
| 57 new SimpleInputMethod()); | 55 new SimpleInputMethod()); |
| 58 #endif | 56 #endif |
| 59 } | 57 } |
| 60 | 58 |
| 61 void IMEDriver::CancelSession(int32_t session_id) { | 59 void IMEDriver::CancelSession(int32_t session_id) { |
| 62 input_method_bindings_.erase(session_id); | 60 input_method_bindings_.erase(session_id); |
| 63 } | 61 } |
| OLD | NEW |