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

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

Issue 2473483008: IME for Mus: Use the catalog service to decide IME driver's name. (Closed)
Patch Set: Some cleanup. Created 4 years, 1 month 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/ime/ime_server_impl.h ('k') | services/ui/ime/test_ime_driver/manifest.json » ('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/service_manager/public/cpp/connector.h" 7 #include "services/service_manager/public/cpp/connector.h"
8 #include "services/ui/ime/ime_registrar_impl.h" 8 #include "services/ui/ime/ime_registrar_impl.h"
9 9
10 namespace ui { 10 namespace ui {
11 11
12 IMEServerImpl::IMEServerImpl() : current_id_(0) {} 12 IMEServerImpl::IMEServerImpl() : current_id_(0) {}
13 13
14 IMEServerImpl::~IMEServerImpl() {} 14 IMEServerImpl::~IMEServerImpl() {}
15 15
16 void IMEServerImpl::Init(service_manager::Connector* connector) { 16 void IMEServerImpl::Init(service_manager::Connector* connector) {
17 // TODO(moshayedi): crbug.com/641041. Look up the driver from the mojo:catalog 17 connector_ = connector;
18 // service. 18 connector_->ConnectToInterface("service:catalog", &catalog_);
19 connector->Connect("service:test_ime_driver"); 19 catalog_->GetEntriesProvidingCapability(
20 "ime:ime_driver",
21 base::Bind(&IMEServerImpl::OnGotCatalogEntries, base::Unretained(this)));
20 } 22 }
21 23
22 void IMEServerImpl::AddBinding(mojom::IMEServerRequest request) { 24 void IMEServerImpl::AddBinding(mojom::IMEServerRequest request) {
23 bindings_.AddBinding(this, std::move(request)); 25 bindings_.AddBinding(this, std::move(request));
24 } 26 }
25 27
26 void IMEServerImpl::OnDriverChanged(mojom::IMEDriverPtr driver) { 28 void IMEServerImpl::OnDriverChanged(mojom::IMEDriverPtr driver) {
27 driver_ = std::move(driver); 29 driver_ = std::move(driver);
28 30
29 while (!pending_requests_.empty()) { 31 while (!pending_requests_.empty()) {
(...skipping 13 matching lines...) Expand all
43 // parameter of InputMethod::OnCaretBoundsChanged() here and limit them to 45 // parameter of InputMethod::OnCaretBoundsChanged() here and limit them to
44 // client's focused window. 46 // client's focused window.
45 driver_->StartSession(current_id_++, std::move(client), 47 driver_->StartSession(current_id_++, std::move(client),
46 std::move(input_method_request)); 48 std::move(input_method_request));
47 } else { 49 } else {
48 pending_requests_.push( 50 pending_requests_.push(
49 std::make_pair(std::move(client), std::move(input_method_request))); 51 std::make_pair(std::move(client), std::move(input_method_request)));
50 } 52 }
51 } 53 }
52 54
55 void IMEServerImpl::OnGotCatalogEntries(
56 std::vector<catalog::mojom::EntryPtr> entries) {
57 // TODO(moshayedi): crbug.com/662157. Decide what to do when number of
58 // available IME drivers isn't exactly one.
59 if (entries.size() == 0)
60 return;
61 connector_->Connect((*entries.begin())->name);
62 }
63
53 } // namespace ui 64 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/ime/ime_server_impl.h ('k') | services/ui/ime/test_ime_driver/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698