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 IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ | 5 #ifndef IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ |
6 #define IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ | 6 #define IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ipc/attachment_broker.h" | 10 #include "ipc/attachment_broker.h" |
11 #include "ipc/ipc_export.h" | 11 #include "ipc/ipc_export.h" |
12 | 12 |
13 namespace IPC { | 13 namespace IPC { |
14 | 14 |
15 class Channel; | 15 class Endpoint; |
| 16 class Sender; |
16 | 17 |
17 // This abstract subclass of AttachmentBroker is intended for use in a | 18 // This abstract subclass of AttachmentBroker is intended for use in a |
18 // privileged process . When unprivileged processes want to send attachments, | 19 // privileged process . When unprivileged processes want to send attachments, |
19 // the attachments get routed through the privileged process, and more | 20 // the attachments get routed through the privileged process, and more |
20 // specifically, an instance of this class. | 21 // specifically, an instance of this class. |
21 class IPC_EXPORT AttachmentBrokerPrivileged : public IPC::AttachmentBroker { | 22 class IPC_EXPORT AttachmentBrokerPrivileged : public IPC::AttachmentBroker { |
22 public: | 23 public: |
23 AttachmentBrokerPrivileged(); | 24 AttachmentBrokerPrivileged(); |
24 ~AttachmentBrokerPrivileged() override; | 25 ~AttachmentBrokerPrivileged() override; |
25 | 26 |
26 // Each unprivileged process should have one IPC channel on which it | 27 // Each unprivileged process should have one IPC channel on which it |
27 // communicates attachment information with the broker process. In the broker | 28 // communicates attachment information with the broker process. In the broker |
28 // process, these channels must be registered and deregistered with the | 29 // process, these channels must be registered and deregistered with the |
29 // Attachment Broker as they are created and destroyed. | 30 // Attachment Broker as they are created and destroyed. |
30 void RegisterCommunicationChannel(Channel* channel); | 31 void RegisterCommunicationChannel(Endpoint* endpoint); |
31 void DeregisterCommunicationChannel(Channel* channel); | 32 void DeregisterCommunicationChannel(Endpoint* endpoint); |
32 | 33 |
33 protected: | 34 protected: |
34 // Returns nullptr if no channel is found. | 35 // Returns the sender whose peer's process id is |id|. |
35 Channel* GetChannelWithProcessId(base::ProcessId id); | 36 // Returns nullptr if no sender is found. |
| 37 Sender* GetSenderWithProcessId(base::ProcessId id); |
36 | 38 |
37 private: | 39 private: |
38 std::vector<Channel*> channels_; | 40 std::vector<Endpoint*> endpoints_; |
39 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivileged); | 41 DISALLOW_COPY_AND_ASSIGN(AttachmentBrokerPrivileged); |
40 }; | 42 }; |
41 | 43 |
42 } // namespace IPC | 44 } // namespace IPC |
43 | 45 |
44 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ | 46 #endif // IPC_ATTACHMENT_BROKER_PRIVILEGED_H_ |
OLD | NEW |