From 1b951f98b5d86ed9ba82555566627017211ad9d4 Mon Sep 17 00:00:00 2001 From: "apatrick@google.com" Date: Tue, 25 Aug 2009 23:13:46 +0000 Subject: Added GPU plugin object, an NPObject to which a plugin instance's NPP calls are forwarded. TEST=none BUG=none Review URL: http://codereview.chromium.org/173386 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24364 0039d316-1c4b-4281-b951-d872f2087c98 --- o3d/gpu_plugin/gpu_plugin_object.cc | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 o3d/gpu_plugin/gpu_plugin_object.cc (limited to 'o3d/gpu_plugin/gpu_plugin_object.cc') diff --git a/o3d/gpu_plugin/gpu_plugin_object.cc b/o3d/gpu_plugin/gpu_plugin_object.cc new file mode 100644 index 0000000..e6b7647 --- /dev/null +++ b/o3d/gpu_plugin/gpu_plugin_object.cc @@ -0,0 +1,58 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include + +#include "o3d/gpu_plugin/gpu_plugin_object.h" + +namespace o3d { +namespace gpu_plugin { + +const NPUTF8 GPUPluginObject::kPluginType[] = + "application/vnd.google.chrome.gpu-plugin"; + +NPError GPUPluginObject::New(NPMIMEType plugin_type, + int16 argc, + char* argn[], + char* argv[], + NPSavedData* saved) { + if (status_ != CREATED) + return NPERR_GENERIC_ERROR; + + status_ = INITIALIZED; + return NPERR_NO_ERROR; +} + +NPError GPUPluginObject::SetWindow(NPWindow* new_window) { + if (status_ != INITIALIZED) + return NPERR_GENERIC_ERROR; + + NPError error = PlatformSpecificSetWindow(new_window); + if (error == NPERR_NO_ERROR) { + window_ = *new_window; + } else { + memset(&window_, 0, sizeof(window_)); + } + + return error; +} + +int16 GPUPluginObject::HandleEvent(NPEvent* event) { + return 0; +} + +NPError GPUPluginObject::Destroy(NPSavedData** saved) { + if (status_ != INITIALIZED) + return NPERR_GENERIC_ERROR; + + status_ = DESTROYED; + return NPERR_NO_ERROR; +} + +NPObject* GPUPluginObject::GetScriptableInstance() { + return NULL; +} + +} // namespace gpu_plugin +} // namespace o3d -- cgit v1.1