| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/child/npapi/plugin_host.h" | 5 #include "content/child/npapi/plugin_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 // NPNVxtAppContext (unix only) | 504 // NPNVxtAppContext (unix only) |
| 505 // NPNVnetscapeWindow (win only) - Gets the native window on which the | 505 // NPNVnetscapeWindow (win only) - Gets the native window on which the |
| 506 // plugin drawing occurs, returns HWND | 506 // plugin drawing occurs, returns HWND |
| 507 // NPNVjavascriptEnabledBool: tells whether Javascript is enabled | 507 // NPNVjavascriptEnabledBool: tells whether Javascript is enabled |
| 508 // NPNVasdEnabledBool: tells whether SmartUpdate is enabled | 508 // NPNVasdEnabledBool: tells whether SmartUpdate is enabled |
| 509 // NPNVOfflineBool: tells whether offline-mode is enabled | 509 // NPNVOfflineBool: tells whether offline-mode is enabled |
| 510 | 510 |
| 511 NPError rv = NPERR_GENERIC_ERROR; | 511 NPError rv = NPERR_GENERIC_ERROR; |
| 512 | 512 |
| 513 switch (static_cast<int>(variable)) { | 513 switch (static_cast<int>(variable)) { |
| 514 case NPNVWindowNPObject: { | |
| 515 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | |
| 516 if (!plugin.get()) { | |
| 517 NOTREACHED(); | |
| 518 return NPERR_INVALID_INSTANCE_ERROR; | |
| 519 } | |
| 520 NPObject *np_object = plugin->webplugin()->GetWindowScriptNPObject(); | |
| 521 // Return value is expected to be retained, as | |
| 522 // described here: | |
| 523 // <http://www.mozilla.org/projects/plugins/npruntime.html#browseraccess> | |
| 524 if (np_object) { | |
| 525 WebBindings::retainObject(np_object); | |
| 526 void **v = (void **)value; | |
| 527 *v = np_object; | |
| 528 rv = NPERR_NO_ERROR; | |
| 529 } else { | |
| 530 NOTREACHED(); | |
| 531 } | |
| 532 break; | |
| 533 } | |
| 534 case NPNVPluginElementNPObject: { | |
| 535 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | |
| 536 if (!plugin.get()) { | |
| 537 NOTREACHED(); | |
| 538 return NPERR_INVALID_INSTANCE_ERROR; | |
| 539 } | |
| 540 NPObject *np_object = plugin->webplugin()->GetPluginElement(); | |
| 541 // Return value is expected to be retained, as | |
| 542 // described here: | |
| 543 // <http://www.mozilla.org/projects/plugins/npruntime.html#browseraccess> | |
| 544 if (np_object) { | |
| 545 WebBindings::retainObject(np_object); | |
| 546 void** v = static_cast<void**>(value); | |
| 547 *v = np_object; | |
| 548 rv = NPERR_NO_ERROR; | |
| 549 } else { | |
| 550 NOTREACHED(); | |
| 551 } | |
| 552 break; | |
| 553 } | |
| 554 #if !defined(OS_MACOSX) // OS X doesn't have windowed plugins. | 514 #if !defined(OS_MACOSX) // OS X doesn't have windowed plugins. |
| 555 case NPNVnetscapeWindow: { | 515 case NPNVnetscapeWindow: { |
| 556 scoped_refptr<PluginInstance> plugin = FindInstance(id); | 516 scoped_refptr<PluginInstance> plugin = FindInstance(id); |
| 557 if (!plugin.get()) { | 517 if (!plugin.get()) { |
| 558 NOTREACHED(); | 518 NOTREACHED(); |
| 559 return NPERR_INVALID_INSTANCE_ERROR; | 519 return NPERR_INVALID_INSTANCE_ERROR; |
| 560 } | 520 } |
| 561 gfx::PluginWindowHandle handle = plugin->window_handle(); | 521 gfx::PluginWindowHandle handle = plugin->window_handle(); |
| 562 *((void**)value) = (void*)handle; | 522 *((void**)value) = (void*)handle; |
| 563 rv = NPERR_NO_ERROR; | 523 rv = NPERR_NO_ERROR; |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) { | 869 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) { |
| 910 // TODO: Implement advanced key handling: http://crbug.com/46578 | 870 // TODO: Implement advanced key handling: http://crbug.com/46578 |
| 911 NOTIMPLEMENTED(); | 871 NOTIMPLEMENTED(); |
| 912 return false; | 872 return false; |
| 913 } | 873 } |
| 914 | 874 |
| 915 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { | 875 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { |
| 916 } | 876 } |
| 917 | 877 |
| 918 } // extern "C" | 878 } // extern "C" |
| OLD | NEW |