OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_ |
7 | 7 |
8 #include <assert.h> | 8 #include <assert.h> |
9 | 9 |
10 #include "mojo/public/cpp/bindings/message.h" | 10 #include "mojo/public/cpp/bindings/message.h" |
11 #include "mojo/public/cpp/bindings/message_filter.h" | 11 #include "mojo/public/cpp/bindings/message_filter.h" |
12 #include "mojo/public/cpp/system/core.h" | 12 #include "mojo/public/cpp/system/core.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 | 15 |
16 // NoInterface is for use in cases when a non-existent or empty interface is | 16 // NoInterface is for use in cases when a non-existent or empty interface is |
17 // needed (e.g., when the Mojom "Peer" attribute is not present). | 17 // needed (e.g., when the Mojom "Peer" attribute is not present). |
18 | 18 |
19 class NoInterfaceProxy; | 19 class NoInterfaceProxy; |
20 class NoInterfaceStub; | 20 class NoInterfaceStub; |
21 | 21 |
22 class NoInterface { | 22 class NoInterface { |
23 public: | 23 public: |
24 typedef NoInterfaceProxy Proxy_; | 24 typedef NoInterfaceProxy Proxy_; |
25 typedef NoInterfaceStub Stub_; | 25 typedef NoInterfaceStub Stub_; |
26 typedef PassThroughFilter RequestValidator_; | 26 typedef PassThroughFilter RequestValidator_; |
27 typedef PassThroughFilter ResponseValidator_; | 27 typedef PassThroughFilter ResponseValidator_; |
28 typedef NoInterface Client; | 28 typedef NoInterface Client; |
29 virtual ~NoInterface() {} | 29 virtual ~NoInterface() {} |
30 virtual void SetClient(NoInterface* client) {} | |
31 }; | 30 }; |
32 | 31 |
33 class NoInterfaceProxy : public NoInterface { | 32 class NoInterfaceProxy : public NoInterface { |
34 public: | 33 public: |
35 explicit NoInterfaceProxy(MessageReceiver* receiver) {} | 34 explicit NoInterfaceProxy(MessageReceiver* receiver) {} |
36 }; | 35 }; |
37 | 36 |
38 class NoInterfaceStub : public MessageReceiver { | 37 class NoInterfaceStub : public MessageReceiver { |
39 public: | 38 public: |
40 NoInterfaceStub() {} | 39 NoInterfaceStub() {} |
41 void set_sink(NoInterface* sink) {} | 40 void set_sink(NoInterface* sink) {} |
42 virtual bool Accept(Message* message) MOJO_OVERRIDE; | 41 virtual bool Accept(Message* message) MOJO_OVERRIDE; |
43 virtual bool AcceptWithResponder(Message* message, MessageReceiver* responder) | 42 virtual bool AcceptWithResponder(Message* message, MessageReceiver* responder) |
44 MOJO_OVERRIDE; | 43 MOJO_OVERRIDE; |
45 }; | 44 }; |
46 | 45 |
47 | 46 |
48 // AnyInterface is for use in cases where any interface would do (e.g., see the | 47 // AnyInterface is for use in cases where any interface would do (e.g., see the |
49 // Shell::Connect method). | 48 // Shell::Connect method). |
50 | 49 |
51 typedef NoInterface AnyInterface; | 50 typedef NoInterface AnyInterface; |
52 | 51 |
53 } // namespace mojo | 52 } // namespace mojo |
54 | 53 |
55 #endif // MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_ | 54 #endif // MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_ |
OLD | NEW |