| 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 |
| 505 // NPNVjavascriptEnabledBool: tells whether Javascript is enabled | 507 // NPNVjavascriptEnabledBool: tells whether Javascript is enabled |
| 506 // NPNVasdEnabledBool: tells whether SmartUpdate is enabled | 508 // NPNVasdEnabledBool: tells whether SmartUpdate is enabled |
| 507 // NPNVOfflineBool: tells whether offline-mode is enabled | 509 // NPNVOfflineBool: tells whether offline-mode is enabled |
| 508 | 510 |
| 509 NPError rv = NPERR_GENERIC_ERROR; | 511 NPError rv = NPERR_GENERIC_ERROR; |
| 510 | 512 |
| 511 switch (static_cast<int>(variable)) { | 513 switch (static_cast<int>(variable)) { |
| 512 case NPNVWindowNPObject: { | 514 case NPNVWindowNPObject: { |
| 513 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 515 scoped_refptr<PluginInstance> plugin(FindInstance(id)); |
| 514 if (!plugin.get()) { | 516 if (!plugin.get()) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 542 if (np_object) { | 544 if (np_object) { |
| 543 WebBindings::retainObject(np_object); | 545 WebBindings::retainObject(np_object); |
| 544 void** v = static_cast<void**>(value); | 546 void** v = static_cast<void**>(value); |
| 545 *v = np_object; | 547 *v = np_object; |
| 546 rv = NPERR_NO_ERROR; | 548 rv = NPERR_NO_ERROR; |
| 547 } else { | 549 } else { |
| 548 NOTREACHED(); | 550 NOTREACHED(); |
| 549 } | 551 } |
| 550 break; | 552 break; |
| 551 } | 553 } |
| 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 |
| 552 case NPNVjavascriptEnabledBool: { | 567 case NPNVjavascriptEnabledBool: { |
| 553 // yes, JS is enabled. | 568 // yes, JS is enabled. |
| 554 *((void**)value) = (void*)1; | 569 *((void**)value) = (void*)1; |
| 555 rv = NPERR_NO_ERROR; | 570 rv = NPERR_NO_ERROR; |
| 556 break; | 571 break; |
| 557 } | 572 } |
| 558 case NPNVSupportsWindowless: { | 573 case NPNVSupportsWindowless: { |
| 559 NPBool* supports_windowless = reinterpret_cast<NPBool*>(value); | 574 NPBool* supports_windowless = reinterpret_cast<NPBool*>(value); |
| 560 *supports_windowless = true; | 575 *supports_windowless = true; |
| 561 rv = NPERR_NO_ERROR; | 576 rv = NPERR_NO_ERROR; |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 894 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) { | 909 NPBool NPN_UnfocusInstance(NPP id, NPFocusDirection direction) { |
| 895 // TODO: Implement advanced key handling: http://crbug.com/46578 | 910 // TODO: Implement advanced key handling: http://crbug.com/46578 |
| 896 NOTIMPLEMENTED(); | 911 NOTIMPLEMENTED(); |
| 897 return false; | 912 return false; |
| 898 } | 913 } |
| 899 | 914 |
| 900 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { | 915 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { |
| 901 } | 916 } |
| 902 | 917 |
| 903 } // extern "C" | 918 } // extern "C" |
| OLD | NEW |