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) 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * Copyright (C) 2009 Holger Hans Peter Freyther | 7 * Copyright (C) 2009 Holger Hans Peter Freyther |
8 * Copyright (C) 2010 Collabora Ltd. | 8 * Copyright (C) 2010 Collabora Ltd. |
9 * | 9 * |
10 * Redistribution and use in source and binary forms, with or without | 10 * Redistribution and use in source and binary forms, with or without |
(...skipping 14 matching lines...) Expand all Loading... |
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
26 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 26 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
27 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 #include "PluginObject.h" | 32 #include "PluginObject.h" |
33 | 33 |
34 #include "PluginTest.h" | 34 #include "PluginTest.h" |
35 #include "TestObject.h" | 35 #include "content/shell/tools/plugin/test_object.h" |
36 #include "base/strings/string_util.h" | 36 #include "base/strings/string_util.h" |
37 #include <assert.h> | 37 #include <assert.h> |
38 #include <stdio.h> | 38 #include <stdio.h> |
39 #include <stdlib.h> | 39 #include <stdlib.h> |
40 #include <string.h> | 40 #include <string.h> |
41 | 41 |
42 // Helper function which takes in the plugin window object for logging to the | 42 // Helper function which takes in the plugin window object for logging to the |
43 // console object. | 43 // console object. |
44 static void pluginLogWithWindowObject(NPObject* windowObject, | 44 static void pluginLogWithWindowObject(NPObject* windowObject, |
45 NPP instance, | 45 NPP instance, |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 (unsigned)plugin->lastWindow.height, | 363 (unsigned)plugin->lastWindow.height, |
364 plugin->lastWindow.clipRect.left, | 364 plugin->lastWindow.clipRect.left, |
365 plugin->lastWindow.clipRect.top, | 365 plugin->lastWindow.clipRect.top, |
366 plugin->lastWindow.clipRect.right - plugin->lastWindow.clipRect.left, | 366 plugin->lastWindow.clipRect.right - plugin->lastWindow.clipRect.left, |
367 plugin->lastWindow.clipRect.bottom - plugin->lastWindow.clipRect.top); | 367 plugin->lastWindow.clipRect.bottom - plugin->lastWindow.clipRect.top); |
368 | 368 |
369 STRINGZ_TO_NPVARIANT(buf, *result); | 369 STRINGZ_TO_NPVARIANT(buf, *result); |
370 return true; | 370 return true; |
371 } | 371 } |
372 if (name == pluginPropertyIdentifiers[ID_PROPERTY_TEST_OBJECT_COUNT]) { | 372 if (name == pluginPropertyIdentifiers[ID_PROPERTY_TEST_OBJECT_COUNT]) { |
373 INT32_TO_NPVARIANT(getTestObjectCount(), *result); | 373 INT32_TO_NPVARIANT(content::GetTestObjectCount(), *result); |
374 return true; | 374 return true; |
375 } | 375 } |
376 | 376 |
377 if (name == pluginPropertyIdentifiers[ID_PROPERTY_DELETE_IN_GET_PROPERTY]) { | 377 if (name == pluginPropertyIdentifiers[ID_PROPERTY_DELETE_IN_GET_PROPERTY]) { |
378 browser->retainobject(obj); | 378 browser->retainobject(obj); |
379 callDeletePlugin( | 379 callDeletePlugin( |
380 obj, | 380 obj, |
381 name, | 381 name, |
382 pluginPropertyIdentifiers[ID_PROPERTY_DELETE_IN_GET_PROPERTY]); | 382 pluginPropertyIdentifiers[ID_PROPERTY_DELETE_IN_GET_PROPERTY]); |
383 NPObject* testObject = plugin->testObject; | 383 NPObject* testObject = plugin->testObject; |
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 return false; | 1254 return false; |
1255 } | 1255 } |
1256 if (name == pluginMethodIdentifiers[ID_TEST_CLONE_OBJECT]) { | 1256 if (name == pluginMethodIdentifiers[ID_TEST_CLONE_OBJECT]) { |
1257 NPObject* new_object = | 1257 NPObject* new_object = |
1258 browser->createobject(plugin->npp, plugin->header._class); | 1258 browser->createobject(plugin->npp, plugin->header._class); |
1259 assert(new_object->referenceCount == 1); | 1259 assert(new_object->referenceCount == 1); |
1260 OBJECT_TO_NPVARIANT(new_object, *result); | 1260 OBJECT_TO_NPVARIANT(new_object, *result); |
1261 return true; | 1261 return true; |
1262 } | 1262 } |
1263 if (name == pluginMethodIdentifiers[ID_TEST_CREATE_TEST_OBJECT]) { | 1263 if (name == pluginMethodIdentifiers[ID_TEST_CREATE_TEST_OBJECT]) { |
1264 NPObject* testObject = browser->createobject(plugin->npp, getTestClass()); | 1264 NPObject* testObject = |
| 1265 browser->createobject(plugin->npp, content::GetTestClass()); |
1265 assert(testObject->referenceCount == 1); | 1266 assert(testObject->referenceCount == 1); |
1266 OBJECT_TO_NPVARIANT(testObject, *result); | 1267 OBJECT_TO_NPVARIANT(testObject, *result); |
1267 return true; | 1268 return true; |
1268 } | 1269 } |
1269 if (name == pluginMethodIdentifiers[ID_DESTROY_NULL_STREAM]) | 1270 if (name == pluginMethodIdentifiers[ID_DESTROY_NULL_STREAM]) |
1270 return destroyNullStream(plugin, args, argCount, result); | 1271 return destroyNullStream(plugin, args, argCount, result); |
1271 if (name == pluginMethodIdentifiers[ID_TEST_RELOAD_PLUGINS_NO_PAGES]) { | 1272 if (name == pluginMethodIdentifiers[ID_TEST_RELOAD_PLUGINS_NO_PAGES]) { |
1272 browser->reloadplugins(false); | 1273 browser->reloadplugins(false); |
1273 return true; | 1274 return true; |
1274 } | 1275 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 static NPObject* pluginAllocate(NPP npp, NPClass* theClass) { | 1346 static NPObject* pluginAllocate(NPP npp, NPClass* theClass) { |
1346 PluginObject* newInstance = (PluginObject*)malloc(sizeof(PluginObject)); | 1347 PluginObject* newInstance = (PluginObject*)malloc(sizeof(PluginObject)); |
1347 | 1348 |
1348 if (!identifiersInitialized) { | 1349 if (!identifiersInitialized) { |
1349 identifiersInitialized = true; | 1350 identifiersInitialized = true; |
1350 initializeIdentifiers(); | 1351 initializeIdentifiers(); |
1351 } | 1352 } |
1352 | 1353 |
1353 newInstance->pluginTest = 0; | 1354 newInstance->pluginTest = 0; |
1354 newInstance->npp = npp; | 1355 newInstance->npp = npp; |
1355 newInstance->testObject = browser->createobject(npp, getTestClass()); | 1356 newInstance->testObject = browser->createobject(npp, content::GetTestClass()); |
1356 newInstance->rememberedObject = 0; | 1357 newInstance->rememberedObject = 0; |
1357 newInstance->eventLogging = false; | 1358 newInstance->eventLogging = false; |
1358 newInstance->onStreamLoad = 0; | 1359 newInstance->onStreamLoad = 0; |
1359 newInstance->onStreamDestroy = 0; | 1360 newInstance->onStreamDestroy = 0; |
1360 newInstance->onDestroy = 0; | 1361 newInstance->onDestroy = 0; |
1361 newInstance->onURLNotify = 0; | 1362 newInstance->onURLNotify = 0; |
1362 newInstance->onSetWindow = 0; | 1363 newInstance->onSetWindow = 0; |
1363 newInstance->onPaintEvent = 0; | 1364 newInstance->onPaintEvent = 0; |
1364 newInstance->logDestroy = false; | 1365 newInstance->logDestroy = false; |
1365 newInstance->logSetWindow = false; | 1366 newInstance->logSetWindow = false; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1474 DOUBLE_TO_NPVARIANT(242.242, args[4]); | 1475 DOUBLE_TO_NPVARIANT(242.242, args[4]); |
1475 STRINGZ_TO_NPVARIANT("Hello, World", args[5]); | 1476 STRINGZ_TO_NPVARIANT("Hello, World", args[5]); |
1476 OBJECT_TO_NPVARIANT(windowScriptObject, args[6]); | 1477 OBJECT_TO_NPVARIANT(windowScriptObject, args[6]); |
1477 | 1478 |
1478 NPVariant result; | 1479 NPVariant result; |
1479 if (browser->invoke(npp, windowScriptObject, testNPInvoke, args, 7, &result)) | 1480 if (browser->invoke(npp, windowScriptObject, testNPInvoke, args, 7, &result)) |
1480 browser->releasevariantvalue(&result); | 1481 browser->releasevariantvalue(&result); |
1481 | 1482 |
1482 browser->releaseobject(windowScriptObject); | 1483 browser->releaseobject(windowScriptObject); |
1483 } | 1484 } |
OLD | NEW |