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

Side by Side Diff: mojo/public/cpp/bindings/lib/pipe_control_message_handler.h

Issue 2114523002: Move more Mojo bindings helpers out of internal namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@group-controller
Patch Set: rebase Created 4 years, 5 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
OLDNEW
(Empty)
1 // Copyright 2015 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_LIB_PIPE_CONTROL_MESSAGE_HANDLER_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_PIPE_CONTROL_MESSAGE_HANDLER_H_
7
8 #include "base/macros.h"
9 #include "mojo/public/cpp/bindings/interface_id.h"
10 #include "mojo/public/cpp/bindings/lib/serialization_context.h"
11 #include "mojo/public/cpp/bindings/message.h"
12
13 namespace mojo {
14 namespace internal {
15
16 class PipeControlMessageHandlerDelegate;
17
18 // Handler for messages defined in pipe_control_messages.mojom.
19 class PipeControlMessageHandler : public MessageReceiver {
20 public:
21 explicit PipeControlMessageHandler(
22 PipeControlMessageHandlerDelegate* delegate);
23 ~PipeControlMessageHandler() override;
24
25 // Sets the description for this handler. Used only when reporting validation
26 // errors.
27 void SetDescription(const std::string& description);
28
29 // NOTE: |message| must have passed message header validation.
30 static bool IsPipeControlMessage(const Message* message);
31
32 // MessageReceiver implementation:
33
34 // NOTE: |message| must:
35 // - have passed message header validation; and
36 // - be a pipe control message (i.e., IsPipeControlMessage() returns true).
37 // If the method returns false, the message pipe should be closed.
38 bool Accept(Message* message) override;
39
40 private:
41 // |message| must have passed message header validation.
42 bool Validate(Message* message);
43 bool RunOrClosePipe(Message* message);
44
45 std::string description_;
46 PipeControlMessageHandlerDelegate* const delegate_;
47 SerializationContext context_;
48
49 DISALLOW_COPY_AND_ASSIGN(PipeControlMessageHandler);
50 };
51
52 } // namespace internal
53 } // namespace mojo
54
55 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_PIPE_CONTROL_MESSAGE_HANDLER_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/multiplex_router.cc ('k') | mojo/public/cpp/bindings/lib/pipe_control_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698