diff options
author | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-15 00:10:09 +0000 |
---|---|---|
committer | apatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-15 00:10:09 +0000 |
commit | 8e14284ed88d453f7ae280f033fffe7bcd6d8450 (patch) | |
tree | 3d1c5ef57ba393c3782f3095061a948b70f93f3e /gpu/gpu_plugin/gpu_plugin.cc | |
parent | 573ef318ab6f9116139419745d741765ff4bb910 (diff) | |
download | chromium_src-8e14284ed88d453f7ae280f033fffe7bcd6d8450.zip chromium_src-8e14284ed88d453f7ae280f033fffe7bcd6d8450.tar.gz chromium_src-8e14284ed88d453f7ae280f033fffe7bcd6d8450.tar.bz2 |
Set disabled style on GPU window and plugin intermediate window so mouse messages pass through to the browser window.
TEST=trybots
BUG=none
Review URL: http://codereview.chromium.org/549025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36311 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/gpu_plugin/gpu_plugin.cc')
-rw-r--r-- | gpu/gpu_plugin/gpu_plugin.cc | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/gpu/gpu_plugin/gpu_plugin.cc b/gpu/gpu_plugin/gpu_plugin.cc index 7413a4f..5bccbe4 100644 --- a/gpu/gpu_plugin/gpu_plugin.cc +++ b/gpu/gpu_plugin/gpu_plugin.cc @@ -2,6 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#if defined(OS_WIN) +#include <windows.h> +#endif + +#include "base/logging.h" +#include "build/build_config.h" #include "gpu/gpu_plugin/gpu_plugin.h" #include "webkit/glue/plugins/nphostapi.h" @@ -11,12 +17,54 @@ namespace gpu_plugin { namespace { +// TODO(apatrick): move this to platform specific source files. +#if defined(OS_WIN) +class PluginObject { + public: + PluginObject(); + ~PluginObject(); + + void SetWindow(HWND hwnd); + + private: + HWND hwnd_; + DISALLOW_COPY_AND_ASSIGN(PluginObject); +}; + +const wchar_t* const kPluginObject = L"GPUPluginObject"; + +PluginObject::PluginObject() : hwnd_(NULL) { +} + +PluginObject::~PluginObject() { +} + +void PluginObject::SetWindow(HWND hwnd) { + hwnd_ = hwnd; + if (hwnd_) { + // Store plugin object in window property. + SetProp(hwnd_, kPluginObject, reinterpret_cast<HANDLE>(this)); + + // Disable plugin window so mouse messages are passed to the parent window. + EnableWindow(hwnd_, false); + } else { + // Clean up properties. + RemoveProp(hwnd_, kPluginObject); + } +} + +#endif // defined(OS_WIN) + NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved) { if (!instance) return NPERR_INVALID_INSTANCE_ERROR; +#if defined(OS_WIN) + instance->pdata = new PluginObject; +#endif + return NPERR_NO_ERROR; } @@ -24,10 +72,19 @@ NPError NPP_Destroy(NPP instance, NPSavedData** saved) { if (!instance) return NPERR_INVALID_INSTANCE_ERROR; +#if defined(OS_WIN) + delete static_cast<PluginObject*>(instance->pdata); +#endif + return NPERR_NO_ERROR; } NPError NPP_SetWindow(NPP instance, NPWindow* window) { +#if defined(OS_WIN) + PluginObject* plugin_object = static_cast<PluginObject*>(instance->pdata); + plugin_object->SetWindow(reinterpret_cast<HWND>(window->window)); +#endif + return NPERR_NO_ERROR; } |