diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-01 16:16:50 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-01 16:16:50 +0000 |
commit | 1758e88fd909ea0ffd49621e8066ffad5627ffdf (patch) | |
tree | c304a5eed047cae5665f5af1739d84655fb5815d /ppapi/cpp/dev/widget_client_dev.cc | |
parent | e7d8b51953b7d3b2b8a0aba46132305b32f3efce (diff) | |
download | chromium_src-1758e88fd909ea0ffd49621e8066ffad5627ffdf.zip chromium_src-1758e88fd909ea0ffd49621e8066ffad5627ffdf.tar.gz chromium_src-1758e88fd909ea0ffd49621e8066ffad5627ffdf.tar.bz2 |
Move PPAPI into the Chrome repo. The old repo was
http://ppapi.googlecode.com/
TEST=none
BUG=none
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64613 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp/dev/widget_client_dev.cc')
-rw-r--r-- | ppapi/cpp/dev/widget_client_dev.cc | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/ppapi/cpp/dev/widget_client_dev.cc b/ppapi/cpp/dev/widget_client_dev.cc new file mode 100644 index 0000000..8407810 --- /dev/null +++ b/ppapi/cpp/dev/widget_client_dev.cc @@ -0,0 +1,74 @@ +// Copyright (c) 2010 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 "ppapi/cpp/dev/widget_client_dev.h" + +#include "ppapi/c/dev/ppp_scrollbar_dev.h" +#include "ppapi/c/dev/ppp_widget_dev.h" +#include "ppapi/cpp/dev/scrollbar_dev.h" +#include "ppapi/cpp/dev/widget_dev.h" +#include "ppapi/cpp/instance.h" +#include "ppapi/cpp/module.h" +#include "ppapi/cpp/module_impl.h" +#include "ppapi/cpp/rect.h" + +namespace pp { + +namespace { + +// PPP_Widget_Dev -------------------------------------------------------------- + +const char kPPPWidgetInterface[] = PPP_WIDGET_DEV_INTERFACE; + +void Widget_Invalidate(PP_Instance instance, + PP_Resource widget_id, + const PP_Rect* dirty_rect) { + void* object = + pp::Instance::GetPerInstanceObject(instance, kPPPWidgetInterface); + if (!object) + return; + return static_cast<WidgetClient_Dev*>(object)->InvalidateWidget( + Widget_Dev(widget_id), *dirty_rect); +} + +static PPP_Widget_Dev widget_interface = { + &Widget_Invalidate, +}; + +// PPP_Scrollbar_Dev ----------------------------------------------------------- + +const char kPPPScrollbarInterface[] = PPP_SCROLLBAR_DEV_INTERFACE; + +void Scrollbar_ValueChanged(PP_Instance instance, + PP_Resource scrollbar_id, + uint32_t value) { + void* object = + pp::Instance::GetPerInstanceObject(instance, kPPPScrollbarInterface); + if (!object) + return; + return static_cast<WidgetClient_Dev*>(object)->ScrollbarValueChanged( + Scrollbar_Dev(scrollbar_id), value); +} + +static PPP_Scrollbar_Dev scrollbar_interface = { + &Scrollbar_ValueChanged, +}; + +} // namespace + +WidgetClient_Dev::WidgetClient_Dev(Instance* instance) + : associated_instance_(instance) { + pp::Module::Get()->AddPluginInterface(kPPPWidgetInterface, &widget_interface); + associated_instance_->AddPerInstanceObject(kPPPWidgetInterface, this); + pp::Module::Get()->AddPluginInterface(kPPPScrollbarInterface, + &scrollbar_interface); + associated_instance_->AddPerInstanceObject(kPPPScrollbarInterface, this); +} + +WidgetClient_Dev::~WidgetClient_Dev() { + associated_instance_->RemovePerInstanceObject(kPPPScrollbarInterface, this); + associated_instance_->RemovePerInstanceObject(kPPPWidgetInterface, this); +} + +} // namespace pp |