| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 class WebDragData; | 39 class WebDragData; |
| 40 | 40 |
| 41 // A haphazard collection of functions for dealing with plugins. | 41 // A haphazard collection of functions for dealing with plugins. |
| 42 class WebBindings { | 42 class WebBindings { |
| 43 public: | 43 public: |
| 44 // NPN Functions ------------------------------------------------------ | 44 // NPN Functions ------------------------------------------------------ |
| 45 // These are all defined in npruntime.h and are well documented. | 45 // These are all defined in npruntime.h and are well documented. |
| 46 | 46 |
| 47 // NPN_Construct | 47 // NPN_Construct |
| 48 WEBKIT_API static bool construct(NPP npp, NPObject *npobj, const NPVariant *args, uint32_t argCount, NPVariant* result); | 48 WEBKIT_API static bool construct(NPP, NPObject*, const NPVariant* args, uint32_t argCount, NPVariant* result); |
| 49 | 49 |
| 50 // NPN_CreateObject | 50 // NPN_CreateObject |
| 51 WEBKIT_API static NPObject* createObject(NPP npp, NPClass* npClass); | 51 WEBKIT_API static NPObject* createObject(NPP, NPClass*); |
| 52 | 52 |
| 53 // NPN_Enumerate | 53 // NPN_Enumerate |
| 54 WEBKIT_API static bool enumerate(NPP id, NPObject* obj, NPIdentifier** identifier, uint32_t* val); | 54 WEBKIT_API static bool enumerate(NPP, NPObject*, NPIdentifier**, uint32_t* count); |
| 55 | 55 |
| 56 // NPN_Evaluate | 56 // NPN_Evaluate |
| 57 WEBKIT_API static bool evaluate(NPP npp, NPObject* npObject, NPString* npScript, NPVariant* result); | 57 WEBKIT_API static bool evaluate(NPP, NPObject*, NPString* script, NPVariant* result); |
| 58 | 58 |
| 59 // NPN_EvaluateHelper | 59 // NPN_EvaluateHelper |
| 60 WEBKIT_API static bool evaluateHelper(NPP npp, bool popups_allowed, NPObject* npobj, NPString* npscript, NPVariant* result); | 60 WEBKIT_API static bool evaluateHelper(NPP, bool popupsAllowed, NPObject*, NPString* script, NPVariant* result); |
| 61 | 61 |
| 62 // NPN_GetIntIdentifier | 62 // NPN_GetIntIdentifier |
| 63 WEBKIT_API static NPIdentifier getIntIdentifier(int32_t number); | 63 WEBKIT_API static NPIdentifier getIntIdentifier(int32_t number); |
| 64 | 64 |
| 65 // NPN_GetProperty | 65 // NPN_GetProperty |
| 66 WEBKIT_API static bool getProperty(NPP npp, NPObject* obj, NPIdentifier propertyName, NPVariant *result); | 66 WEBKIT_API static bool getProperty(NPP, NPObject*, NPIdentifier propertyName, NPVariant *result); |
| 67 | 67 |
| 68 // NPN_GetStringIdentifier | 68 // NPN_GetStringIdentifier |
| 69 WEBKIT_API static NPIdentifier getStringIdentifier(const NPUTF8* string); | 69 WEBKIT_API static NPIdentifier getStringIdentifier(const NPUTF8* string); |
| 70 | 70 |
| 71 // NPN_GetStringIdentifiers | 71 // NPN_GetStringIdentifiers |
| 72 WEBKIT_API static void getStringIdentifiers(const NPUTF8** names, int32_t nameCount, NPIdentifier* identifiers); | 72 WEBKIT_API static void getStringIdentifiers(const NPUTF8** names, int32_t nameCount, NPIdentifier*); |
| 73 | 73 |
| 74 // NPN_HasMethod | 74 // NPN_HasMethod |
| 75 WEBKIT_API static bool hasMethod(NPP npp, NPObject* npObject, NPIdentifier methodName); | 75 WEBKIT_API static bool hasMethod(NPP, NPObject*, NPIdentifier methodName); |
| 76 | 76 |
| 77 // NPN_HasProperty | 77 // NPN_HasProperty |
| 78 WEBKIT_API static bool hasProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName); | 78 WEBKIT_API static bool hasProperty(NPP, NPObject*, NPIdentifier propertyName); |
| 79 | 79 |
| 80 // NPN_IdentifierIsString | 80 // NPN_IdentifierIsString |
| 81 WEBKIT_API static bool identifierIsString(NPIdentifier identifier); | 81 WEBKIT_API static bool identifierIsString(NPIdentifier); |
| 82 | 82 |
| 83 // NPN_InitializeVariantWithStringCopy (though sometimes prefixed with an underscore) | 83 // NPN_InitializeVariantWithStringCopy (though sometimes prefixed with an underscore) |
| 84 WEBKIT_API static void initializeVariantWithStringCopy(NPVariant* variant, const NPString* value); | 84 WEBKIT_API static void initializeVariantWithStringCopy(NPVariant*, const NPString*); |
| 85 | 85 |
| 86 // NPN_IntFromIdentifier | 86 // NPN_IntFromIdentifier |
| 87 WEBKIT_API static int32_t intFromIdentifier(NPIdentifier identifier); | 87 WEBKIT_API static int32_t intFromIdentifier(NPIdentifier); |
| 88 | 88 |
| 89 // NPN_Invoke | 89 // NPN_Invoke |
| 90 WEBKIT_API static bool invoke(NPP npp, NPObject* npObject, NPIdentifier methodName, const NPVariant* arguments, uint32_t argumentCount, NPVariant* result); | 90 WEBKIT_API static bool invoke(NPP, NPObject*, NPIdentifier methodName, const NPVariant* args, uint32_t count, NPVariant* result); |
| 91 | 91 |
| 92 // NPN_InvokeDefault | 92 // NPN_InvokeDefault |
| 93 WEBKIT_API static bool invokeDefault(NPP id, NPObject* obj, const NPVariant* args, uint32_t count, NPVariant* result); | 93 WEBKIT_API static bool invokeDefault(NPP, NPObject*, const NPVariant* args, uint32_t count, NPVariant* result); |
| 94 | 94 |
| 95 // NPN_ReleaseObject | 95 // NPN_ReleaseObject |
| 96 WEBKIT_API static void releaseObject(NPObject* npObject); | 96 WEBKIT_API static void releaseObject(NPObject*); |
| 97 | 97 |
| 98 // NPN_ReleaseVariantValue | 98 // NPN_ReleaseVariantValue |
| 99 WEBKIT_API static void releaseVariantValue(NPVariant* variant); | 99 WEBKIT_API static void releaseVariantValue(NPVariant*); |
| 100 | 100 |
| 101 // NPN_RemoveProperty | 101 // NPN_RemoveProperty |
| 102 WEBKIT_API static bool removeProperty(NPP id, NPObject* object, NPIdentifier identifier); | 102 WEBKIT_API static bool removeProperty(NPP, NPObject*, NPIdentifier); |
| 103 | 103 |
| 104 // NPN_RetainObject | 104 // NPN_RetainObject |
| 105 WEBKIT_API static NPObject* retainObject(NPObject* npObject); | 105 WEBKIT_API static NPObject* retainObject(NPObject*); |
| 106 | 106 |
| 107 // NPN_SetException | 107 // NPN_SetException |
| 108 WEBKIT_API static void setException(NPObject* obj, const NPUTF8* message); | 108 WEBKIT_API static void setException(NPObject*, const NPUTF8* message); |
| 109 | 109 |
| 110 // NPN_SetProperty | 110 // NPN_SetProperty |
| 111 WEBKIT_API static bool setProperty(NPP id, NPObject* obj, NPIdentifier identifier, const NPVariant* variant); | 111 WEBKIT_API static bool setProperty(NPP, NPObject*, NPIdentifier, const NPVariant*); |
| 112 | 112 |
| 113 // _NPN_UnregisterObject | 113 // _NPN_UnregisterObject |
| 114 WEBKIT_API static void unregisterObject(NPObject* npObject); | 114 WEBKIT_API static void unregisterObject(NPObject*); |
| 115 | 115 |
| 116 // NPN_UTF8FromIdentifier | 116 // NPN_UTF8FromIdentifier |
| 117 WEBKIT_API static NPUTF8* utf8FromIdentifier(NPIdentifier identifier); | 117 WEBKIT_API static NPUTF8* utf8FromIdentifier(NPIdentifier); |
| 118 | 118 |
| 119 // Miscellaneous utility functions ------------------------------------ | 119 // Miscellaneous utility functions ------------------------------------ |
| 120 | 120 |
| 121 // Complement to NPN_Get___Identifier functions. Extracts data from the NPIdentifier data | 121 // Complement to NPN_Get___Identifier functions. Extracts data from the NPIdentifier data |
| 122 // structure. If isString is true upon return, string will be set but number's value is | 122 // structure. If isString is true upon return, string will be set but number's value is |
| 123 // undefined. If iString is false, the opposite is true. | 123 // undefined. If iString is false, the opposite is true. |
| 124 WEBKIT_API static void extractIdentifierData(const NPIdentifier&, const NPUTF8*& string, int32_t& number, bool& isString); | 124 WEBKIT_API static void extractIdentifierData(const NPIdentifier&, const NPUTF8*& string, int32_t& number, bool& isString); |
| 125 | 125 |
| 126 // Return true (success) if the given npobj is the current drag event in browser dispatch, | 126 // Return true (success) if the given npobj is the current drag event in browser dispatch, |
| 127 // and is accessible based on context execution frames and their security origins and | 127 // and is accessible based on context execution frames and their security origins and |
| 128 // WebKit clipboard access policy. If so, return the event id and the clipboard data (WebDragData). | 128 // WebKit clipboard access policy. If so, return the event id and the clipboard data (WebDragData). |
| 129 // This only works with V8. If compiled without V8, it'll always return false. | 129 // This only works with V8. If compiled without V8, it'll always return false. |
| 130 WEBKIT_API static bool getDragData(NPObject* event, int* event_id, WebDragData* data); | 130 WEBKIT_API static bool getDragData(NPObject* event, int* eventId, WebDragData*); |
| 131 | 131 |
| 132 // Invoke the event access policy checks listed above with GetDragData(). No need for clipboard | 132 // Invoke the event access policy checks listed above with GetDragData(). No need for clipboard |
| 133 // data or event_id outputs, just confirm the given npobj is the current & accessible drag event. | 133 // data or event_id outputs, just confirm the given npobj is the current & accessible drag event. |
| 134 // This only works with V8. If compiled without V8, it'll always return false. | 134 // This only works with V8. If compiled without V8, it'll always return false. |
| 135 WEBKIT_API static bool isDragEvent(NPObject* event); | 135 WEBKIT_API static bool isDragEvent(NPObject* event); |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 } // namespace WebKit | 138 } // namespace WebKit |
| 139 | 139 |
| 140 #endif | 140 #endif |
| OLD | NEW |