OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "PluginObject.h" | 26 #include "PluginObject.h" |
27 | 27 |
28 #include "PluginTest.h" | 28 #include "PluginTest.h" |
29 #include <cstdlib> | 29 #include <cstdlib> |
30 #include <cstring> | 30 #include <cstring> |
31 #include <string> | 31 #include <string> |
32 | 32 |
33 #ifdef XP_UNIX | 33 #ifdef XP_UNIX |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 pluginFuncs->newstream = NPP_NewStream; | 115 pluginFuncs->newstream = NPP_NewStream; |
116 pluginFuncs->destroystream = NPP_DestroyStream; | 116 pluginFuncs->destroystream = NPP_DestroyStream; |
117 pluginFuncs->asfile = NPP_StreamAsFile; | 117 pluginFuncs->asfile = NPP_StreamAsFile; |
118 pluginFuncs->writeready = NPP_WriteReady; | 118 pluginFuncs->writeready = NPP_WriteReady; |
119 pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write; | 119 pluginFuncs->write = (NPP_WriteProcPtr)NPP_Write; |
120 pluginFuncs->print = NPP_Print; | 120 pluginFuncs->print = NPP_Print; |
121 pluginFuncs->event = NPP_HandleEvent; | 121 pluginFuncs->event = NPP_HandleEvent; |
122 pluginFuncs->urlnotify = NPP_URLNotify; | 122 pluginFuncs->urlnotify = NPP_URLNotify; |
123 pluginFuncs->getvalue = NPP_GetValue; | 123 pluginFuncs->getvalue = NPP_GetValue; |
124 pluginFuncs->setvalue = NPP_SetValue; | 124 pluginFuncs->setvalue = NPP_SetValue; |
125 | 125 |
126 return NPERR_NO_ERROR; | 126 return NPERR_NO_ERROR; |
127 } | 127 } |
128 | 128 |
129 extern "C" | 129 extern "C" |
130 void STDCALL NP_Shutdown(void) | 130 void STDCALL NP_Shutdown(void) |
131 { | 131 { |
132 // Trash the PluginObject NPClass so that the process will deterministically | 132 // Trash the PluginObject NPClass so that the process will deterministically |
133 // crash if Blink tries to call into the plugin's NPObjects after unloading | 133 // crash if Blink tries to call into the plugin's NPObjects after unloading |
134 // it, rather than relying on OS-specific DLL unload behaviour. | 134 // it, rather than relying on OS-specific DLL unload behaviour. |
135 // Note that we leak the NPClass copy, to act as a guard for the lifetime of | 135 // Note that we leak the NPClass copy, to act as a guard for the lifetime of |
136 // the process. | 136 // the process. |
137 memset(pluginObjectClass, 0xf00dbeef, sizeof(NPClass)); | 137 memset(pluginObjectClass, 0xf00dbeef, sizeof(NPClass)); |
138 | 138 |
139 PluginTest::NP_Shutdown(); | 139 PluginTest::NP_Shutdown(); |
140 } | 140 } |
141 | 141 |
142 static void executeScript(const PluginObject* obj, const char* script); | 142 static void executeScript(const PluginObject* obj, const char* script); |
143 | 143 |
144 NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc
, char *argn[], char *argv[], NPSavedData *saved) | 144 NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc
, char *argn[], char *argv[], NPSavedData *saved) |
145 { | 145 { |
146 #ifdef XP_MACOSX | 146 #ifdef XP_MACOSX |
147 NPEventModel eventModel; | 147 NPEventModel eventModel; |
148 | 148 |
149 // Always turn on the CG model | 149 // Always turn on the CG model |
150 NPBool supportsCoreGraphics; | 150 NPBool supportsCoreGraphics; |
151 if (browser->getvalue(instance, NPNVsupportsCoreGraphicsBool, &supportsCoreG
raphics) != NPERR_NO_ERROR) | 151 if (browser->getvalue(instance, NPNVsupportsCoreGraphicsBool, &supportsCoreG
raphics) != NPERR_NO_ERROR) |
152 supportsCoreGraphics = false; | 152 supportsCoreGraphics = false; |
153 | 153 |
154 if (!supportsCoreGraphics) | 154 if (!supportsCoreGraphics) |
155 return NPERR_INCOMPATIBLE_VERSION_ERROR; | 155 return NPERR_INCOMPATIBLE_VERSION_ERROR; |
156 | 156 |
157 NPDrawingModel drawingModelToUse = NPDrawingModelCoreGraphics; | 157 NPDrawingModel drawingModelToUse = NPDrawingModelCoreGraphics; |
158 | 158 |
159 NPBool supportsCoreAnimation; | 159 NPBool supportsCoreAnimation; |
160 if (browser->getvalue(instance, NPNVsupportsCoreAnimationBool, &supportsCore
Animation) != NPERR_NO_ERROR) | 160 if (browser->getvalue(instance, NPNVsupportsCoreAnimationBool, &supportsCore
Animation) != NPERR_NO_ERROR) |
161 supportsCoreAnimation = false; | 161 supportsCoreAnimation = false; |
162 | 162 |
163 #ifndef NP_NO_CARBON | 163 #ifndef NP_NO_CARBON |
(...skipping 26 matching lines...) Expand all Loading... |
190 PluginObject* obj = (PluginObject*)browser->createobject(instance, pluginObj
ectClass); | 190 PluginObject* obj = (PluginObject*)browser->createobject(instance, pluginObj
ectClass); |
191 instance->pdata = obj; | 191 instance->pdata = obj; |
192 | 192 |
193 #ifdef XP_MACOSX | 193 #ifdef XP_MACOSX |
194 obj->eventModel = eventModel; | 194 obj->eventModel = eventModel; |
195 obj->coreAnimationLayer = 0; | 195 obj->coreAnimationLayer = 0; |
196 #endif // XP_MACOSX | 196 #endif // XP_MACOSX |
197 | 197 |
198 string testIdentifier; | 198 string testIdentifier; |
199 const char* onNewScript = 0; | 199 const char* onNewScript = 0; |
200 | 200 |
201 for (int i = 0; i < argc; i++) { | 201 for (int i = 0; i < argc; i++) { |
202 if (strcasecmp(argn[i], "test") == 0) | 202 if (strcasecmp(argn[i], "test") == 0) |
203 testIdentifier = argv[i]; | 203 testIdentifier = argv[i]; |
204 if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad) | 204 if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad) |
205 obj->onStreamLoad = strdup(argv[i]); | 205 obj->onStreamLoad = strdup(argv[i]); |
206 else if (strcasecmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDe
stroy) | 206 else if (strcasecmp(argn[i], "onStreamDestroy") == 0 && !obj->onStreamDe
stroy) |
207 obj->onStreamDestroy = strdup(argv[i]); | 207 obj->onStreamDestroy = strdup(argv[i]); |
208 else if (strcasecmp(argn[i], "onURLNotify") == 0 && !obj->onURLNotify) | 208 else if (strcasecmp(argn[i], "onURLNotify") == 0 && !obj->onURLNotify) |
209 obj->onURLNotify = strdup(argv[i]); | 209 obj->onURLNotify = strdup(argv[i]); |
210 else if (strcasecmp(argn[i], "src") == 0 && | 210 else if (strcasecmp(argn[i], "src") == 0 && |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 free(obj->onStreamDestroy); | 329 free(obj->onStreamDestroy); |
330 | 330 |
331 if (obj->onURLNotify) | 331 if (obj->onURLNotify) |
332 free(obj->onURLNotify); | 332 free(obj->onURLNotify); |
333 | 333 |
334 if (obj->onSetWindow) | 334 if (obj->onSetWindow) |
335 free(obj->onSetWindow); | 335 free(obj->onSetWindow); |
336 | 336 |
337 if (obj->onPaintEvent) | 337 if (obj->onPaintEvent) |
338 free(obj->onPaintEvent); | 338 free(obj->onPaintEvent); |
339 | 339 |
340 if (obj->logDestroy) | 340 if (obj->logDestroy) |
341 pluginLog(instance, "NPP_Destroy"); | 341 pluginLog(instance, "NPP_Destroy"); |
342 | 342 |
343 #ifdef XP_MACOSX | 343 #ifdef XP_MACOSX |
344 if (obj->coreAnimationLayer) | 344 if (obj->coreAnimationLayer) |
345 CFRelease(obj->coreAnimationLayer); | 345 CFRelease(obj->coreAnimationLayer); |
346 #endif | 346 #endif |
347 | 347 |
348 if (obj->pluginTest) | 348 if (obj->pluginTest) |
349 obj->pluginTest->NPP_Destroy(save); | 349 obj->pluginTest->NPP_Destroy(save); |
(...skipping 22 matching lines...) Expand all Loading... |
372 if (obj->testWindowOpen) { | 372 if (obj->testWindowOpen) { |
373 testWindowOpen(instance); | 373 testWindowOpen(instance); |
374 obj->testWindowOpen = FALSE; | 374 obj->testWindowOpen = FALSE; |
375 } | 375 } |
376 | 376 |
377 if (obj->testKeyboardFocusForPlugins) { | 377 if (obj->testKeyboardFocusForPlugins) { |
378 obj->eventLogging = true; | 378 obj->eventLogging = true; |
379 executeScript(obj, "eventSender.keyDown('A');"); | 379 executeScript(obj, "eventSender.keyDown('A');"); |
380 } | 380 } |
381 } | 381 } |
382 | 382 |
383 return obj->pluginTest->NPP_SetWindow(window); | 383 return obj->pluginTest->NPP_SetWindow(window); |
384 } | 384 } |
385 | 385 |
386 static void executeScript(const PluginObject* obj, const char* script) | 386 static void executeScript(const PluginObject* obj, const char* script) |
387 { | 387 { |
388 NPObject *windowScriptObject; | 388 NPObject *windowScriptObject; |
389 browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject); | 389 browser->getvalue(obj->npp, NPNVWindowNPObject, &windowScriptObject); |
390 | 390 |
391 NPString npScript; | 391 NPString npScript; |
392 npScript.UTF8Characters = script; | 392 npScript.UTF8Characters = script; |
393 npScript.UTF8Length = strlen(script); | 393 npScript.UTF8Length = strlen(script); |
394 | 394 |
395 NPVariant browserResult; | 395 NPVariant browserResult; |
396 browser->evaluate(obj->npp, windowScriptObject, &npScript, &browserResult); | 396 browser->evaluate(obj->npp, windowScriptObject, &npScript, &browserResult); |
397 browser->releasevariantvalue(&browserResult); | 397 browser->releasevariantvalue(&browserResult); |
398 } | 398 } |
399 | 399 |
400 NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool se
ekable, uint16_t *stype) | 400 NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream *stream, NPBool se
ekable, uint16_t *stype) |
401 { | 401 { |
402 PluginObject* obj = static_cast<PluginObject*>(instance->pdata); | 402 PluginObject* obj = static_cast<PluginObject*>(instance->pdata); |
403 obj->stream = stream; | 403 obj->stream = stream; |
404 *stype = NP_NORMAL; | 404 *stype = NP_NORMAL; |
405 | 405 |
406 if (obj->returnErrorFromNewStream) | 406 if (obj->returnErrorFromNewStream) |
407 return NPERR_GENERIC_ERROR; | 407 return NPERR_GENERIC_ERROR; |
408 | 408 |
409 if (browser->version >= NPVERS_HAS_RESPONSE_HEADERS) | 409 if (browser->version >= NPVERS_HAS_RESPONSE_HEADERS) |
410 notifyStream(obj, stream->url, stream->headers); | 410 notifyStream(obj, stream->url, stream->headers); |
411 | 411 |
412 if (obj->onStreamLoad) | 412 if (obj->onStreamLoad) |
413 executeScript(obj, obj->onStreamLoad); | 413 executeScript(obj, obj->onStreamLoad); |
414 | 414 |
415 return obj->pluginTest->NPP_NewStream(type, stream, seekable, stype); | 415 return obj->pluginTest->NPP_NewStream(type, stream, seekable, stype); |
416 } | 416 } |
417 | 417 |
418 NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason) | 418 NPError NPP_DestroyStream(NPP instance, NPStream *stream, NPReason reason) |
419 { | 419 { |
420 PluginObject* obj = (PluginObject*)instance->pdata; | 420 PluginObject* obj = (PluginObject*)instance->pdata; |
421 | 421 |
422 if (obj->onStreamDestroy) { | 422 if (obj->onStreamDestroy) { |
423 NPObject* windowObject = 0; | 423 NPObject* windowObject = 0; |
424 NPError error = browser->getvalue(instance, NPNVWindowNPObject, &windowO
bject); | 424 NPError error = browser->getvalue(instance, NPNVWindowNPObject, &windowO
bject); |
425 | 425 |
426 if (error == NPERR_NO_ERROR) { | 426 if (error == NPERR_NO_ERROR) { |
427 NPVariant onStreamDestroyVariant; | 427 NPVariant onStreamDestroyVariant; |
428 if (browser->getproperty(instance, windowObject, browser->getstringi
dentifier(obj->onStreamDestroy), &onStreamDestroyVariant)) { | 428 if (browser->getproperty(instance, windowObject, browser->getstringi
dentifier(obj->onStreamDestroy), &onStreamDestroyVariant)) { |
429 if (NPVARIANT_IS_OBJECT(onStreamDestroyVariant)) { | 429 if (NPVARIANT_IS_OBJECT(onStreamDestroyVariant)) { |
430 NPObject* onStreamDestroyFunction = NPVARIANT_TO_OBJECT(onSt
reamDestroyVariant); | 430 NPObject* onStreamDestroyFunction = NPVARIANT_TO_OBJECT(onSt
reamDestroyVariant); |
431 | 431 |
432 NPVariant reasonVariant; | 432 NPVariant reasonVariant; |
433 INT32_TO_NPVARIANT(reason, reasonVariant); | 433 INT32_TO_NPVARIANT(reason, reasonVariant); |
434 | 434 |
435 NPVariant result; | 435 NPVariant result; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 pluginLog(instance, "loseFocusEvent"); | 567 pluginLog(instance, "loseFocusEvent"); |
568 break; | 568 break; |
569 case NPEventType_AdjustCursorEvent: | 569 case NPEventType_AdjustCursorEvent: |
570 if (obj->eventLogging) | 570 if (obj->eventLogging) |
571 pluginLog(instance, "adjustCursorEvent"); | 571 pluginLog(instance, "adjustCursorEvent"); |
572 break; | 572 break; |
573 default: | 573 default: |
574 if (obj->eventLogging) | 574 if (obj->eventLogging) |
575 pluginLog(instance, "event %d", event->what); | 575 pluginLog(instance, "event %d", event->what); |
576 } | 576 } |
577 | 577 |
578 return 0; | 578 return 0; |
579 } | 579 } |
580 #endif | 580 #endif |
581 | 581 |
582 static int16_t handleEventCocoa(NPP instance, PluginObject* obj, NPCocoaEvent* e
vent) | 582 static int16_t handleEventCocoa(NPP instance, PluginObject* obj, NPCocoaEvent* e
vent) |
583 { | 583 { |
584 switch (event->type) { | 584 switch (event->type) { |
585 case NPCocoaEventWindowFocusChanged: | 585 case NPCocoaEventWindowFocusChanged: |
586 | 586 |
587 case NPCocoaEventFocusChanged: | 587 case NPCocoaEventFocusChanged: |
588 if (obj->eventLogging) { | 588 if (obj->eventLogging) { |
589 if (event->data.focus.hasFocus) | 589 if (event->data.focus.hasFocus) |
590 pluginLog(instance, "getFocusEvent"); | 590 pluginLog(instance, "getFocusEvent"); |
591 else | 591 else |
592 pluginLog(instance, "loseFocusEvent"); | 592 pluginLog(instance, "loseFocusEvent"); |
593 } | 593 } |
594 return 1; | 594 return 1; |
595 | 595 |
596 case NPCocoaEventDrawRect: { | 596 case NPCocoaEventDrawRect: { |
(...skipping 18 matching lines...) Expand all Loading... |
615 executeScript(obj, "testRunner.notifyDone();"); | 615 executeScript(obj, "testRunner.notifyDone();"); |
616 } | 616 } |
617 } | 617 } |
618 return 1; | 618 return 1; |
619 | 619 |
620 case NPCocoaEventFlagsChanged: | 620 case NPCocoaEventFlagsChanged: |
621 return 1; | 621 return 1; |
622 | 622 |
623 case NPCocoaEventMouseDown: | 623 case NPCocoaEventMouseDown: |
624 if (obj->eventLogging) { | 624 if (obj->eventLogging) { |
625 pluginLog(instance, "mouseDown at (%d, %d)", | 625 pluginLog(instance, "mouseDown at (%d, %d)", |
626 (int)event->data.mouse.pluginX, | 626 (int)event->data.mouse.pluginX, |
627 (int)event->data.mouse.pluginY); | 627 (int)event->data.mouse.pluginY); |
628 } | 628 } |
629 if (obj->evaluateScriptOnMouseDownOrKeyDown && obj->mouseDownForEval
uateScript) | 629 if (obj->evaluateScriptOnMouseDownOrKeyDown && obj->mouseDownForEval
uateScript) |
630 executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown); | 630 executeScript(obj, obj->evaluateScriptOnMouseDownOrKeyDown); |
631 return 1; | 631 return 1; |
632 case NPCocoaEventMouseUp: | 632 case NPCocoaEventMouseUp: |
633 if (obj->eventLogging) { | 633 if (obj->eventLogging) { |
634 pluginLog(instance, "mouseUp at (%d, %d)", | 634 pluginLog(instance, "mouseUp at (%d, %d)", |
635 (int)event->data.mouse.pluginX, | 635 (int)event->data.mouse.pluginX, |
636 (int)event->data.mouse.pluginY); | 636 (int)event->data.mouse.pluginY); |
637 } | 637 } |
638 return 1; | 638 return 1; |
639 | 639 |
640 case NPCocoaEventMouseMoved: | 640 case NPCocoaEventMouseMoved: |
641 case NPCocoaEventMouseEntered: | 641 case NPCocoaEventMouseEntered: |
642 case NPCocoaEventMouseExited: | 642 case NPCocoaEventMouseExited: |
643 case NPCocoaEventMouseDragged: | 643 case NPCocoaEventMouseDragged: |
644 case NPCocoaEventScrollWheel: | 644 case NPCocoaEventScrollWheel: |
645 case NPCocoaEventTextInput: | 645 case NPCocoaEventTextInput: |
646 return 1; | 646 return 1; |
647 } | 647 } |
648 | 648 |
649 return 0; | 649 return 0; |
650 } | 650 } |
651 | 651 |
652 #endif // XP_MACOSX | 652 #endif // XP_MACOSX |
653 | 653 |
654 #ifdef XP_UNIX | 654 #ifdef XP_UNIX |
655 | 655 |
656 static char keyEventToChar(XKeyEvent* event) | 656 static char keyEventToChar(XKeyEvent* event) |
657 { | 657 { |
658 char c = ' '; | 658 char c = ' '; |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 if (obj->pluginTest->NPP_GetValue(variable, value) == NPERR_NO_ERROR) | 833 if (obj->pluginTest->NPP_GetValue(variable, value) == NPERR_NO_ERROR) |
834 return NPERR_NO_ERROR; | 834 return NPERR_NO_ERROR; |
835 | 835 |
836 if (variable == NPPVpluginScriptableNPObject) { | 836 if (variable == NPPVpluginScriptableNPObject) { |
837 void **v = (void **)value; | 837 void **v = (void **)value; |
838 // Return value is expected to be retained | 838 // Return value is expected to be retained |
839 browser->retainobject((NPObject *)obj); | 839 browser->retainobject((NPObject *)obj); |
840 *v = obj; | 840 *v = obj; |
841 return NPERR_NO_ERROR; | 841 return NPERR_NO_ERROR; |
842 } | 842 } |
843 | 843 |
844 #ifdef XP_MACOSX | 844 #ifdef XP_MACOSX |
845 if (variable == NPPVpluginCoreAnimationLayer) { | 845 if (variable == NPPVpluginCoreAnimationLayer) { |
846 if (!obj->coreAnimationLayer) | 846 if (!obj->coreAnimationLayer) |
847 return NPERR_GENERIC_ERROR; | 847 return NPERR_GENERIC_ERROR; |
848 | 848 |
849 void **v = (void **)value; | 849 void **v = (void **)value; |
850 *v = (void*)CFRetain(obj->coreAnimationLayer); | 850 *v = (void*)CFRetain(obj->coreAnimationLayer); |
851 return NPERR_NO_ERROR; | 851 return NPERR_NO_ERROR; |
852 } | 852 } |
853 #endif | 853 #endif |
854 | 854 |
855 return NPERR_GENERIC_ERROR; | 855 return NPERR_GENERIC_ERROR; |
856 } | 856 } |
857 | 857 |
858 NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) | 858 NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value) |
859 { | 859 { |
860 PluginObject* obj = static_cast<PluginObject*>(instance->pdata); | 860 PluginObject* obj = static_cast<PluginObject*>(instance->pdata); |
861 return obj->pluginTest->NPP_SetValue(variable, value); | 861 return obj->pluginTest->NPP_SetValue(variable, value); |
862 } | 862 } |
863 | 863 |
864 #ifdef XP_UNIX | 864 #ifdef XP_UNIX |
865 extern "C" | 865 extern "C" |
866 const char* NP_GetMIMEDescription(void) | 866 const char* NP_GetMIMEDescription(void) |
867 { | 867 { |
868 return "application/x-webkit-test-netscape:testnetscape:test netscape conten
t;image/png:png:PNG image"; | 868 return "application/x-webkit-test-netscape:testnetscape:test netscape conten
t;image/png:png:PNG image"; |
869 } | 869 } |
870 | 870 |
871 extern "C" | 871 extern "C" |
872 NPError NP_GetValue(NPP instance, NPPVariable variable, void* value) | 872 NPError NP_GetValue(NPP instance, NPPVariable variable, void* value) |
873 { | 873 { |
874 return NPP_GetValue(instance, variable, value); | 874 return NPP_GetValue(instance, variable, value); |
875 } | 875 } |
876 #endif | 876 #endif |
OLD | NEW |