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); |
+} |