| 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 "content/public/browser/browser_thread.h" | 7 #include "content/public/browser/browser_thread.h" |
| 8 #include "content/public/common/service_manager_connection.h" | 8 #include "content/public/common/service_manager_connection.h" |
| 9 #include "mojo/public/cpp/bindings/strong_binding.h" | 9 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 10 #include "services/service_manager/public/cpp/connector.h" | 10 #include "services/service_manager/public/cpp/connector.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 ui::IMEBridge::Initialize(); | 22 ui::IMEBridge::Initialize(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 IMEDriver::~IMEDriver() {} | 25 IMEDriver::~IMEDriver() {} |
| 26 | 26 |
| 27 // static | 27 // static |
| 28 void IMEDriver::Register() { | 28 void IMEDriver::Register() { |
| 29 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 29 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 30 ui::mojom::IMEDriverPtr ime_driver_ptr; | 30 ui::mojom::IMEDriverPtr ime_driver_ptr; |
| 31 mojo::MakeStrongBinding(base::MakeUnique<IMEDriver>(), | 31 mojo::MakeStrongBinding(base::MakeUnique<IMEDriver>(), |
| 32 GetProxy(&ime_driver_ptr)); | 32 MakeRequest(&ime_driver_ptr)); |
| 33 ui::mojom::IMERegistrarPtr ime_registrar; | 33 ui::mojom::IMERegistrarPtr ime_registrar; |
| 34 content::ServiceManagerConnection::GetForProcess() | 34 content::ServiceManagerConnection::GetForProcess() |
| 35 ->GetConnector() | 35 ->GetConnector() |
| 36 ->ConnectToInterface(ui::mojom::kServiceName, &ime_registrar); | 36 ->ConnectToInterface(ui::mojom::kServiceName, &ime_registrar); |
| 37 ime_registrar->RegisterDriver(std::move(ime_driver_ptr)); | 37 ime_registrar->RegisterDriver(std::move(ime_driver_ptr)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void IMEDriver::StartSession( | 40 void IMEDriver::StartSession( |
| 41 int32_t session_id, | 41 int32_t session_id, |
| 42 ui::mojom::TextInputClientPtr client, | 42 ui::mojom::TextInputClientPtr client, |
| 43 ui::mojom::InputMethodRequest input_method_request) { | 43 ui::mojom::InputMethodRequest input_method_request) { |
| 44 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
| 45 input_method_bindings_[session_id] = | 45 input_method_bindings_[session_id] = |
| 46 base::MakeUnique<mojo::Binding<ui::mojom::InputMethod>>( | 46 base::MakeUnique<mojo::Binding<ui::mojom::InputMethod>>( |
| 47 new InputMethodBridge(std::move(client)), | 47 new InputMethodBridge(std::move(client)), |
| 48 std::move(input_method_request)); | 48 std::move(input_method_request)); |
| 49 #else | 49 #else |
| 50 input_method_bindings_[session_id] = | 50 input_method_bindings_[session_id] = |
| 51 base::MakeUnique<mojo::Binding<ui::mojom::InputMethod>>( | 51 base::MakeUnique<mojo::Binding<ui::mojom::InputMethod>>( |
| 52 new SimpleInputMethod()); | 52 new SimpleInputMethod()); |
| 53 #endif | 53 #endif |
| 54 } | 54 } |
| 55 | 55 |
| 56 void IMEDriver::CancelSession(int32_t session_id) { | 56 void IMEDriver::CancelSession(int32_t session_id) { |
| 57 input_method_bindings_.erase(session_id); | 57 input_method_bindings_.erase(session_id); |
| 58 } | 58 } |
| OLD | NEW |