[Android] Merge the remaining _staging.xml resources
[chromium-blink-merge.git] / ipc / ipc_message_attachment.h
blob63dddfe4182dc69a87abf0053054b8886534d84b
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.
5 #ifndef IPC_IPC_MESSAGE_ATTACHMENT_H_
6 #define IPC_IPC_MESSAGE_ATTACHMENT_H_
8 #include "base/files/file.h"
9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h"
11 #include "ipc/ipc_export.h"
13 namespace IPC {
15 // Auxiliary data sent with |Message|. This can be a platform file descriptor
16 // or a mojo |MessagePipe|. |GetType()| returns the type of the subclass.
17 class IPC_EXPORT MessageAttachment
18 : public base::RefCounted<MessageAttachment> {
19 public:
20 enum Type {
21 TYPE_PLATFORM_FILE, // The instance is |PlatformFileAttachment|.
22 TYPE_MOJO_HANDLE, // The instance is |MojoHandleAttachment|.
23 TYPE_WIN_HANDLE, // The instance is |HandleAttachmentWin|.
26 virtual Type GetType() const = 0;
28 #if defined(OS_POSIX)
29 virtual base::PlatformFile TakePlatformFile() = 0;
30 #endif // OS_POSIX
32 protected:
33 friend class base::RefCounted<MessageAttachment>;
34 MessageAttachment();
35 virtual ~MessageAttachment();
37 DISALLOW_COPY_AND_ASSIGN(MessageAttachment);
40 } // namespace IPC
42 #endif // IPC_IPC_MESSAGE_ATTACHMENT_H_