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