Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: services/ui/ime/ime_server_impl.cc

Issue 2617883002: Add a new BindInterface() method to Connector. (Closed)
Patch Set: . Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « services/ui/demo/mus_demo_unittests.cc ('k') | services/ui/ime/ime_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « services/ui/demo/mus_demo_unittests.cc ('k') | services/ui/ime/ime_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698