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