Hidehiko Abe | b268b43 | 2018-04-24 01:37:19 +0900 | [diff] [blame] | 1 | // Copyright (c) 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_IPC_MESSAGE_ATTACHMENT_H_ |
| 6 | #define IPC_IPC_MESSAGE_ATTACHMENT_H_ |
| 7 | |
| 8 | #include "base/files/file.h" |
| 9 | #include "base/macros.h" |
| 10 | #include "base/memory/ref_counted.h" |
| 11 | #include "base/pickle.h" |
| 12 | #include "build/build_config.h" |
| 13 | #include "ipc/ipc.mojom.h" |
| 14 | #include "ipc/ipc_export.h" |
| 15 | |
| 16 | namespace IPC { |
| 17 | |
| 18 | // Auxiliary data sent with |Message|. This can be a platform file descriptor |
| 19 | // or a mojo |MessagePipe|. |GetType()| returns the type of the subclass. |
| 20 | class IPC_EXPORT MessageAttachment : public base::Pickle::Attachment { |
| 21 | public: |
| 22 | using Type = mojom::SerializedHandle::Type; |
| 23 | |
| 24 | virtual Type GetType() const = 0; |
| 25 | |
| 26 | protected: |
| 27 | friend class base::RefCountedThreadSafe<MessageAttachment>; |
| 28 | MessageAttachment(); |
| 29 | ~MessageAttachment() override; |
| 30 | |
| 31 | DISALLOW_COPY_AND_ASSIGN(MessageAttachment); |
| 32 | }; |
| 33 | |
| 34 | } // namespace IPC |
| 35 | |
| 36 | #endif // IPC_IPC_MESSAGE_ATTACHMENT_H_ |