diff options
Diffstat (limited to 'chromium/ppapi/proxy/interface_list.h')
-rw-r--r-- | chromium/ppapi/proxy/interface_list.h | 44 |
1 files changed, 19 insertions, 25 deletions
diff --git a/chromium/ppapi/proxy/interface_list.h b/chromium/ppapi/proxy/interface_list.h index 78064170d1c..a2b4569c8f1 100644 --- a/chromium/ppapi/proxy/interface_list.h +++ b/chromium/ppapi/proxy/interface_list.h @@ -16,7 +16,7 @@ namespace ppapi { namespace proxy { -class InterfaceList { +class PPAPI_PROXY_EXPORT InterfaceList { public: InterfaceList(); ~InterfaceList(); @@ -33,15 +33,7 @@ class InterfaceList { // plugin process. A real security check is required for all IPC messages. // This check just allows us to return NULL for interfaces you "shouldn't" be // using to keep honest plugins honest. - static PPAPI_PROXY_EXPORT void SetProcessGlobalPermissions( - const PpapiPermissions& permissions); - static PPAPI_PROXY_EXPORT void SetSupportsDevChannel( - bool supports_dev_channel); - - // Looks up the ID for the given interface name. Returns API_ID_NONE if - // the interface string is not found. - ApiID GetIDForPPBInterface(const std::string& name) const; - ApiID GetIDForPPPInterface(const std::string& name) const; + static void SetProcessGlobalPermissions(const PpapiPermissions& permissions); // Looks up the factory function for the given ID. Returns NULL if not // supported. @@ -49,29 +41,33 @@ class InterfaceList { // Returns the interface pointer for the given browser or plugin interface, // or NULL if it's not supported. - const void* GetInterfaceForPPB(const std::string& name) const; + const void* GetInterfaceForPPB(const std::string& name); const void* GetInterfaceForPPP(const std::string& name) const; private: + friend class InterfaceListTest; + struct InterfaceInfo { InterfaceInfo() - : id(API_ID_NONE), - iface(NULL), - required_permission(PERMISSION_NONE) { + : iface(NULL), + required_permission(PERMISSION_NONE), + interface_logged(false) { } - InterfaceInfo(ApiID in_id, const void* in_interface, Permission in_perm) - : id(in_id), - iface(in_interface), - required_permission(in_perm) { + InterfaceInfo(const void* in_interface, Permission in_perm) + : iface(in_interface), + required_permission(in_perm), + interface_logged(false) { } - ApiID id; const void* iface; // Permission required to return non-null for this interface. This will // be checked with the value set via SetProcessGlobalPermissionBits when // an interface is requested. Permission required_permission; + + // Interface usage is logged just once per-interface-per-plugin-process. + bool interface_logged; }; typedef std::map<std::string, InterfaceInfo> NameToInterfaceInfoMap; @@ -81,13 +77,11 @@ class InterfaceList { // Permissions is the type of permission required to access the corresponding // interface. Currently this must be just one unique permission (rather than // a bitfield). - void AddPPB(const char* name, ApiID id, const void* iface, - Permission permission); - void AddPPP(const char* name, ApiID id, const void* iface); + 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); + // Hash the interface name for UMA logging. + static int HashInterfaceName(const std::string& name); PpapiPermissions permissions_; |