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

Unified Diff: services/keyboard_native/keyboard_service_impl.h

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.h
diff --git a/services/keyboard_native/keyboard_service_impl.h b/services/keyboard_native/keyboard_service_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..834a8ac2fe9fd53a75afed3e39598917df8bef0c
--- /dev/null
+++ b/services/keyboard_native/keyboard_service_impl.h
@@ -0,0 +1,53 @@
+// 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 "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
+#include "base/memory/weak_ptr.h"
+#include "mojo/common/weak_binding_set.h"
+#include "mojo/public/cpp/application/application_connection.h"
+#include "mojo/public/cpp/application/application_delegate.h"
+#include "mojo/public/cpp/application/application_runner.h"
+#include "mojo/public/cpp/application/interface_factory.h"
+#include "mojo/public/cpp/bindings/interface_request.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+#include "mojo/services/keyboard/public/interfaces/keyboard.mojom.h"
+
+namespace keyboard {
+
+class KeyboardServiceDelegate : public mojo::ApplicationDelegate,
+ public mojo::InterfaceFactory<KeyboardService> {
+ public:
+ // ApplicationDelegate implementation.
+ bool ConfigureIncomingConnection(mojo::ApplicationConnection* connection)
+ override;
+
+ // From InterfaceFactory<Echo>
jamesr 2015/05/08 20:55:16 I like the comments but please be consistent
APW 2015/05/08 22:09:28 Done.
+ void Create(mojo::ApplicationConnection* connection,
+ mojo::InterfaceRequest<KeyboardService> request) override;
+};
+
+class KeyboardServiceImpl : public KeyboardService {
+ public:
+ KeyboardServiceImpl();
+ ~KeyboardServiceImpl() override;
+
+ // KeyboardService implementation.
+ void Show(KeyboardClientPtr client) override;
+ void ShowByRequest() override;
+ void Hide() override;
+};
+
+class StrongBindingKeyboardServiceImpl : public KeyboardServiceImpl {
jamesr 2015/05/08 20:55:16 I don't really understand what this class does - i
APW 2015/05/08 22:09:28 examples/echo/echo_server.c uses this pattern, tha
APW 2015/05/08 22:27:02 Done.
+ public:
+ explicit StrongBindingKeyboardServiceImpl(
+ mojo::InterfaceRequest<KeyboardService> handle)
+ : strong_binding_(this, handle.Pass()) {
+ }
+
+ private:
+ mojo::StrongBinding<KeyboardService> strong_binding_;
+};
+
+} // namespace keyboard

Powered by Google App Engine
This is Rietveld 408576698