Chromium Code Reviews| 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 "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 9 #include "content/public/common/service_manager_connection.h" | 10 #include "content/public/common/service_manager_connection.h" |
| 10 #include "mojo/public/cpp/bindings/strong_binding.h" | 11 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 11 #include "services/service_manager/public/cpp/connector.h" | 12 #include "services/service_manager/public/cpp/connector.h" |
| 12 #include "services/ui/public/interfaces/constants.mojom.h" | 13 #include "services/ui/public/interfaces/constants.mojom.h" |
| 13 #include "services/ui/public/interfaces/ime/ime.mojom.h" | 14 #include "services/ui/public/interfaces/ime/ime.mojom.h" |
| 14 #include "ui/base/ime/ime_bridge.h" | 15 #include "ui/base/ime/ime_bridge.h" |
| 15 | 16 |
| 16 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
| 17 #include "chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos.h" | 18 #include "chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 31 ui::mojom::IMEDriverPtr ime_driver_ptr; | 32 ui::mojom::IMEDriverPtr ime_driver_ptr; |
| 32 mojo::MakeStrongBinding(base::MakeUnique<IMEDriver>(), | 33 mojo::MakeStrongBinding(base::MakeUnique<IMEDriver>(), |
| 33 MakeRequest(&ime_driver_ptr)); | 34 MakeRequest(&ime_driver_ptr)); |
| 34 ui::mojom::IMERegistrarPtr ime_registrar; | 35 ui::mojom::IMERegistrarPtr ime_registrar; |
| 35 content::ServiceManagerConnection::GetForProcess() | 36 content::ServiceManagerConnection::GetForProcess() |
| 36 ->GetConnector() | 37 ->GetConnector() |
| 37 ->BindInterface(ui::mojom::kServiceName, &ime_registrar); | 38 ->BindInterface(ui::mojom::kServiceName, &ime_registrar); |
| 38 ime_registrar->RegisterDriver(std::move(ime_driver_ptr)); | 39 ime_registrar->RegisterDriver(std::move(ime_driver_ptr)); |
| 39 } | 40 } |
| 40 | 41 |
| 41 void IMEDriver::StartSession( | 42 void IMEDriver::StartSession(int32_t session_id, |
| 42 int32_t session_id, | 43 ui::mojom::StartSessionDetailsPtr details) { |
| 43 ui::mojom::TextInputClientPtr client, | |
| 44 ui::mojom::InputMethodRequest input_method_request) { | |
| 45 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
| 45 std::unique_ptr<RemoteTextInputClient> remote_client = | |
|
Hadi
2017/01/13 21:47:53
We could inline this in the next statement, just d
| |
| 46 base::MakeUnique<RemoteTextInputClient>( | |
| 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); | |
| 46 input_method_bindings_[session_id] = | 50 input_method_bindings_[session_id] = |
| 47 base::MakeUnique<mojo::Binding<ui::mojom::InputMethod>>( | 51 base::MakeUnique<mojo::Binding<ui::mojom::InputMethod>>( |
| 48 new InputMethodBridge(std::move(client)), | 52 new InputMethodBridge(std::move(remote_client)), |
| 49 std::move(input_method_request)); | 53 std::move(details->input_method_request)); |
| 50 #else | 54 #else |
| 51 input_method_bindings_[session_id] = | 55 input_method_bindings_[session_id] = |
| 52 base::MakeUnique<mojo::Binding<ui::mojom::InputMethod>>( | 56 base::MakeUnique<mojo::Binding<ui::mojom::InputMethod>>( |
| 53 new SimpleInputMethod()); | 57 new SimpleInputMethod()); |
| 54 #endif | 58 #endif |
| 55 } | 59 } |
| 56 | 60 |
| 57 void IMEDriver::CancelSession(int32_t session_id) { | 61 void IMEDriver::CancelSession(int32_t session_id) { |
| 58 input_method_bindings_.erase(session_id); | 62 input_method_bindings_.erase(session_id); |
| 59 } | 63 } |
| OLD | NEW |