Index: mojo/public/cpp/bindings/no_interface.h |
diff --git a/mojo/public/cpp/bindings/no_interface.h b/mojo/public/cpp/bindings/no_interface.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..02682d4b00445ec35cf3355438a27a7fda1d414d |
--- /dev/null |
+++ b/mojo/public/cpp/bindings/no_interface.h |
@@ -0,0 +1,52 @@ |
+// Copyright 2014 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. |
+ |
+#ifndef MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_ |
+#define MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_ |
+ |
+#include <assert.h> |
+ |
+#include "mojo/public/cpp/bindings/message.h" |
+#include "mojo/public/cpp/system/core.h" |
+ |
+namespace mojo { |
+ |
+// NoInterface is for use in cases when a non-existent or empty interface is |
+// needed (e.g., when the Mojom "Peer" attribute is not present). |
+ |
+class NoInterfaceProxy; |
+class NoInterfaceStub; |
+ |
+class NoInterface { |
+ public: |
+ typedef NoInterfaceProxy Proxy_; |
+ typedef NoInterfaceStub Stub_; |
+ typedef NoInterface Client_; |
+ virtual ~NoInterface() {} |
+ virtual void SetClient(NoInterface* client) {} |
+}; |
+ |
+class NoInterfaceProxy : public NoInterface { |
+ public: |
+ explicit NoInterfaceProxy(MessageReceiver* receiver) {} |
+}; |
+ |
+class NoInterfaceStub : public MessageReceiver { |
+ public: |
+ NoInterfaceStub() {} |
+ void set_sink(NoInterface* sink) {} |
+ virtual bool Accept(Message* message) MOJO_OVERRIDE; |
+ virtual bool AcceptWithResponder(Message* message, MessageReceiver* responder) |
+ MOJO_OVERRIDE; |
+}; |
+ |
+ |
+// AnyInterface is for use in cases where any interface would do (e.g., see the |
+// Shell::Connect method). |
+ |
+typedef NoInterface AnyInterface; |
+ |
+} // namespace mojo |
+ |
+#endif // MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_ |