| 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/catalog/public/interfaces/constants.mojom.h" | 7 #include "services/catalog/public/interfaces/constants.mojom.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 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 "ime:ime_driver", base::Bind(&IMEServerImpl::OnGotCatalogEntries, | 28 "ime:ime_driver", base::Bind(&IMEServerImpl::OnGotCatalogEntries, |
| 29 base::Unretained(this))); | 29 base::Unretained(this))); |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 void IMEServerImpl::AddBinding(mojom::IMEServerRequest request) { | 33 void IMEServerImpl::AddBinding(mojom::IMEServerRequest request) { |
| 34 bindings_.AddBinding(this, std::move(request)); | 34 bindings_.AddBinding(this, std::move(request)); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void IMEServerImpl::OnDriverChanged(mojom::IMEDriverPtr driver) { | 37 void IMEServerImpl::OnDriverChanged(mojom::IMEDriverPtr driver) { |
| 38 // TODO(moshayedi): crbug.com/669681. Handle switching drivers properly. For |
| 39 // now we only register the first driver to avoid clients of the previous |
| 40 // driver from hanging. |
| 41 if (driver_) |
| 42 return; |
| 43 |
| 38 // TODO(moshayedi): crbug.com/664267. Make sure this is the driver we | 44 // TODO(moshayedi): crbug.com/664267. Make sure this is the driver we |
| 39 // requested at OnGotCatalogEntries(). | 45 // requested at OnGotCatalogEntries(). |
| 40 driver_ = std::move(driver); | 46 driver_ = std::move(driver); |
| 41 | 47 |
| 42 while (!pending_requests_.empty()) { | 48 while (!pending_requests_.empty()) { |
| 43 driver_->StartSession(current_id_++, | 49 driver_->StartSession(current_id_++, |
| 44 std::move(pending_requests_.front().first), | 50 std::move(pending_requests_.front().first), |
| 45 std::move(pending_requests_.front().second)); | 51 std::move(pending_requests_.front().second)); |
| 46 pending_requests_.pop(); | 52 pending_requests_.pop(); |
| 47 } | 53 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 66 void IMEServerImpl::OnGotCatalogEntries( | 72 void IMEServerImpl::OnGotCatalogEntries( |
| 67 std::vector<catalog::mojom::EntryPtr> entries) { | 73 std::vector<catalog::mojom::EntryPtr> entries) { |
| 68 // TODO(moshayedi): crbug.com/662157. Decide what to do when number of | 74 // TODO(moshayedi): crbug.com/662157. Decide what to do when number of |
| 69 // available IME drivers isn't exactly one. | 75 // available IME drivers isn't exactly one. |
| 70 if (entries.size() == 0) | 76 if (entries.size() == 0) |
| 71 return; | 77 return; |
| 72 connector_->Connect((*entries.begin())->name); | 78 connector_->Connect((*entries.begin())->name); |
| 73 } | 79 } |
| 74 | 80 |
| 75 } // namespace ui | 81 } // namespace ui |
| OLD | NEW |