Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / mojo / public / cpp / bindings / no_interface.h
blobc8ce98f3fc579cbe6842c73fe47e645669425745
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
3 // found in the LICENSE file.
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_
8 #include "mojo/public/cpp/bindings/message.h"
9 #include "mojo/public/cpp/bindings/message_filter.h"
10 #include "mojo/public/cpp/system/core.h"
12 namespace mojo {
14 // NoInterface is for use in cases when a non-existent or empty interface is
15 // needed (e.g., when the Mojom "Peer" attribute is not present).
17 class NoInterfaceProxy;
18 class NoInterfaceStub;
20 class NoInterface {
21 public:
22 static const char* Name_;
23 typedef NoInterfaceProxy Proxy_;
24 typedef NoInterfaceStub Stub_;
25 typedef PassThroughFilter RequestValidator_;
26 typedef PassThroughFilter ResponseValidator_;
27 typedef NoInterface Client;
28 virtual ~NoInterface() {}
31 class NoInterfaceProxy : public NoInterface {
32 public:
33 explicit NoInterfaceProxy(MessageReceiver* receiver) {}
36 class NoInterfaceStub : public MessageReceiverWithResponder {
37 public:
38 NoInterfaceStub() {}
39 void set_sink(NoInterface* sink) {}
40 NoInterface* sink() { return NULL; }
41 virtual bool Accept(Message* message) MOJO_OVERRIDE;
42 virtual bool AcceptWithResponder(Message* message, MessageReceiver* responder)
43 MOJO_OVERRIDE;
47 // AnyInterface is for use in cases where any interface would do (e.g., see the
48 // Shell::Connect method).
50 typedef NoInterface AnyInterface;
52 } // namespace mojo
54 #endif // MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_