| 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 "services/shell/public/cpp/connector.h" | |
| 8 #include "services/ui/ime/ime_registrar_impl.h" | 7 #include "services/ui/ime/ime_registrar_impl.h" |
| 9 | 8 |
| 10 namespace ui { | 9 namespace ui { |
| 11 | 10 |
| 12 IMEServerImpl::IMEServerImpl() : current_id_(0) {} | 11 IMEServerImpl::IMEServerImpl() : current_id_(0) {} |
| 13 | 12 |
| 14 IMEServerImpl::~IMEServerImpl() {} | 13 IMEServerImpl::~IMEServerImpl() {} |
| 15 | 14 |
| 16 void IMEServerImpl::Init(shell::Connector* connector) { | |
| 17 // TODO(moshayedi): crbug.com/641041. Look up the driver from the mojo:catalog | |
| 18 // service. | |
| 19 connector->Connect("mojo:test_ime_driver"); | |
| 20 } | |
| 21 | |
| 22 void IMEServerImpl::AddBinding(mojom::IMEServerRequest request) { | 15 void IMEServerImpl::AddBinding(mojom::IMEServerRequest request) { |
| 23 bindings_.AddBinding(this, std::move(request)); | 16 bindings_.AddBinding(this, std::move(request)); |
| 24 } | 17 } |
| 25 | 18 |
| 26 void IMEServerImpl::OnDriverChanged(mojom::IMEDriverPtr driver) { | 19 void IMEServerImpl::OnDriverChanged(mojom::IMEDriverPtr driver) { |
| 27 driver_ = std::move(driver); | 20 driver_ = std::move(driver); |
| 28 | 21 |
| 29 while (!pending_requests_.empty()) { | 22 while (!pending_requests_.empty()) { |
| 30 driver_->StartSession(current_id_++, | 23 driver_->StartSession(current_id_++, |
| 31 std::move(pending_requests_.front().first), | 24 std::move(pending_requests_.front().first), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 44 // client's focused window. | 37 // client's focused window. |
| 45 driver_->StartSession(current_id_++, std::move(client), | 38 driver_->StartSession(current_id_++, std::move(client), |
| 46 std::move(input_method_request)); | 39 std::move(input_method_request)); |
| 47 } else { | 40 } else { |
| 48 pending_requests_.push( | 41 pending_requests_.push( |
| 49 std::make_pair(std::move(client), std::move(input_method_request))); | 42 std::make_pair(std::move(client), std::move(input_method_request))); |
| 50 } | 43 } |
| 51 } | 44 } |
| 52 | 45 |
| 53 } // namespace ui | 46 } // namespace ui |
| OLD | NEW |