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

Side by Side Diff: examples/keyboard_client/keyboard_client.cc

Issue 1139453002: Initial native keyboard proof of concept. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Addressed comments. 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
« no previous file with comments | « examples/keyboard_client/BUILD.gn ('k') | services/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/macros.h"
6 #include "mojo/public/cpp/application/application_delegate.h"
7 #include "mojo/public/cpp/application/application_impl.h"
8 #include "mojo/public/cpp/application/application_runner.h"
9 #include "mojo/services/keyboard/public/interfaces/keyboard.mojom.h"
10
11 namespace examples {
12
13 class KeyboardDelegate : public mojo::ApplicationDelegate,
14 public keyboard::KeyboardClient {
15 public:
16 KeyboardDelegate() : binding_(this) {}
17
18 ~KeyboardDelegate() override {}
19
20 // mojo::ApplicationDelegate implementation.
21 void Initialize(mojo::ApplicationImpl* app) override {
22 app->ConnectToService("mojo:keyboard_native", &keyboard_);
23 keyboard_->ShowByRequest();
24 keyboard_->Hide();
25
26 keyboard::KeyboardClientPtr keyboard_client;
27 auto request = mojo::GetProxy(&keyboard_client);
28 binding_.Bind(request.Pass());
29 keyboard_->Show(keyboard_client.Pass());
30 }
31
32 // keyboard::KeyboardClient implementation.
33 void CommitCompletion(keyboard::CompletionDataPtr completion) override {}
34
35 void CommitCorrection(keyboard::CorrectionDataPtr correction) override {}
36
37 void CommitText(const mojo::String& text,
38 int32_t new_cursor_position) override {}
39
40 void DeleteSurroundingText(int32_t before_length,
41 int32_t after_length) override {}
42
43 void SetComposingRegion(int32_t start, int32_t end) override {}
44
45 void SetComposingText(const mojo::String& text,
46 int32_t new_cursor_position) override {}
47
48 void SetSelection(int32_t start, int32_t end) override {}
49
50 private:
51 mojo::Binding<keyboard::KeyboardClient> binding_;
52 keyboard::KeyboardServicePtr keyboard_;
53
54 DISALLOW_COPY_AND_ASSIGN(KeyboardDelegate);
55 };
56
57 } // namespace examples
58
59 MojoResult MojoMain(MojoHandle application_request) {
60 mojo::ApplicationRunner runner(new examples::KeyboardDelegate);
61 return runner.Run(application_request);
62 }
OLDNEW
« no previous file with comments | « examples/keyboard_client/BUILD.gn ('k') | services/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698