morrita | 6308f32 | 2015-01-27 07:42:54 +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 | |
morrita | 7d1bfcc | 2015-01-31 14:45:42 +0900 | [diff] [blame] | 8 | #include "base/files/file.h" |
| 9 | #include "base/macros.h" |
morrita | 6308f32 | 2015-01-27 07:42:54 +0900 | [diff] [blame] | 10 | #include "base/memory/ref_counted.h" |
rockot | 6dbfea5 | 2016-02-04 05:20:16 +0900 | [diff] [blame] | 11 | #include "base/pickle.h" |
avi | 42ebda4 | 2015-12-22 11:39:04 +0900 | [diff] [blame] | 12 | #include "build/build_config.h" |
sammc | 1458336 | 2016-11-23 12:17:35 +0900 | [diff] [blame] | 13 | #include "ipc/ipc.mojom.h" |
morrita | 6308f32 | 2015-01-27 07:42:54 +0900 | [diff] [blame] | 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. |
rockot | 6dbfea5 | 2016-02-04 05:20:16 +0900 | [diff] [blame] | 20 | class IPC_EXPORT MessageAttachment : public base::Pickle::Attachment { |
morrita | 6308f32 | 2015-01-27 07:42:54 +0900 | [diff] [blame] | 21 | public: |
sammc | 1458336 | 2016-11-23 12:17:35 +0900 | [diff] [blame] | 22 | using Type = mojom::SerializedHandle::Type; |
morrita | 6308f32 | 2015-01-27 07:42:54 +0900 | [diff] [blame] | 23 | |
| 24 | virtual Type GetType() const = 0; |
morrita | 1b52e4c | 2015-02-06 09:58:30 +0900 | [diff] [blame] | 25 | |
morrita | 6308f32 | 2015-01-27 07:42:54 +0900 | [diff] [blame] | 26 | protected: |
erikchen | e7e3092 | 2015-10-31 08:16:29 +0900 | [diff] [blame] | 27 | friend class base::RefCountedThreadSafe<MessageAttachment>; |
morrita | 7d1bfcc | 2015-01-31 14:45:42 +0900 | [diff] [blame] | 28 | MessageAttachment(); |
rockot | 6dbfea5 | 2016-02-04 05:20:16 +0900 | [diff] [blame] | 29 | ~MessageAttachment() override; |
morrita | 7d1bfcc | 2015-01-31 14:45:42 +0900 | [diff] [blame] | 30 | |
| 31 | DISALLOW_COPY_AND_ASSIGN(MessageAttachment); |
morrita | 6308f32 | 2015-01-27 07:42:54 +0900 | [diff] [blame] | 32 | }; |
| 33 | |
| 34 | } // namespace IPC |
| 35 | |
| 36 | #endif // IPC_IPC_MESSAGE_ATTACHMENT_H_ |