Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: mojo/public/cpp/bindings/no_interface.h

Issue 273233002: Mojo cpp bindings: add support for validating incoming messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase onto the InterfacePtr change Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/system/core.h" 11 #include "mojo/public/cpp/system/core.h"
12 12
13 namespace mojo { 13 namespace mojo {
14 14
15 // NoValidator is for use in cases when message validation is not needed.
16 class NoValidator {
17 };
18
15 // NoInterface is for use in cases when a non-existent or empty interface is 19 // NoInterface is for use in cases when a non-existent or empty interface is
16 // needed (e.g., when the Mojom "Peer" attribute is not present). 20 // needed (e.g., when the Mojom "Peer" attribute is not present).
17 21
18 class NoInterfaceProxy; 22 class NoInterfaceProxy;
19 class NoInterfaceStub; 23 class NoInterfaceStub;
20 24
21 class NoInterface { 25 class NoInterface {
22 public: 26 public:
23 typedef NoInterfaceProxy Proxy_; 27 typedef NoInterfaceProxy Proxy_;
24 typedef NoInterfaceStub Stub_; 28 typedef NoInterfaceStub Stub_;
29 typedef NoValidator RequestValidator_;
30 typedef NoValidator ResponseValidator_;
25 typedef NoInterface Client_; 31 typedef NoInterface Client_;
26 virtual ~NoInterface() {} 32 virtual ~NoInterface() {}
27 virtual void SetClient(NoInterface* client) {} 33 virtual void SetClient(NoInterface* client) {}
28 }; 34 };
29 35
30 class NoInterfaceProxy : public NoInterface { 36 class NoInterfaceProxy : public NoInterface {
31 public: 37 public:
32 explicit NoInterfaceProxy(MessageReceiver* receiver) {} 38 explicit NoInterfaceProxy(MessageReceiver* receiver) {}
33 }; 39 };
34 40
35 class NoInterfaceStub : public MessageReceiver { 41 class NoInterfaceStub : public MessageReceiver {
36 public: 42 public:
37 NoInterfaceStub() {} 43 NoInterfaceStub() {}
38 void set_sink(NoInterface* sink) {} 44 void set_sink(NoInterface* sink) {}
39 virtual bool Accept(Message* message) MOJO_OVERRIDE; 45 virtual bool Accept(Message* message) MOJO_OVERRIDE;
40 virtual bool AcceptWithResponder(Message* message, MessageReceiver* responder) 46 virtual bool AcceptWithResponder(Message* message, MessageReceiver* responder)
41 MOJO_OVERRIDE; 47 MOJO_OVERRIDE;
42 }; 48 };
43 49
44 50
45 // AnyInterface is for use in cases where any interface would do (e.g., see the 51 // AnyInterface is for use in cases where any interface would do (e.g., see the
46 // Shell::Connect method). 52 // Shell::Connect method).
47 53
48 typedef NoInterface AnyInterface; 54 typedef NoInterface AnyInterface;
49 55
50 } // namespace mojo 56 } // namespace mojo
51 57
52 #endif // MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_ 58 #endif // MOJO_PUBLIC_CPP_BINDINGS_NO_INTERFACE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698