Chromium Code Reviews| 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 |