Commit 7c286111 authored by kdecker@apple.com's avatar kdecker@apple.com

Reviewed by Anders Carlson.

        Allow WKN_CheckIfAllowedToLoadURL() to take an optional void* context parameter.
        
        * Plugins/WebNetscapeContainerCheckContextInfo.h:
        * Plugins/WebNetscapeContainerCheckContextInfo.mm:
        (-[WebNetscapeContainerCheckContextInfo initWithCheckRequestID:callbackFunc:context:]):
        (-[WebNetscapeContainerCheckContextInfo callback]):
        (-[WebNetscapeContainerCheckContextInfo context]):
        * Plugins/WebNetscapeContainerCheckPrivate.h:
        * Plugins/WebNetscapeContainerCheckPrivate.mm:
        (browserContainerCheckFuncs):
        * Plugins/WebNetscapePluginView.h:
        * Plugins/WebNetscapePluginView.mm:
        (-[WebNetscapePluginView checkIfAllowedToLoadURL:frame:callbackFunc:context:]):
        (-[WebNetscapePluginView _containerCheckResult:contextInfo:]):
        * Plugins/npapi.mm:
        (WKN_CheckIfAllowedToLoadURL):



git-svn-id: svn://svn.chromium.org/blink/trunk@43009 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent d93606fb
2009-04-29 Kevin Decker <kdecker@apple.com>
Reviewed by Anders Carlson.
Allow WKN_CheckIfAllowedToLoadURL() to take an optional void* context parameter.
* Plugins/WebNetscapeContainerCheckContextInfo.h:
* Plugins/WebNetscapeContainerCheckContextInfo.mm:
(-[WebNetscapeContainerCheckContextInfo initWithCheckRequestID:callbackFunc:context:]):
(-[WebNetscapeContainerCheckContextInfo callback]):
(-[WebNetscapeContainerCheckContextInfo context]):
* Plugins/WebNetscapeContainerCheckPrivate.h:
* Plugins/WebNetscapeContainerCheckPrivate.mm:
(browserContainerCheckFuncs):
* Plugins/WebNetscapePluginView.h:
* Plugins/WebNetscapePluginView.mm:
(-[WebNetscapePluginView checkIfAllowedToLoadURL:frame:callbackFunc:context:]):
(-[WebNetscapePluginView _containerCheckResult:contextInfo:]):
* Plugins/npapi.mm:
(WKN_CheckIfAllowedToLoadURL):
2009-04-29 David Hyatt <hyatt@apple.com>
Reviewed by John Sullivan.
......
......@@ -30,11 +30,13 @@
@interface WebNetscapeContainerCheckContextInfo : NSObject {
uint32 _checkRequestID;
void (*_callback)(NPP npp, uint32, NPBool);
void (*_callback)(NPP npp, uint32, NPBool, void *);
void *_context;
}
- (id)initWithCheckRequestID:(uint32)checkRequestID callbackFunc:(void (*)(NPP npp, uint32 checkID, NPBool allowed))callbackFunc;
- (id)initWithCheckRequestID:(uint32)checkRequestID callbackFunc:(void (*)(NPP npp, uint32 checkID, NPBool allowed, void* context))callbackFunc context:(void*)context;
- (uint32)checkRequestID;
- (void (*)(NPP npp, uint32, NPBool))callback;
- (void (*)(NPP npp, uint32, NPBool, void*))callback;
- (void*)context;
@end
......@@ -27,7 +27,7 @@
@implementation WebNetscapeContainerCheckContextInfo
- (id)initWithCheckRequestID:(uint32)checkRequestID callbackFunc:(void (*)(NPP npp, uint32 checkID, NPBool allowed))callbackFunc;
- (id)initWithCheckRequestID:(uint32)checkRequestID callbackFunc:(void (*)(NPP npp, uint32 checkID, NPBool allowed, void* context))callbackFunc context:(void*)context
{
self = [super init];
if (!self)
......@@ -35,6 +35,7 @@
_checkRequestID = checkRequestID;
_callback = callbackFunc;
_context = context;
return self;
}
......@@ -43,9 +44,14 @@
return _checkRequestID;
}
- (void (*)(NPP npp, uint32, NPBool))callback
- (void (*)(NPP npp, uint32, NPBool, void*))callback
{
return _callback;
}
- (void*)context
{
return _context;
}
@end
......@@ -36,11 +36,12 @@ extern "C" {
#endif
#define WKNVBrowserContainerCheckFuncs 1701
#define WKNVBrowserContainerCheckFuncsVersion 1
typedef uint32 (*WKN_CheckIfAllowedToLoadURLProcPtr)(NPP npp, const char* url, const char* frame, void (*callbackFunc)(NPP npp, uint32, NPBool allowed));
typedef uint32 (*WKN_CheckIfAllowedToLoadURLProcPtr)(NPP npp, const char* url, const char* frame, void (*callbackFunc)(NPP npp, uint32, NPBool allowed, void* context), void* context);
typedef void (*WKN_CancelCheckIfAllowedToLoadURLProcPtr)(NPP npp, uint32);
uint32 WKN_CheckIfAllowedToLoadURL(NPP npp, const char* url, const char* frame, void (*callbackFunc)(NPP npp, uint32, NPBool allowed));
uint32 WKN_CheckIfAllowedToLoadURL(NPP npp, const char* url, const char* frame, void (*callbackFunc)(NPP npp, uint32, NPBool allowed, void* context), void* context);
void WKN_CancelCheckIfAllowedToLoadURL(NPP npp, uint32);
typedef struct _WKNBrowserContainerCheckFuncs {
......
......@@ -34,7 +34,7 @@ WKNBrowserContainerCheckFuncs *browserContainerCheckFuncs()
{
static WKNBrowserContainerCheckFuncs funcs = {
sizeof(WKNBrowserContainerCheckFuncs),
0,
WKNVBrowserContainerCheckFuncsVersion,
WKN_CheckIfAllowedToLoadURL,
WKN_CancelCheckIfAllowedToLoadURL
};
......
......@@ -143,7 +143,7 @@ typedef union PluginPort {
- (void)didCallPlugInFunction;
- (void)handleMouseMoved:(NSEvent *)event;
- (uint32)checkIfAllowedToLoadURL:(const char*) url frame:(const char*) frame callbackFunc:(void (*)(NPP npp, uint32 checkID, NPBool allowed))callbackFunc;
- (uint32)checkIfAllowedToLoadURL:(const char*)urlCString frame:(const char*)frameNameCString callbackFunc:(void (*)(NPP npp, uint32 checkID, NPBool allowed, void* context))callbackFunc context:(void*)context;
- (void)cancelCheckIfAllowedToLoadURL:(uint32)checkID;
@end
......
......@@ -1213,7 +1213,9 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
}
}
- (uint32)checkIfAllowedToLoadURL:(const char*)urlCString frame:(const char*)frameNameCString callbackFunc:(void (*)(NPP npp, uint32 checkID, NPBool allowed))callbackFunc
- (uint32)checkIfAllowedToLoadURL:(const char*)urlCString frame:(const char*)frameNameCString
callbackFunc:(void (*)(NPP npp, uint32 checkID, NPBool allowed, void* context))callbackFunc
context:(void*)context
{
if (!_containerChecksInProgress)
_containerChecksInProgress = [[NSMutableDictionary alloc] init];
......@@ -1221,7 +1223,9 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
NSString *frameName = frameNameCString ? [NSString stringWithCString:frameNameCString encoding:NSISOLatin1StringEncoding] : nil;
++_currentContainerCheckRequestID;
WebNetscapeContainerCheckContextInfo *contextInfo = [[WebNetscapeContainerCheckContextInfo alloc] initWithCheckRequestID:_currentContainerCheckRequestID callbackFunc:callbackFunc];
WebNetscapeContainerCheckContextInfo *contextInfo = [[WebNetscapeContainerCheckContextInfo alloc] initWithCheckRequestID:_currentContainerCheckRequestID
callbackFunc:callbackFunc
context:context];
WebPluginContainerCheck *check = [WebPluginContainerCheck checkWithRequest:[self requestWithURLCString:urlCString]
target:frameName
......@@ -1240,14 +1244,14 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr)
- (void)_containerCheckResult:(PolicyAction)policy contextInfo:(id)contextInfo
{
ASSERT([contextInfo isKindOfClass:[WebNetscapeContainerCheckContextInfo class]]);
void (*pluginCallback)(NPP npp, uint32, NPBool) = [contextInfo callback];
void (*pluginCallback)(NPP npp, uint32, NPBool, void*) = [contextInfo callback];
if (!pluginCallback) {
ASSERT_NOT_REACHED();
return;
}
pluginCallback([self plugin], [contextInfo checkRequestID], (policy == PolicyUse));
pluginCallback([self plugin], [contextInfo checkRequestID], (policy == PolicyUse), [contextInfo context]);
}
- (void)cancelCheckIfAllowedToLoadURL:(uint32)checkID
......
......@@ -217,9 +217,9 @@ NPBool NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordina
return [pluginViewForInstance(instance) convertFromX:sourceX andY:sourceY space:sourceSpace toX:destX andY:destY space:destSpace];
}
uint32 WKN_CheckIfAllowedToLoadURL(NPP instance, const char* url, const char* frame, void (*callbackFunc)(NPP npp, uint32, NPBool))
uint32 WKN_CheckIfAllowedToLoadURL(NPP instance, const char* url, const char* frame, void (*callbackFunc)(NPP npp, uint32, NPBool, void*), void* context)
{
return [pluginViewForInstance(instance) checkIfAllowedToLoadURL:url frame:frame callbackFunc:callbackFunc];
return [pluginViewForInstance(instance) checkIfAllowedToLoadURL:url frame:frame callbackFunc:callbackFunc context:context];
}
void WKN_CancelCheckIfAllowedToLoadURL(NPP instance, uint32 checkID)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment