OLD | NEW |
---|---|
(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/memory/scoped_ptr.h" | |
6 #include "base/memory/scoped_vector.h" | |
7 #include "base/memory/weak_ptr.h" | |
8 #include "mojo/common/weak_binding_set.h" | |
9 #include "mojo/public/cpp/application/application_connection.h" | |
10 #include "mojo/public/cpp/application/application_delegate.h" | |
11 #include "mojo/public/cpp/application/application_runner.h" | |
12 #include "mojo/public/cpp/application/interface_factory.h" | |
13 #include "mojo/public/cpp/bindings/interface_request.h" | |
14 #include "mojo/public/cpp/bindings/strong_binding.h" | |
15 #include "mojo/services/keyboard/public/interfaces/keyboard.mojom.h" | |
16 | |
17 namespace keyboard { | |
18 | |
19 class KeyboardServiceDelegate : public mojo::ApplicationDelegate, | |
20 public mojo::InterfaceFactory<KeyboardService> { | |
21 public: | |
22 // ApplicationDelegate implementation. | |
23 bool ConfigureIncomingConnection(mojo::ApplicationConnection* connection) | |
24 override; | |
25 | |
26 // 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.
| |
27 void Create(mojo::ApplicationConnection* connection, | |
28 mojo::InterfaceRequest<KeyboardService> request) override; | |
29 }; | |
30 | |
31 class KeyboardServiceImpl : public KeyboardService { | |
32 public: | |
33 KeyboardServiceImpl(); | |
34 ~KeyboardServiceImpl() override; | |
35 | |
36 // KeyboardService implementation. | |
37 void Show(KeyboardClientPtr client) override; | |
38 void ShowByRequest() override; | |
39 void Hide() override; | |
40 }; | |
41 | |
42 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.
| |
43 public: | |
44 explicit StrongBindingKeyboardServiceImpl( | |
45 mojo::InterfaceRequest<KeyboardService> handle) | |
46 : strong_binding_(this, handle.Pass()) { | |
47 } | |
48 | |
49 private: | |
50 mojo::StrongBinding<KeyboardService> strong_binding_; | |
51 }; | |
52 | |
53 } // namespace keyboard | |
OLD | NEW |