OLD | NEW |
---|---|
(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> | |
jamesr
2015/05/08 20:55:16
use "" style includes and put a blank line after t
APW
2015/05/08 22:09:28
Done.
| |
6 #include "base/bind.h" | |
7 #include "base/logging.h" | |
8 #include "mojo/public/c/system/main.h" | |
9 #include "mojo/public/cpp/application/application_impl.h" | |
10 #include "mojo/public/cpp/application/application_runner.h" | |
11 #include "mojo/public/cpp/bindings/error_handler.h" | |
12 #include "mojo/public/cpp/system/data_pipe.h" | |
13 | |
14 namespace keyboard { | |
15 | |
16 KeyboardServiceImpl::KeyboardServiceImpl() { | |
17 } | |
18 | |
19 KeyboardServiceImpl::~KeyboardServiceImpl() { | |
20 } | |
21 | |
22 void KeyboardServiceImpl::Show(KeyboardClientPtr client) { | |
23 keyboard::CompletionData completionData; | |
24 completionData.text = "blah"; | |
25 completionData.label = "blahblah"; | |
26 client->CommitCompletion(completionData.Clone()); | |
27 | |
28 keyboard::CorrectionData correctionData; | |
29 correctionData.old_text = "old text"; | |
30 correctionData.new_text = "new text"; | |
31 client->CommitCorrection(correctionData.Clone()); | |
32 | |
33 client->CommitText("", 0); | |
34 client->DeleteSurroundingText(0, 0); | |
35 client->SetComposingRegion(0, 0); | |
36 client->SetComposingText("", 0); | |
37 client->SetSelection(0, 1); | |
38 } | |
39 | |
40 void KeyboardServiceImpl::ShowByRequest() { | |
41 } | |
42 | |
43 void KeyboardServiceImpl::Hide() { | |
44 } | |
45 | |
46 bool KeyboardServiceDelegate::ConfigureIncomingConnection( | |
47 mojo::ApplicationConnection* connection) { | |
48 connection->AddService<KeyboardService>(this); | |
49 return true; | |
50 } | |
51 | |
52 // From InterfaceFactory<Echo> | |
53 void KeyboardServiceDelegate::Create( | |
54 mojo::ApplicationConnection* connection, | |
55 mojo::InterfaceRequest<KeyboardService> request) { | |
56 // This object will be deleted automatically because of the use of | |
57 // StrongBinding<> for the declaration of |strong_binding_|. | |
58 new StrongBindingKeyboardServiceImpl(request.Pass()); | |
59 } | |
60 | |
61 } // namespace keyboard | |
62 | |
63 MojoResult MojoMain(MojoHandle application_request) { | |
64 mojo::ApplicationRunner runner(new keyboard::KeyboardServiceDelegate()); | |
65 return runner.Run(application_request); | |
66 } | |
OLD | NEW |