IPC: Introduce MessageAttachment and PlatformFileAttachment.

This is another preparation for crbug.com/448190.
This change encapsulates a platform file as a MessageAttachment
abstract class and its subclass called PlatformFileAttachment.
This abstraction allows MessageAttachmentSet to contain not only
platform files, but also a mojo MessagePipes, which will be
encapsulated by another MessageAttachment subclass.

BUG=448190
[email protected], [email protected]

Review URL: https://codereview.chromium.org/856443003

Cr-Commit-Position: refs/heads/master@{#313157}
diff --git a/ipc/ipc_platform_file_attachment.cc b/ipc/ipc_platform_file_attachment.cc
new file mode 100644
index 0000000..5430c6d
--- /dev/null
+++ b/ipc/ipc_platform_file_attachment.cc
@@ -0,0 +1,28 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ipc/ipc_platform_file_attachment.h"
+
+namespace IPC {
+namespace internal {
+
+PlatformFileAttachment::PlatformFileAttachment(base::PlatformFile file)
+    : file_(file) {
+}
+
+PlatformFileAttachment::~PlatformFileAttachment() {
+}
+
+MessageAttachment::Type PlatformFileAttachment::GetType() const {
+  return TYPE_PLATFORM_FILE;
+}
+
+base::PlatformFile GetPlatformFile(
+    scoped_refptr<MessageAttachment> attachment) {
+  DCHECK_EQ(attachment->GetType(), MessageAttachment::TYPE_PLATFORM_FILE);
+  return static_cast<PlatformFileAttachment*>(attachment.get())->file();
+}
+
+}  // namespace internal
+}  // namespace IPC