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/ime_server_impl.h" | 5 #include "services/ui/ime/ime_server_impl.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "services/service_manager/public/cpp/connector.h" | 8 #include "services/service_manager/public/cpp/connector.h" |
9 #include "services/ui/ime/ime_registrar_impl.h" | 9 #include "services/ui/ime/ime_registrar_impl.h" |
10 | 10 |
11 namespace ui { | 11 namespace ui { |
12 | 12 |
13 IMEServerImpl::IMEServerImpl() : current_id_(0) {} | 13 IMEServerImpl::IMEServerImpl() : current_id_(0) {} |
14 | 14 |
15 IMEServerImpl::~IMEServerImpl() {} | 15 IMEServerImpl::~IMEServerImpl() {} |
16 | 16 |
17 void IMEServerImpl::Init(service_manager::Connector* connector, | 17 void IMEServerImpl::Init(service_manager::Connector* connector, |
18 bool is_test_config) { | 18 bool is_test_config) { |
19 if (is_test_config) | 19 if (is_test_config) |
20 connector->Connect("test_ime_driver"); | 20 connector->StartService("test_ime_driver"); |
21 // For non test configs we assume a client registers with us. | 21 // For non test configs we assume a client registers with us. |
22 } | 22 } |
23 | 23 |
24 void IMEServerImpl::AddBinding(mojom::IMEServerRequest request) { | 24 void IMEServerImpl::AddBinding(mojom::IMEServerRequest request) { |
25 bindings_.AddBinding(this, std::move(request)); | 25 bindings_.AddBinding(this, std::move(request)); |
26 } | 26 } |
27 | 27 |
28 void IMEServerImpl::OnDriverChanged(mojom::IMEDriverPtr driver) { | 28 void IMEServerImpl::OnDriverChanged(mojom::IMEDriverPtr driver) { |
29 // TODO(moshayedi): crbug.com/669681. Handle switching drivers properly. For | 29 // TODO(moshayedi): crbug.com/669681. Handle switching drivers properly. For |
30 // now we only register the first driver to avoid clients of the previous | 30 // now we only register the first driver to avoid clients of the previous |
(...skipping 15 matching lines...) Expand all Loading... |
46 // clients to the driver as they are. We may need to check |caret_bounds| | 46 // clients to the driver as they are. We may need to check |caret_bounds| |
47 // parameter of InputMethod::OnCaretBoundsChanged() here and limit them to | 47 // parameter of InputMethod::OnCaretBoundsChanged() here and limit them to |
48 // client's focused window. | 48 // client's focused window. |
49 driver_->StartSession(current_id_++, std::move(details)); | 49 driver_->StartSession(current_id_++, std::move(details)); |
50 } else { | 50 } else { |
51 pending_requests_.push(std::move(details)); | 51 pending_requests_.push(std::move(details)); |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 } // namespace ui | 55 } // namespace ui |
OLD | NEW |