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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
Index: services/keyboard_native/keyboard_service_impl.cc
diff --git a/services/keyboard_native/keyboard_service_impl.cc b/services/keyboard_native/keyboard_service_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c46c04a77757522b29247f24e241714d63b58c93
--- /dev/null
+++ b/services/keyboard_native/keyboard_service_impl.cc
@@ -0,0 +1,66 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#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.
+#include "base/bind.h"
+#include "base/logging.h"
+#include "mojo/public/c/system/main.h"
+#include "mojo/public/cpp/application/application_impl.h"
+#include "mojo/public/cpp/application/application_runner.h"
+#include "mojo/public/cpp/bindings/error_handler.h"
+#include "mojo/public/cpp/system/data_pipe.h"
+
+namespace keyboard {
+
+KeyboardServiceImpl::KeyboardServiceImpl() {
+}
+
+KeyboardServiceImpl::~KeyboardServiceImpl() {
+}
+
+void KeyboardServiceImpl::Show(KeyboardClientPtr client) {
+ keyboard::CompletionData completionData;
+ completionData.text = "blah";
+ completionData.label = "blahblah";
+ client->CommitCompletion(completionData.Clone());
+
+ keyboard::CorrectionData correctionData;
+ correctionData.old_text = "old text";
+ correctionData.new_text = "new text";
+ client->CommitCorrection(correctionData.Clone());
+
+ client->CommitText("", 0);
+ client->DeleteSurroundingText(0, 0);
+ client->SetComposingRegion(0, 0);
+ client->SetComposingText("", 0);
+ client->SetSelection(0, 1);
+}
+
+void KeyboardServiceImpl::ShowByRequest() {
+}
+
+void KeyboardServiceImpl::Hide() {
+}
+
+bool KeyboardServiceDelegate::ConfigureIncomingConnection(
+ mojo::ApplicationConnection* connection) {
+ connection->AddService<KeyboardService>(this);
+ return true;
+}
+
+// From InterfaceFactory<Echo>
+void KeyboardServiceDelegate::Create(
+ mojo::ApplicationConnection* connection,
+ mojo::InterfaceRequest<KeyboardService> request) {
+ // This object will be deleted automatically because of the use of
+ // StrongBinding<> for the declaration of |strong_binding_|.
+ new StrongBindingKeyboardServiceImpl(request.Pass());
+}
+
+} // namespace keyboard
+
+MojoResult MojoMain(MojoHandle application_request) {
+ mojo::ApplicationRunner runner(new keyboard::KeyboardServiceDelegate());
+ return runner.Run(application_request);
+}

Powered by Google App Engine
This is Rietveld 408576698