diff options
author | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-25 23:13:46 +0000 |
---|---|---|
committer | apatrick@google.com <apatrick@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-25 23:13:46 +0000 |
commit | 1b951f98b5d86ed9ba82555566627017211ad9d4 (patch) | |
tree | 3a051afc6116fa678dadf76f72b5ce587d84f61d /o3d/gpu_plugin/gpu_plugin_object.cc | |
parent | 130805e7d8ae9e6fe73b2f6180a04b989d7961e5 (diff) | |
download | chromium_src-1b951f98b5d86ed9ba82555566627017211ad9d4.zip chromium_src-1b951f98b5d86ed9ba82555566627017211ad9d4.tar.gz chromium_src-1b951f98b5d86ed9ba82555566627017211ad9d4.tar.bz2 |
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
Diffstat (limited to 'o3d/gpu_plugin/gpu_plugin_object.cc')
-rw-r--r-- | o3d/gpu_plugin/gpu_plugin_object.cc | 58 |
1 files changed, 58 insertions, 0 deletions
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 <stdlib.h> + +#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 |