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.
4
5#ifndef MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_
6#define MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_
7
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"
11
12namespace mojo {
13
14// NoInterface is for use in cases when a non-existent or empty interface is
15// needed.
16
17class NoInterfaceProxy;
18class NoInterfaceStub;
19
20class 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  virtual ~NoInterface() {}
28};
29
30class NoInterfaceProxy : public NoInterface {
31 public:
32  explicit NoInterfaceProxy(MessageReceiver* receiver) {}
33};
34
35class NoInterfaceStub : public MessageReceiverWithResponder {
36 public:
37  NoInterfaceStub() {}
38  void set_sink(NoInterface* sink) {}
39  NoInterface* sink() { return nullptr; }
40  bool Accept(Message* message) override;
41  bool AcceptWithResponder(Message* message,
42                           MessageReceiver* responder) override;
43};
44
45// AnyInterface is for use in cases where any interface would do (e.g., see the
46// Shell::Connect method).
47
48typedef NoInterface AnyInterface;
49
50}  // namespace mojo
51
52#endif  // MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_
53