Pepper: More interface_list cleanup.

This change removes a deprecated AddPPP() interface, and a new unnecessary
InterfaceProxy::Info struct.

BUG=
[email protected]

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241352 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc
index 5662ea0d..57cd79cd 100644
--- a/ppapi/proxy/interface_list.cc
+++ b/ppapi/proxy/interface_list.cc
@@ -261,26 +261,31 @@
 
   // PPP (plugin) interfaces.
   // TODO(brettw) move these to interface_list*.h
+  AddProxy(API_ID_PPP_GRAPHICS_3D, &ProxyFactory<PPP_Graphics3D_Proxy>);
+  AddPPP(PPP_GRAPHICS_3D_INTERFACE, PPP_Graphics3D_Proxy::GetProxyInterface());
+  AddProxy(API_ID_PPP_INPUT_EVENT, &ProxyFactory<PPP_InputEvent_Proxy>);
+  AddPPP(PPP_INPUT_EVENT_INTERFACE, PPP_InputEvent_Proxy::GetProxyInterface());
   AddProxy(API_ID_PPP_INSTANCE, &ProxyFactory<PPP_Instance_Proxy>);
-  #if !defined(OS_NACL)
+#if !defined(OS_NACL)
   AddPPP(PPP_INSTANCE_INTERFACE_1_1,
          PPP_Instance_Proxy::GetInstanceInterface());
-  #endif
+  AddProxy(API_ID_PPP_INSTANCE_PRIVATE,
+           &ProxyFactory<PPP_Instance_Private_Proxy>);
+  AddPPP(PPP_INSTANCE_PRIVATE_INTERFACE,
+         PPP_Instance_Private_Proxy::GetProxyInterface());
+#endif
+  AddProxy(API_ID_PPP_MESSAGING, &ProxyFactory<PPP_Messaging_Proxy>);
+  AddPPP(PPP_MESSAGING_INTERFACE, PPP_Messaging_Proxy::GetProxyInterface());
+  AddProxy(API_ID_PPP_MOUSE_LOCK, &ProxyFactory<PPP_MouseLock_Proxy>);
+  AddPPP(PPP_MOUSELOCK_INTERFACE, PPP_MouseLock_Proxy::GetProxyInterface());
   AddProxy(API_ID_PPP_PRINTING, &ProxyFactory<PPP_Printing_Proxy>);
   AddPPP(PPP_PRINTING_DEV_INTERFACE, PPP_Printing_Proxy::GetProxyInterface());
   AddProxy(API_ID_PPP_TEXT_INPUT, &ProxyFactory<PPP_TextInput_Proxy>);
   AddPPP(PPP_TEXTINPUT_DEV_INTERFACE, PPP_TextInput_Proxy::GetProxyInterface());
-
-  // Old-style GetInfo PPP interfaces.
-  // Do not add more stuff here, they should be added to interface_list*.h
-  // TODO(brettw) remove these.
-  AddPPP(PPP_InputEvent_Proxy::GetInfo());
-  AddPPP(PPP_Messaging_Proxy::GetInfo());
-  AddPPP(PPP_MouseLock_Proxy::GetInfo());
-  AddPPP(PPP_Graphics3D_Proxy::GetInfo());
 #if !defined(OS_NACL)
-  AddPPP(PPP_Instance_Private_Proxy::GetInfo());
-  AddPPP(PPP_VideoDecoder_Proxy::GetInfo());
+  AddProxy(API_ID_PPP_VIDEO_DECODER_DEV, &ProxyFactory<PPP_VideoDecoder_Proxy>);
+  AddPPP(PPP_VIDEODECODER_DEV_INTERFACE,
+         PPP_VideoDecoder_Proxy::GetProxyInterface());
 #endif
 }
 
@@ -363,10 +368,5 @@
   name_to_plugin_info_[name] = InterfaceInfo(iface, PERMISSION_NONE);
 }
 
-void InterfaceList::AddPPP(const InterfaceProxy::Info* info) {
-  AddProxy(info->id, info->create_proxy);
-  AddPPP(info->name, info->interface_ptr);
-}
-
 }  // namespace proxy
 }  // namespace ppapi
diff --git a/ppapi/proxy/interface_list.h b/ppapi/proxy/interface_list.h
index 9a619941..27728f7 100644
--- a/ppapi/proxy/interface_list.h
+++ b/ppapi/proxy/interface_list.h
@@ -76,10 +76,6 @@
   void AddPPB(const char* name, const void* iface, Permission permission);
   void AddPPP(const char* name, const void* iface);
 
-  // Old-style add functions. These should be removed when the rest of the
-  // proxies are converted over to using the new system.
-  void AddPPP(const InterfaceProxy::Info* info);
-
   PpapiPermissions permissions_;
 
   NameToInterfaceInfoMap name_to_browser_info_;
diff --git a/ppapi/proxy/interface_proxy.h b/ppapi/proxy/interface_proxy.h
index dcab547..099d58b 100644
--- a/ppapi/proxy/interface_proxy.h
+++ b/ppapi/proxy/interface_proxy.h
@@ -24,24 +24,6 @@
   // is transferred to the caller.
   typedef InterfaceProxy* (*Factory)(Dispatcher* dispatcher);
 
-  // DEPRECATED: New classes should be registered directly in the interface
-  // list. This is kept around until we convert all the existing code.
-  //
-  // Information about the interface. Each interface has a static function to
-  // return its info, which allows either construction on the target side, and
-  // getting the proxied interface on the source side (see dispatcher.h for
-  // terminology).
-  struct Info {
-    const void* interface_ptr;
-
-    const char* name;
-    ApiID id;
-
-    bool is_trusted;
-
-    InterfaceProxy::Factory create_proxy;
-  };
-
   virtual ~InterfaceProxy();
 
   Dispatcher* dispatcher() const { return dispatcher_; }
diff --git a/ppapi/proxy/ppb_instance_proxy.cc b/ppapi/proxy/ppb_instance_proxy.cc
index 5d0e7ed3..324f342 100644
--- a/ppapi/proxy/ppb_instance_proxy.cc
+++ b/ppapi/proxy/ppb_instance_proxy.cc
@@ -61,10 +61,6 @@
     "argument from a PP_Var to a Javascript value. It may have cycles or be of "
     "an unsupported type.";
 
-InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher) {
-  return new PPB_Instance_Proxy(dispatcher);
-}
-
 void RequestSurroundingText(PP_Instance instance) {
   PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
   if (!dispatcher)
@@ -96,18 +92,6 @@
 PPB_Instance_Proxy::~PPB_Instance_Proxy() {
 }
 
-// static
-const InterfaceProxy::Info* PPB_Instance_Proxy::GetInfoPrivate() {
-  static const Info info = {
-    ppapi::thunk::GetPPB_Instance_Private_0_1_Thunk(),
-    PPB_INSTANCE_PRIVATE_INTERFACE_0_1,
-    API_ID_NONE,  // 1_0 is the canonical one.
-    false,
-    &CreateInstanceProxy,
-  };
-  return &info;
-}
-
 bool PPB_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) {
   // Prevent the dispatcher from going away during a call to ExecuteScript.
   // This must happen OUTSIDE of ExecuteScript since the SerializedVars use
diff --git a/ppapi/proxy/ppb_instance_proxy.h b/ppapi/proxy/ppb_instance_proxy.h
index 12e56b9..0737b58 100644
--- a/ppapi/proxy/ppb_instance_proxy.h
+++ b/ppapi/proxy/ppb_instance_proxy.h
@@ -39,8 +39,6 @@
   PPB_Instance_Proxy(Dispatcher* dispatcher);
   virtual ~PPB_Instance_Proxy();
 
-  static const Info* GetInfoPrivate();
-
   // InterfaceProxy implementation.
   virtual bool OnMessageReceived(const IPC::Message& msg);
 
diff --git a/ppapi/proxy/ppp_graphics_3d_proxy.cc b/ppapi/proxy/ppp_graphics_3d_proxy.cc
index ee00a92..b5f0ac1 100644
--- a/ppapi/proxy/ppp_graphics_3d_proxy.cc
+++ b/ppapi/proxy/ppp_graphics_3d_proxy.cc
@@ -29,10 +29,6 @@
 static const PPP_Graphics3D graphics_3d_interface = {};
 #endif  // !defined(OS_NACL)
 
-InterfaceProxy* CreateGraphics3DProxy(Dispatcher* dispatcher) {
-  return new PPP_Graphics3D_Proxy(dispatcher);
-}
-
 }  // namespace
 
 PPP_Graphics3D_Proxy::PPP_Graphics3D_Proxy(Dispatcher* dispatcher)
@@ -48,15 +44,8 @@
 }
 
 // static
-const InterfaceProxy::Info* PPP_Graphics3D_Proxy::GetInfo() {
-  static const Info info = {
-    &graphics_3d_interface,
-    PPP_GRAPHICS_3D_INTERFACE,
-    API_ID_PPP_GRAPHICS_3D,
-    false,
-    &CreateGraphics3DProxy,
-  };
-  return &info;
+const PPP_Graphics3D* PPP_Graphics3D_Proxy::GetProxyInterface() {
+  return &graphics_3d_interface;
 }
 
 bool PPP_Graphics3D_Proxy::OnMessageReceived(const IPC::Message& msg) {
diff --git a/ppapi/proxy/ppp_graphics_3d_proxy.h b/ppapi/proxy/ppp_graphics_3d_proxy.h
index 9b4d7a0..a6f7eb63b 100644
--- a/ppapi/proxy/ppp_graphics_3d_proxy.h
+++ b/ppapi/proxy/ppp_graphics_3d_proxy.h
@@ -18,7 +18,7 @@
   PPP_Graphics3D_Proxy(Dispatcher* dispatcher);
   virtual ~PPP_Graphics3D_Proxy();
 
-  static const Info* GetInfo();
+  static const PPP_Graphics3D* GetProxyInterface();
 
   // InterfaceProxy implementation.
   virtual bool OnMessageReceived(const IPC::Message& msg);
diff --git a/ppapi/proxy/ppp_input_event_proxy.cc b/ppapi/proxy/ppp_input_event_proxy.cc
index 8302dfd..cbf6a63 100644
--- a/ppapi/proxy/ppp_input_event_proxy.cc
+++ b/ppapi/proxy/ppp_input_event_proxy.cc
@@ -54,10 +54,6 @@
 static const PPP_InputEvent input_event_interface = {};
 #endif  // !defined(OS_NACL)
 
-InterfaceProxy* CreateInputEventProxy(Dispatcher* dispatcher) {
-  return new PPP_InputEvent_Proxy(dispatcher);
-}
-
 }  // namespace
 
 PPP_InputEvent_Proxy::PPP_InputEvent_Proxy(Dispatcher* dispatcher)
@@ -73,15 +69,8 @@
 }
 
 // static
-const InterfaceProxy::Info* PPP_InputEvent_Proxy::GetInfo() {
-  static const Info info = {
-    &input_event_interface,
-    PPP_INPUT_EVENT_INTERFACE,
-    API_ID_PPP_INPUT_EVENT,
-    false,
-    &CreateInputEventProxy,
-  };
-  return &info;
+const PPP_InputEvent* PPP_InputEvent_Proxy::GetProxyInterface() {
+  return &input_event_interface;
 }
 
 bool PPP_InputEvent_Proxy::OnMessageReceived(const IPC::Message& msg) {
diff --git a/ppapi/proxy/ppp_input_event_proxy.h b/ppapi/proxy/ppp_input_event_proxy.h
index a7cc054..9fbc418 100644
--- a/ppapi/proxy/ppp_input_event_proxy.h
+++ b/ppapi/proxy/ppp_input_event_proxy.h
@@ -20,7 +20,7 @@
   PPP_InputEvent_Proxy(Dispatcher* dispatcher);
   virtual ~PPP_InputEvent_Proxy();
 
-  static const Info* GetInfo();
+  static const PPP_InputEvent* GetProxyInterface();
 
   // InterfaceProxy implementation.
   virtual bool OnMessageReceived(const IPC::Message& msg);
diff --git a/ppapi/proxy/ppp_instance_private_proxy.cc b/ppapi/proxy/ppp_instance_private_proxy.cc
index 1d8b8d7..8df9c4f 100644
--- a/ppapi/proxy/ppp_instance_private_proxy.cc
+++ b/ppapi/proxy/ppp_instance_private_proxy.cc
@@ -34,10 +34,6 @@
   &GetInstanceObject
 };
 
-InterfaceProxy* CreateInstancePrivateProxy(Dispatcher* dispatcher) {
-  return new PPP_Instance_Private_Proxy(dispatcher);
-}
-
 }  // namespace
 
 PPP_Instance_Private_Proxy::PPP_Instance_Private_Proxy(Dispatcher* dispatcher)
@@ -53,15 +49,8 @@
 }
 
 // static
-const InterfaceProxy::Info* PPP_Instance_Private_Proxy::GetInfo() {
-  static const Info info = {
-    &instance_private_interface,
-    PPP_INSTANCE_PRIVATE_INTERFACE,
-    API_ID_PPP_INSTANCE_PRIVATE,
-    false,
-    &CreateInstancePrivateProxy,
-  };
-  return &info;
+const PPP_Instance_Private* PPP_Instance_Private_Proxy::GetProxyInterface() {
+  return &instance_private_interface;
 }
 
 bool PPP_Instance_Private_Proxy::OnMessageReceived(const IPC::Message& msg) {
diff --git a/ppapi/proxy/ppp_instance_private_proxy.h b/ppapi/proxy/ppp_instance_private_proxy.h
index 60d5ea9..4fc3a3a0 100644
--- a/ppapi/proxy/ppp_instance_private_proxy.h
+++ b/ppapi/proxy/ppp_instance_private_proxy.h
@@ -22,7 +22,7 @@
   PPP_Instance_Private_Proxy(Dispatcher* dispatcher);
   virtual ~PPP_Instance_Private_Proxy();
 
-  static const Info* GetInfo();
+  static const PPP_Instance_Private* GetProxyInterface();
 
  private:
   // InterfaceProxy implementation.
diff --git a/ppapi/proxy/ppp_messaging_proxy.cc b/ppapi/proxy/ppp_messaging_proxy.cc
index 5a12419f..2a859bc 100644
--- a/ppapi/proxy/ppp_messaging_proxy.cc
+++ b/ppapi/proxy/ppp_messaging_proxy.cc
@@ -45,10 +45,6 @@
 static const PPP_Messaging messaging_interface = {};
 #endif  // !defined(OS_NACL)
 
-InterfaceProxy* CreateMessagingProxy(Dispatcher* dispatcher) {
-  return new PPP_Messaging_Proxy(dispatcher);
-}
-
 }  // namespace
 
 PPP_Messaging_Proxy::PPP_Messaging_Proxy(Dispatcher* dispatcher)
@@ -64,15 +60,8 @@
 }
 
 // static
-const InterfaceProxy::Info* PPP_Messaging_Proxy::GetInfo() {
-  static const Info info = {
-    &messaging_interface,
-    PPP_MESSAGING_INTERFACE,
-    API_ID_PPP_MESSAGING,
-    false,
-    &CreateMessagingProxy,
-  };
-  return &info;
+const PPP_Messaging* PPP_Messaging_Proxy::GetProxyInterface() {
+  return &messaging_interface;
 }
 
 bool PPP_Messaging_Proxy::OnMessageReceived(const IPC::Message& msg) {
diff --git a/ppapi/proxy/ppp_messaging_proxy.h b/ppapi/proxy/ppp_messaging_proxy.h
index 4b66f92c..b75feaba 100644
--- a/ppapi/proxy/ppp_messaging_proxy.h
+++ b/ppapi/proxy/ppp_messaging_proxy.h
@@ -20,7 +20,7 @@
   PPP_Messaging_Proxy(Dispatcher* dispatcher);
   virtual ~PPP_Messaging_Proxy();
 
-  static const Info* GetInfo();
+  static const PPP_Messaging* GetProxyInterface();
 
   // InterfaceProxy implementation.
   virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
diff --git a/ppapi/proxy/ppp_mouse_lock_proxy.cc b/ppapi/proxy/ppp_mouse_lock_proxy.cc
index 6fd746dc..66dc130 100644
--- a/ppapi/proxy/ppp_mouse_lock_proxy.cc
+++ b/ppapi/proxy/ppp_mouse_lock_proxy.cc
@@ -35,10 +35,6 @@
 static const PPP_MouseLock mouse_lock_interface = {};
 #endif  // !defined(OS_NACL)
 
-InterfaceProxy* CreateMouseLockProxy(Dispatcher* dispatcher) {
-  return new PPP_MouseLock_Proxy(dispatcher);
-}
-
 }  // namespace
 
 PPP_MouseLock_Proxy::PPP_MouseLock_Proxy(Dispatcher* dispatcher)
@@ -54,15 +50,8 @@
 }
 
 // static
-const InterfaceProxy::Info* PPP_MouseLock_Proxy::GetInfo() {
-  static const Info info = {
-    &mouse_lock_interface,
-    PPP_MOUSELOCK_INTERFACE,
-    API_ID_PPP_MOUSE_LOCK,
-    false,
-    &CreateMouseLockProxy,
-  };
-  return &info;
+const PPP_MouseLock* PPP_MouseLock_Proxy::GetProxyInterface() {
+  return &mouse_lock_interface;
 }
 
 bool PPP_MouseLock_Proxy::OnMessageReceived(const IPC::Message& msg) {
diff --git a/ppapi/proxy/ppp_mouse_lock_proxy.h b/ppapi/proxy/ppp_mouse_lock_proxy.h
index 64f1b7a0..3945bdf 100644
--- a/ppapi/proxy/ppp_mouse_lock_proxy.h
+++ b/ppapi/proxy/ppp_mouse_lock_proxy.h
@@ -18,7 +18,7 @@
   PPP_MouseLock_Proxy(Dispatcher* dispatcher);
   virtual ~PPP_MouseLock_Proxy();
 
-  static const Info* GetInfo();
+  static const PPP_MouseLock* GetProxyInterface();
 
   // InterfaceProxy implementation.
   virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
diff --git a/ppapi/proxy/ppp_video_decoder_proxy.cc b/ppapi/proxy/ppp_video_decoder_proxy.cc
index f1a67212..cb1569fd 100644
--- a/ppapi/proxy/ppp_video_decoder_proxy.cc
+++ b/ppapi/proxy/ppp_video_decoder_proxy.cc
@@ -77,10 +77,6 @@
   &NotifyError
 };
 
-InterfaceProxy* CreateVideoDecoderPPPProxy(Dispatcher* dispatcher) {
-  return new PPP_VideoDecoder_Proxy(dispatcher);
-}
-
 }  // namespace
 
 PPP_VideoDecoder_Proxy::PPP_VideoDecoder_Proxy(Dispatcher* dispatcher)
@@ -96,15 +92,8 @@
 }
 
 // static
-const InterfaceProxy::Info* PPP_VideoDecoder_Proxy::GetInfo() {
-  static const Info info = {
-    &video_decoder_interface,
-    PPP_VIDEODECODER_DEV_INTERFACE,
-    API_ID_PPP_VIDEO_DECODER_DEV,
-    false,
-    &CreateVideoDecoderPPPProxy,
-  };
-  return &info;
+const PPP_VideoDecoder_Dev* PPP_VideoDecoder_Proxy::GetProxyInterface() {
+  return &video_decoder_interface;
 }
 
 bool PPP_VideoDecoder_Proxy::OnMessageReceived(const IPC::Message& msg) {
diff --git a/ppapi/proxy/ppp_video_decoder_proxy.h b/ppapi/proxy/ppp_video_decoder_proxy.h
index 84d83a5..54beac1 100644
--- a/ppapi/proxy/ppp_video_decoder_proxy.h
+++ b/ppapi/proxy/ppp_video_decoder_proxy.h
@@ -21,7 +21,7 @@
   PPP_VideoDecoder_Proxy(Dispatcher* dispatcher);
   virtual ~PPP_VideoDecoder_Proxy();
 
-  static const Info* GetInfo();
+  static const PPP_VideoDecoder_Dev* GetProxyInterface();
 
   // InterfaceProxy implementation.
   virtual bool OnMessageReceived(const IPC::Message& msg);