OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 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 |
(...skipping 20 matching lines...) Expand all Loading... |
31 class PluginScriptableNPObjectInvokeDefault : public PluginTest { | 31 class PluginScriptableNPObjectInvokeDefault : public PluginTest { |
32 public: | 32 public: |
33 PluginScriptableNPObjectInvokeDefault(NPP npp, const string& identifier) | 33 PluginScriptableNPObjectInvokeDefault(NPP npp, const string& identifier) |
34 : PluginTest(npp, identifier) | 34 : PluginTest(npp, identifier) |
35 { | 35 { |
36 } | 36 } |
37 | 37 |
38 private: | 38 private: |
39 struct NPObjectWithoutInvokeDefault : Object<NPObjectWithoutInvokeDefault> {
}; | 39 struct NPObjectWithoutInvokeDefault : Object<NPObjectWithoutInvokeDefault> {
}; |
40 | 40 |
41 struct NPObjectWithInvokeDefault : Object<NPObjectWithInvokeDefault> { | 41 struct NPObjectWithInvokeDefault : Object<NPObjectWithInvokeDefault> { |
42 public: | 42 public: |
43 bool invokeDefault(const NPVariant*, uint32_t, NPVariant* result) | 43 bool invokeDefault(const NPVariant*, uint32_t, NPVariant* result) |
44 { | 44 { |
45 INT32_TO_NPVARIANT(1, *result); | 45 INT32_TO_NPVARIANT(1, *result); |
46 return true; | 46 return true; |
47 } | 47 } |
48 }; | 48 }; |
49 | 49 |
50 virtual NPError NPP_GetValue(NPPVariable variable, void *value) | 50 virtual NPError NPP_GetValue(NPPVariable variable, void *value) |
51 { | 51 { |
52 if (variable != NPPVpluginScriptableNPObject) | 52 if (variable != NPPVpluginScriptableNPObject) |
53 return NPERR_GENERIC_ERROR; | 53 return NPERR_GENERIC_ERROR; |
54 | 54 |
55 NPObject* object; | 55 NPObject* object; |
56 if (identifier() == "plugin-scriptable-npobject-invoke-default") | 56 if (identifier() == "plugin-scriptable-npobject-invoke-default") |
57 object = NPObjectWithInvokeDefault::create(this); | 57 object = NPObjectWithInvokeDefault::create(this); |
58 else | 58 else |
59 object = NPObjectWithoutInvokeDefault::create(this); | 59 object = NPObjectWithoutInvokeDefault::create(this); |
60 | 60 |
61 *(NPObject**)value = object; | 61 *(NPObject**)value = object; |
62 | 62 |
63 return NPERR_NO_ERROR; | 63 return NPERR_NO_ERROR; |
64 } | 64 } |
65 }; | 65 }; |
66 | 66 |
67 static PluginTest::Register<PluginScriptableNPObjectInvokeDefault> pluginScripta
bleNPObjectInvokeDefault("plugin-scriptable-npobject-invoke-default"); | 67 static PluginTest::Register<PluginScriptableNPObjectInvokeDefault> pluginScripta
bleNPObjectInvokeDefault("plugin-scriptable-npobject-invoke-default"); |
68 static PluginTest::Register<PluginScriptableNPObjectInvokeDefault> pluginScripta
bleNPObjectNoInvokeDefault("plugin-scriptable-npobject-no-invoke-default"); | 68 static PluginTest::Register<PluginScriptableNPObjectInvokeDefault> pluginScripta
bleNPObjectNoInvokeDefault("plugin-scriptable-npobject-no-invoke-default"); |
OLD | NEW |