OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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_LIB_CONTROL_MESSAGE_PROXY_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_PROXY_H_ |
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_PROXY_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_PROXY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <string> |
| 11 |
10 #include "base/callback.h" | 12 #include "base/callback.h" |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "mojo/public/cpp/bindings/lib/serialization_context.h" | 14 #include "mojo/public/cpp/bindings/lib/serialization_context.h" |
13 | 15 |
14 namespace mojo { | 16 namespace mojo { |
15 | 17 |
16 class MessageReceiverWithResponder; | 18 class MessageReceiverWithResponder; |
17 | 19 |
18 namespace internal { | 20 namespace internal { |
19 | 21 |
20 // Proxy for request messages defined in interface_control_messages.mojom. | 22 // Proxy for request messages defined in interface_control_messages.mojom. |
21 class ControlMessageProxy { | 23 class ControlMessageProxy { |
22 public: | 24 public: |
23 // Doesn't take ownership of |receiver|. It must outlive this object. | 25 // Doesn't take ownership of |receiver|. It must outlive this object. |
24 explicit ControlMessageProxy(MessageReceiverWithResponder* receiver); | 26 explicit ControlMessageProxy(MessageReceiverWithResponder* receiver); |
25 ~ControlMessageProxy(); | 27 ~ControlMessageProxy(); |
26 | 28 |
27 void QueryVersion(const base::Callback<void(uint32_t)>& callback); | 29 void QueryVersion(const base::Callback<void(uint32_t)>& callback); |
28 void RequireVersion(uint32_t version); | 30 void RequireVersion(uint32_t version); |
29 | 31 |
30 void FlushForTesting(); | 32 void FlushForTesting(); |
| 33 void SendDisconnectReason(uint32_t custom_reason, |
| 34 const std::string& description); |
31 | 35 |
32 void OnConnectionError(); | 36 void OnConnectionError(); |
33 | 37 |
34 private: | 38 private: |
35 void RunFlushForTestingClosure(); | 39 void RunFlushForTestingClosure(); |
36 | 40 |
37 // Not owned. | 41 // Not owned. |
38 MessageReceiverWithResponder* receiver_; | 42 MessageReceiverWithResponder* receiver_; |
39 SerializationContext context_; | 43 SerializationContext context_; |
40 bool encountered_error_ = false; | 44 bool encountered_error_ = false; |
41 | 45 |
42 base::Closure run_loop_quit_closure_; | 46 base::Closure run_loop_quit_closure_; |
43 | 47 |
44 DISALLOW_COPY_AND_ASSIGN(ControlMessageProxy); | 48 DISALLOW_COPY_AND_ASSIGN(ControlMessageProxy); |
45 }; | 49 }; |
46 | 50 |
47 } // namespace internal | 51 } // namespace internal |
48 } // namespace mojo | 52 } // namespace mojo |
49 | 53 |
50 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_PROXY_H_ | 54 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_PROXY_H_ |
OLD | NEW |