Remove unused parts of IPC::ChannelHandle.

In SFI NaCl, ChannelHandle is just a file descriptor. On other platforms
it's just a mojo message pipe handle. This CL removes the other unused
fields. It also removes IPC::Channel::GenerateMojoChannelHandlePair()
and updates its remaining use.

BUG=659448

Review-Url: https://codereview.chromium.org/2484943004
Cr-Commit-Position: refs/heads/master@{#431821}
diff --git a/ipc/ipc_channel_handle.h b/ipc/ipc_channel_handle.h
index 8a344fd3..ef31b843 100644
--- a/ipc/ipc_channel_handle.h
+++ b/ipc/ipc_channel_handle.h
@@ -10,71 +10,31 @@
 #include "build/build_config.h"
 #include "mojo/public/cpp/system/message_pipe.h"
 
-#if defined(OS_POSIX)
+#if defined(OS_NACL_SFI)
 #include "base/file_descriptor_posix.h"
-#elif defined(OS_WIN)
-#include <windows.h>
-#endif  // defined (OS_WIN)
-
-// On Windows, any process can create an IPC channel and others can fetch
-// it by name.  We pass around the channel names over IPC.
-// On Windows the initialization of ChannelHandle with an existing pipe
-// handle is provided for convenience.
-// NOTE: A ChannelHandle with a pipe handle Will NOT be marshalled over IPC.
-
-// On POSIX, we instead pass around handles to channel endpoints via IPC.
-// When it's time to IPC a new channel endpoint around, we send both the
-// channel name as well as a base::FileDescriptor, which is itself a special
-// type that knows how to copy a socket endpoint over IPC.
-//
-// In sum, this data structure can be used to pass channel information by name
-// in both Windows and Posix. When passing a handle to a channel over IPC,
-// use this data structure only for POSIX.
+#endif  // defined (OS_NACL_SFI)
 
 namespace IPC {
 
+// Note that serialization for this object is defined in the ParamTraits
+// template specialization in ipc_message_utils.h.
+#if defined(OS_NACL_SFI)
 struct ChannelHandle {
-  // Note that serialization for this object is defined in the ParamTraits
-  // template specialization in ipc_message_utils.h.
   ChannelHandle() {}
-  // The name that is passed in should be an absolute path for Posix.
-  // Otherwise there may be a problem in IPC communication between
-  // processes with different working directories.
-  ChannelHandle(const std::string& n) : name(n) {}
-  ChannelHandle(const char* n) : name(n) {}
-#if defined(OS_WIN)
-  explicit ChannelHandle(HANDLE h) : pipe(h) {}
-#elif defined(OS_POSIX)
-  ChannelHandle(const std::string& n, const base::FileDescriptor& s)
-      : name(n), socket(s) {}
-#endif  // defined(OS_POSIX)
+  explicit ChannelHandle(const base::FileDescriptor& s) : socket(s) {}
+
+  base::FileDescriptor socket;
+};
+#else
+struct ChannelHandle {
+  ChannelHandle() {}
   ChannelHandle(mojo::MessagePipeHandle h) : mojo_handle(h) {}
 
-  bool is_mojo_channel_handle() const {
-#if defined(OS_WIN)
-    if (pipe.handle)
-      return false;
-#elif defined(OS_POSIX)
-    if (socket.fd != -1)
-      return false;
-#endif  // defined(OS_POSIX)
-    return mojo_handle.is_valid() && name.empty();
-  }
+  bool is_mojo_channel_handle() const { return mojo_handle.is_valid(); }
 
-  std::string name;
-#if defined(OS_POSIX)
-  base::FileDescriptor socket;
-#elif defined(OS_WIN)
-  // A simple container to automatically initialize pipe handle
-  struct PipeHandle {
-    PipeHandle() : handle(NULL) {}
-    PipeHandle(HANDLE h) : handle(h) {}
-    HANDLE handle;
-  };
-  PipeHandle pipe;
-#endif  // defined (OS_WIN)
   mojo::MessagePipeHandle mojo_handle;
 };
+#endif  // defined(OS_NACL_SFI)
 
 }  // namespace IPC