| 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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 // We deliberately do not implement this; we don't want plugins forcing | 495 // We deliberately do not implement this; we don't want plugins forcing |
| 496 // synchronous paints. | 496 // synchronous paints. |
| 497 } | 497 } |
| 498 | 498 |
| 499 NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { | 499 NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { |
| 500 // Allows the plugin to query the browser for information | 500 // Allows the plugin to query the browser for information |
| 501 // | 501 // |
| 502 // Variables: | 502 // Variables: |
| 503 // NPNVxDisplay (unix only) | 503 // NPNVxDisplay (unix only) |
| 504 // NPNVxtAppContext (unix only) | 504 // NPNVxtAppContext (unix only) |
| 505 // NPNVnetscapeWindow (win only) - Gets the native window on which the | |
| 506 // plugin drawing occurs, returns HWND | |
| 507 // NPNVjavascriptEnabledBool: tells whether Javascript is enabled | 505 // NPNVjavascriptEnabledBool: tells whether Javascript is enabled |
| 508 // NPNVasdEnabledBool: tells whether SmartUpdate is enabled | 506 // NPNVasdEnabledBool: tells whether SmartUpdate is enabled |
| 509 // NPNVOfflineBool: tells whether offline-mode is enabled | 507 // NPNVOfflineBool: tells whether offline-mode is enabled |
| 510 | 508 |
| 511 NPError rv = NPERR_GENERIC_ERROR; | 509 NPError rv = NPERR_GENERIC_ERROR; |
| 512 | 510 |
| 513 switch (static_cast<int>(variable)) { | 511 switch (static_cast<int>(variable)) { |
| 514 case NPNVWindowNPObject: { | 512 case NPNVWindowNPObject: { |
| 515 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 513 scoped_refptr<PluginInstance> plugin(FindInstance(id)); |
| 516 if (!plugin.get()) { | 514 if (!plugin.get()) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 544 if (np_object) { | 542 if (np_object) { |
| 545 WebBindings::retainObject(np_object); | 543 WebBindings::retainObject(np_object); |
| 546 void** v = static_cast<void**>(value); | 544 void** v = static_cast<void**>(value); |
| 547 *v = np_object; | 545 *v = np_object; |
| 548 rv = NPERR_NO_ERROR; | 546 rv = NPERR_NO_ERROR; |
| 549 } else { | 547 } else { |
| 550 NOTREACHED(); | 548 NOTREACHED(); |
| 551 } | 549 } |
| 552 break; | 550 break; |
| 553 } | 551 } |
| 554 #if !defined(OS_MACOSX) // OS X doesn't have windowed plugins. | |
| 555 case NPNVnetscapeWindow: { | |
| 556 scoped_refptr<PluginInstance> plugin = FindInstance(id); | |
| 557 if (!plugin.get()) { | |
| 558 NOTREACHED(); | |
| 559 return NPERR_INVALID_INSTANCE_ERROR; | |
| 560 } | |
| 561 gfx::PluginWindowHandle handle = plugin->window_handle(); | |
| 562 *((void**)value) = (void*)handle; | |
| 563 rv = NPERR_NO_ERROR; | |
| 564 break; | |
| 565 } | |
| 566 #endif | |
| 567 case NPNVjavascriptEnabledBool: { | 552 case NPNVjavascriptEnabledBool: { |
| 568 // yes, JS is enabled. | 553 // yes, JS is enabled. |
| 569 *((void**)value) = (void*)1; | 554 *((void**)value) = (void*)1; |
| 570 rv = NPERR_NO_ERROR; | 555 rv = NPERR_NO_ERROR; |
| 571 break; | 556 break; |
| 572 } | 557 } |
| 573 case NPNVSupportsWindowless: { | 558 case NPNVSupportsWindowless: { |
| 574 NPBool* supports_windowless = reinterpret_cast<NPBool*>(value); | 559 NPBool* supports_windowless = reinterpret_cast<NPBool*>(value); |
| 575 *supports_windowless = true; | 560 *supports_windowless = true; |
| 576 rv = NPERR_NO_ERROR; | 561 rv = NPERR_NO_ERROR; |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) { | 894 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) { |
| 910 // TODO: Implement advanced key handling: http://crbug.com/46578 | 895 // TODO: Implement advanced key handling: http://crbug.com/46578 |
| 911 NOTIMPLEMENTED(); | 896 NOTIMPLEMENTED(); |
| 912 return false; | 897 return false; |
| 913 } | 898 } |
| 914 | 899 |
| 915 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { | 900 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { |
| 916 } | 901 } |
| 917 | 902 |
| 918 } // extern "C" | 903 } // extern "C" |
| OLD | NEW |