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

Side by Side Diff: services/keyboard_native/keyboard_service_impl.cc

Issue 1139453002: Initial native keyboard proof of concept. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fixed build. Created 5 years, 7 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
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "services/keyboard_native/keyboard_service_impl.h"
6
7 #include "base/bind.h"
8 #include "base/logging.h"
9 #include "mojo/public/c/system/main.h"
10 #include "mojo/public/cpp/application/application_impl.h"
11 #include "mojo/public/cpp/application/application_runner.h"
12 #include "mojo/public/cpp/bindings/error_handler.h"
13 #include "mojo/public/cpp/system/data_pipe.h"
14
15 namespace keyboard {
16
17 KeyboardServiceImpl::KeyboardServiceImpl(
18 mojo::InterfaceRequest<KeyboardService> handle)
19 : strong_binding_(this, handle.Pass()) {
20 }
21
22 KeyboardServiceImpl::~KeyboardServiceImpl() {
23 }
24
25 // KeyboardService implementation.
26 void KeyboardServiceImpl::Show(KeyboardClientPtr client) {
jamesr 2015/05/08 23:45:23 note: i think this is deliberate here but keep in
APW 2015/05/09 00:45:58 Acknowledged. I will hold on to it in a later cha
27 keyboard::CompletionData completionData;
28 completionData.text = "blah";
29 completionData.label = "blahblah";
30 client->CommitCompletion(completionData.Clone());
31
32 keyboard::CorrectionData correctionData;
33 correctionData.old_text = "old text";
34 correctionData.new_text = "new text";
35 client->CommitCorrection(correctionData.Clone());
36
37 client->CommitText("", 0);
38 client->DeleteSurroundingText(0, 0);
39 client->SetComposingRegion(0, 0);
40 client->SetComposingText("", 0);
41 client->SetSelection(0, 1);
42 }
43
44 void KeyboardServiceImpl::ShowByRequest() {
45 }
46
47 void KeyboardServiceImpl::Hide() {
48 }
49
50 // ApplicationDelegate implementation.
51 bool KeyboardServiceDelegate::ConfigureIncomingConnection(
52 mojo::ApplicationConnection* connection) {
53 connection->AddService<KeyboardService>(this);
54 return true;
55 }
56
57 // InterfaceFactory<KeyboardService> implementation.
58 void KeyboardServiceDelegate::Create(
59 mojo::ApplicationConnection* connection,
60 mojo::InterfaceRequest<KeyboardService> request) {
61 // This object will be deleted automatically because of the use of
62 // StrongBinding<> for the declaration of |strong_binding_|.
63 new KeyboardServiceImpl(request.Pass());
64 }
65
66 } // namespace keyboard
67
68 MojoResult MojoMain(MojoHandle application_request) {
69 mojo::ApplicationRunner runner(new keyboard::KeyboardServiceDelegate());
70 return runner.Run(application_request);
71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698