Introduce IPC::Channel::Create*() to ensure it being heap-allocated.

This change introduces IPC::Channel::Create*() API to turn
IPC::Channel into a heap allocated object. This will allow us to
make Channel a polymorphic class.

This change also tries to hide Channel::Mode from public API
so that we can simplify channel creation code paths cleaner in
following changes. ChannelProxy has to follow same pattern to
finish this cleanup. Such changes will follow.

TEST=none
BUG=377980
R=darin@chromium.org,cpu@chromium.org

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=273575

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273713 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: e482111a87c5415af8aaf33636f00c650c19b61e
diff --git a/ipc/ipc_channel_unittest.cc b/ipc/ipc_channel_unittest.cc
index eea432a..b9665db 100644
--- a/ipc/ipc_channel_unittest.cc
+++ b/ipc/ipc_channel_unittest.cc
@@ -254,12 +254,12 @@
   GenericChannelListener listener;
 
   // Set up IPC channel.
-  IPC::Channel channel(IPCTestBase::GetChannelName("GenericClient"),
-                       IPC::Channel::MODE_CLIENT,
-                       &listener);
-  CHECK(channel.Connect());
-  listener.Init(&channel);
-  Send(&channel, "hello from child");
+  scoped_ptr<IPC::Channel> channel(IPC::Channel::CreateClient(
+      IPCTestBase::GetChannelName("GenericClient"),
+      &listener));
+  CHECK(channel->Connect());
+  listener.Init(channel.get());
+  Send(channel.get(), "hello from child");
 
   base::MessageLoop::current()->Run();
   return 0;