Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(913)

Unified Diff: gpu/gpu_plugin/gpu_plugin.cc

Issue 549025: Set disabled style on GPU window and plugin intermediate window so mouse mess... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/plugin/webplugin_proxy.h ('k') | webkit/glue/webplugin.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/gpu_plugin/gpu_plugin.cc
===================================================================
--- gpu/gpu_plugin/gpu_plugin.cc (revision 36167)
+++ gpu/gpu_plugin/gpu_plugin.cc (working copy)
@@ -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 {
+// 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 @@
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;
}
« no previous file with comments | « chrome/plugin/webplugin_proxy.h ('k') | webkit/glue/webplugin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698