Chromium Code Reviews| Index: mojo/public/cpp/bindings/lib/message_validator.h |
| diff --git a/mojo/public/cpp/bindings/lib/message_validator.h b/mojo/public/cpp/bindings/lib/message_validator.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0f5ed39a201393f2134aad16708d30ac744d3d3f |
| --- /dev/null |
| +++ b/mojo/public/cpp/bindings/lib/message_validator.h |
| @@ -0,0 +1,38 @@ |
| +// 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_LIB_MESSAGE_VALIDATOR_H_ |
| +#define MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_VALIDATOR_H_ |
| + |
| +#include "mojo/public/cpp/bindings/message.h" |
| +#include "mojo/public/cpp/system/macros.h" |
| + |
| +namespace mojo { |
| +namespace internal { |
| + |
| +// This class is the base class for message validators. Subclasses should |
| +// implement the pure virtual method Accept() inherited from MessageReceiver. |
| +class MessageValidator : public MessageReceiver { |
|
darin (slow to review)
2014/05/12 17:28:26
Hmm... there's nothing about this class that makes
yzshen1
2014/05/12 21:59:58
I like the name of MessageFilter!
|
| + public: |
| + // Doesn't take ownership of |next|. Therefore |next| has to stay alive while |
| + // this object is alive. If |next| is NULL, set_next() has to be called before |
| + // this object can be used to validate messages. |
| + explicit MessageValidator(MessageReceiver* next = NULL); |
| + virtual ~MessageValidator(); |
| + |
| + void set_next(MessageReceiver* next) { next_ = next; } |
| + |
| + protected: |
| + MessageReceiver* next_; |
| + |
| + private: |
| + // MessageReceiver method that shouldn't be reached. |
| + virtual bool AcceptWithResponder(Message* message, |
| + MessageReceiver* responder) MOJO_OVERRIDE; |
| +}; |
| + |
| +} // namespace internal |
| +} // namespace mojo |
| + |
| +#endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_VALIDATOR_H_ |