| 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 |
| 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 connector_ = connector; | 19 connector_ = connector; |
| 20 connector_->ConnectToInterface(catalog::mojom::kServiceName, &catalog_); | 20 connector_->BindInterface(catalog::mojom::kServiceName, &catalog_); |
| 21 // TODO(moshayedi): crbug.com/664264. The catalog service should provide | 21 // TODO(moshayedi): crbug.com/664264. The catalog service should provide |
| 22 // different set of entries for test and non-test. Once that is implemented, | 22 // different set of entries for test and non-test. Once that is implemented, |
| 23 // we won't need this check here. | 23 // we won't need this check here. |
| 24 if (is_test_config) { | 24 if (is_test_config) { |
| 25 connector_->Connect("test_ime_driver"); | 25 connector_->Connect("test_ime_driver"); |
| 26 } else { | 26 } else { |
| 27 catalog_->GetEntriesProvidingCapability( | 27 catalog_->GetEntriesProvidingCapability( |
| 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 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void IMEServerImpl::OnGotCatalogEntries( | 72 void IMEServerImpl::OnGotCatalogEntries( |
| 73 std::vector<catalog::mojom::EntryPtr> entries) { | 73 std::vector<catalog::mojom::EntryPtr> entries) { |
| 74 // 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 |
| 75 // available IME drivers isn't exactly one. | 75 // available IME drivers isn't exactly one. |
| 76 if (entries.size() == 0) | 76 if (entries.size() == 0) |
| 77 return; | 77 return; |
| 78 connector_->Connect((*entries.begin())->name); | 78 connector_->Connect((*entries.begin())->name); |
| 79 } | 79 } |
| 80 | 80 |
| 81 } // namespace ui | 81 } // namespace ui |
| OLD | NEW |