Add new ipc message utility and new message types in preparation for OOP import patch.  This patch adds the ability to move a set across IPC, and adds two new message types.

BUG= 18774
TEST= none
Review URL: http://codereview.chromium.org/2097001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47172 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index bad5fc2..df2c6c7 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -9,6 +9,7 @@
 #include <string>
 #include <vector>
 #include <map>
+#include <set>
 
 #include "base/file_path.h"
 #include "base/format_macros.h"
@@ -38,6 +39,8 @@
   PluginProcessHostMsgStart,
   PluginMsgStart,
   PluginHostMsgStart,
+  ProfileImportProcessMsgStart,
+  ProfileImportProcessHostMsgStart,
   NPObjectMsgStart,
   TestMsgStart,
   DevToolsAgentMsgStart,
@@ -467,12 +470,38 @@
     for (size_t i = 0; i < p.size(); ++i) {
       if (i != 0)
         l->append(L" ");
-
       LogParam((p[i]), l);
     }
   }
 };
 
+template <class P>
+struct ParamTraits<std::set<P> > {
+  typedef std::set<P> param_type;
+  static void Write(Message* m, const param_type& p) {
+    WriteParam(m, static_cast<int>(p.size()));
+    typename param_type::const_iterator iter;
+    for (iter = p.begin(); iter != p.end(); ++iter)
+      WriteParam(m, *iter);
+  }
+  static bool Read(const Message* m, void** iter, param_type* r) {
+    int size;
+    if (!m->ReadLength(iter, &size))
+      return false;
+    for (int i = 0; i < size; ++i) {
+      P item;
+      if (!ReadParam(m, iter, &item))
+        return false;
+      r->insert(item);
+    }
+    return true;
+  }
+  static void Log(const param_type& p, std::wstring* l) {
+    l->append(L"<std::set>");
+  }
+};
+
+
 template <class K, class V>
 struct ParamTraits<std::map<K, V> > {
   typedef std::map<K, V> param_type;