Switch global error menu icon to vectorized MD asset
[chromium-blink-merge.git] / ipc / ipc_endpoint.h
blob2ace1fe999c946ace33079e70747adb2d736623e
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.
5 #ifndef IPC_IPC_ENDPOINT_H_
6 #define IPC_IPC_ENDPOINT_H_
8 #include "base/process/process_handle.h"
9 #include "ipc/ipc_export.h"
10 #include "ipc/ipc_sender.h"
12 namespace IPC {
14 // An Endpoint is an abstract base class whose interface provides sending
15 // functionality, and some receiving functionality. It mostly exists to provide
16 // a common interface to Channel and ProxyChannel.
17 class IPC_EXPORT Endpoint : public Sender {
18 public:
19 Endpoint();
20 ~Endpoint() override {}
22 // Get the process ID for the connected peer.
24 // Returns base::kNullProcessId if the peer is not connected yet. Watch out
25 // for race conditions. You can easily get a channel to another process, but
26 // if your process has not yet processed the "hello" message from the remote
27 // side, this will fail. You should either make sure calling this is either
28 // in response to a message from the remote side (which guarantees that it's
29 // been connected), or you wait for the "connected" notification on the
30 // listener.
31 virtual base::ProcessId GetPeerPID() const = 0;
33 // A callback that indicates that is_attachment_broker_endpoint() has been
34 // changed.
35 virtual void OnSetAttachmentBrokerEndpoint(){};
37 // Whether this channel is used as an endpoint for sending and receiving
38 // brokerable attachment messages to/from the broker process.
39 void SetAttachmentBrokerEndpoint(bool is_endpoint);
41 protected:
42 bool is_attachment_broker_endpoint() { return attachment_broker_endpoint_; }
44 private:
45 // Whether this channel is used as an endpoint for sending and receiving
46 // brokerable attachment messages to/from the broker process.
47 bool attachment_broker_endpoint_;
50 } // namespace IPC
52 #endif // IPC_IPC_ENDPOINT_H_