OLD | NEW |
(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 IPC_ATTACHMENT_BROKER_H_ |
| 6 #define IPC_ATTACHMENT_BROKER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/process/process_handle.h" |
| 10 #include "ipc/brokerable_attachment.h" |
| 11 #include "ipc/ipc_export.h" |
| 12 |
| 13 namespace IPC { |
| 14 |
| 15 class AttachmentBroker; |
| 16 // Classes that inherit from this abstract base class are capable of |
| 17 // communicating with a broker to send and receive attachments to Chrome IPC |
| 18 // messages. |
| 19 class IPC_EXPORT SupportsAttachmentBrokering { |
| 20 public: |
| 21 // Returns an AttachmentBroker used to broker attachments of IPC messages to |
| 22 // other processes. There must be exactly one AttachmentBroker per process. |
| 23 virtual AttachmentBroker* GetAttachmentBroker() = 0; |
| 24 }; |
| 25 |
| 26 // Responsible for brokering attachments to Chrome IPC messages. On platforms |
| 27 // that support attachment brokering, every IPC channel should have an |
| 28 // AttachmentBroker. |
| 29 class IPC_EXPORT AttachmentBroker { |
| 30 public: |
| 31 AttachmentBroker() {} |
| 32 virtual ~AttachmentBroker() {} |
| 33 |
| 34 // Sends |attachment| to |destination_process|. The implementation uses an |
| 35 // IPC::Channel to communicate with the broker process. This may be the same |
| 36 // IPC::Channel that is requesting the brokerage of an attachment. |
| 37 virtual void SendAttachmentToProcess( |
| 38 internal::BrokerableAttachment* attachment, |
| 39 base::ProcessId destination_process) = 0; |
| 40 |
| 41 // Returns whether the attachment was available. If the attachment was |
| 42 // available, populates the output parameter |attachment|. The caller then |
| 43 // becomes the owner of |attachment|. |
| 44 virtual bool GetAttachmentWithId( |
| 45 BrokerableAttachmentId, |
| 46 internal::BrokerableAttachment* attachment) = 0; |
| 47 |
| 48 private: |
| 49 DISALLOW_COPY_AND_ASSIGN(AttachmentBroker); |
| 50 }; |
| 51 |
| 52 } // namespace IPC |
| 53 |
| 54 #endif // IPC_ATTACHMENT_BROKER_H_ |
OLD | NEW |