OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /* | 5 /* |
6 * Copyright (C) 2010 Apple Inc. All rights reserved. | 6 * Copyright (C) 2010 Apple Inc. All rights reserved. |
7 * | 7 * |
8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
10 * are met: | 10 * are met: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 NPIdentifier m_lastRemovedProperty; | 85 NPIdentifier m_lastRemovedProperty; |
86 }; | 86 }; |
87 | 87 |
88 struct PluginObject : Object<PluginObject> { | 88 struct PluginObject : Object<PluginObject> { |
89 public: | 89 public: |
90 PluginObject() | 90 PluginObject() |
91 : m_testObject(0) | 91 : m_testObject(0) |
92 { | 92 { |
93 } | 93 } |
94 | 94 |
95 virtual ~PluginObject() | 95 ~PluginObject() override { |
96 { | |
97 if (m_testObject) | 96 if (m_testObject) |
98 pluginTest()->NPN_ReleaseObject(m_testObject); | 97 pluginTest()->NPN_ReleaseObject(m_testObject); |
99 } | 98 } |
100 | 99 |
101 bool hasMethod(NPIdentifier methodName) | 100 bool hasMethod(NPIdentifier methodName) |
102 { | 101 { |
103 if (identifierIs(methodName, "testRemoveProperty")) | 102 if (identifierIs(methodName, "testRemoveProperty")) |
104 return true; | 103 return true; |
105 | 104 |
106 return false; | 105 return false; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 m_testObject = TestObject::create(pluginTest()); | 151 m_testObject = TestObject::create(pluginTest()); |
153 | 152 |
154 OBJECT_TO_NPVARIANT(pluginTest()->NPN_RetainObject(m_testObject), *r
esult); | 153 OBJECT_TO_NPVARIANT(pluginTest()->NPN_RetainObject(m_testObject), *r
esult); |
155 return true; | 154 return true; |
156 } | 155 } |
157 | 156 |
158 private: | 157 private: |
159 NPObject* m_testObject; | 158 NPObject* m_testObject; |
160 }; | 159 }; |
161 | 160 |
162 virtual NPError NPP_GetValue(NPPVariable variable, void* value) override { | 161 NPError NPP_GetValue(NPPVariable variable, void* value) override { |
163 if (variable != NPPVpluginScriptableNPObject) | 162 if (variable != NPPVpluginScriptableNPObject) |
164 return NPERR_GENERIC_ERROR; | 163 return NPERR_GENERIC_ERROR; |
165 | 164 |
166 *(NPObject**)value = PluginObject::create(this); | 165 *(NPObject**)value = PluginObject::create(this); |
167 | 166 |
168 return NPERR_NO_ERROR; | 167 return NPERR_NO_ERROR; |
169 } | 168 } |
170 | 169 |
171 }; | 170 }; |
172 | 171 |
173 static PluginTest::Register<NPRuntimeRemoveProperty> npRuntimeRemoveProperty("np
runtime-remove-property"); | 172 static PluginTest::Register<NPRuntimeRemoveProperty> npRuntimeRemoveProperty("np
runtime-remove-property"); |
OLD | NEW |