diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-23 21:49:48 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-23 21:49:48 +0000 |
commit | 0b94c614fe0d76578a84b4e0543f58650d3ad49c (patch) | |
tree | f08dab436f29cd17bff34e5b80bf14ad62f00a2c /ppapi/thunk | |
parent | 4c75b2543443e1b9faca724fc665b0c0fc68c15f (diff) | |
download | chromium_src-0b94c614fe0d76578a84b4e0543f58650d3ad49c.zip chromium_src-0b94c614fe0d76578a84b4e0543f58650d3ad49c.tar.gz chromium_src-0b94c614fe0d76578a84b4e0543f58650d3ad49c.tar.bz2 |
Make scrollbar GetThickness take a resource argument. This allows simlper
routing of the request using the new thunk system.
Support for the old interface is kept to keep pdf and nacl building.
This removes the old Resource type introspection since this was the last
resource using it.
TEST=it compiles
BUG=non
Review URL: http://codereview.chromium.org/7228003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90272 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk')
-rw-r--r-- | ppapi/thunk/ppb_scrollbar_api.h | 26 | ||||
-rw-r--r-- | ppapi/thunk/ppb_scrollbar_thunk.cc | 87 | ||||
-rw-r--r-- | ppapi/thunk/resource_creation_api.h | 2 | ||||
-rw-r--r-- | ppapi/thunk/thunk.h | 2 |
4 files changed, 117 insertions, 0 deletions
diff --git a/ppapi/thunk/ppb_scrollbar_api.h b/ppapi/thunk/ppb_scrollbar_api.h new file mode 100644 index 0000000..aa0541a --- /dev/null +++ b/ppapi/thunk/ppb_scrollbar_api.h @@ -0,0 +1,26 @@ +// Copyright (c) 2011 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. + +#ifndef PPAPI_THUNK_PPB_SCROLLBAR_API_H_ +#define PPAPI_THUNK_PPB_SCROLLBAR_API_H_ + +#include "ppapi/c/dev/ppb_scrollbar_dev.h" + +namespace ppapi { +namespace thunk { + +class PPB_Scrollbar_API { + public: + virtual uint32_t GetThickness() = 0; + virtual uint32_t GetValue() = 0; + virtual void SetValue(uint32_t value) = 0; + virtual void SetDocumentSize(uint32_t size) = 0; + virtual void SetTickMarks(const PP_Rect* tick_marks, uint32_t count) = 0; + virtual void ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier) = 0; +}; + +} // namespace thunk +} // namespace ppapi + +#endif // PPAPI_THUNK_PPB_SCROLLBAR_API_H_ diff --git a/ppapi/thunk/ppb_scrollbar_thunk.cc b/ppapi/thunk/ppb_scrollbar_thunk.cc new file mode 100644 index 0000000..572312d --- /dev/null +++ b/ppapi/thunk/ppb_scrollbar_thunk.cc @@ -0,0 +1,87 @@ +// Copyright (c) 2011 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/thunk/thunk.h" +#include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppb_scrollbar_api.h" +#include "ppapi/thunk/resource_creation_api.h" + +namespace ppapi { +namespace thunk { + +typedef EnterResource<PPB_Scrollbar_API> EnterScrollbar; + +namespace { + +PP_Resource Create(PP_Instance instance, PP_Bool vertical) { + EnterFunction<ResourceCreationAPI> enter(instance, true); + if (enter.failed()) + return 0; + return enter.functions()->CreateScrollbar(instance, vertical); +} + +PP_Bool IsScrollbar(PP_Resource resource) { + EnterScrollbar enter(resource, false); + return PP_FromBool(enter.succeeded()); +} + +uint32_t GetThickness(PP_Resource scrollbar) { + EnterScrollbar enter(scrollbar, true); + if (enter.failed()) + return 0; + return enter.object()->GetThickness(); +} + +uint32_t GetValue(PP_Resource scrollbar) { + EnterScrollbar enter(scrollbar, true); + if (enter.failed()) + return 0; + return enter.object()->GetValue(); +} + +void SetValue(PP_Resource scrollbar, uint32_t value) { + EnterScrollbar enter(scrollbar, true); + if (enter.succeeded()) + enter.object()->GetValue(); +} + +void SetDocumentSize(PP_Resource scrollbar, uint32_t size) { + EnterScrollbar enter(scrollbar, true); + if (enter.succeeded()) + enter.object()->SetDocumentSize(size); +} + +void SetTickMarks(PP_Resource scrollbar, + const PP_Rect* tick_marks, + uint32_t count) { + EnterScrollbar enter(scrollbar, true); + if (enter.succeeded()) + enter.object()->SetTickMarks(tick_marks, count); +} + +void ScrollBy(PP_Resource scrollbar, PP_ScrollBy_Dev unit, int32_t multiplier) { + EnterScrollbar enter(scrollbar, true); + if (enter.succeeded()) + enter.object()->ScrollBy(unit, multiplier); +} + +const PPB_Scrollbar_0_4_Dev g_ppb_scrollbar_thunk = { + &Create, + &IsScrollbar, + &GetThickness, + &GetValue, + &SetValue, + &SetDocumentSize, + &SetTickMarks, + &ScrollBy +}; + +} // namespace + +const PPB_Scrollbar_0_4_Dev* GetPPB_Scrollbar_Thunk() { + return &g_ppb_scrollbar_thunk; +} + +} // namespace thunk +} // namespace ppapi diff --git a/ppapi/thunk/resource_creation_api.h b/ppapi/thunk/resource_creation_api.h index ed86584..3c7c3df 100644 --- a/ppapi/thunk/resource_creation_api.h +++ b/ppapi/thunk/resource_creation_api.h @@ -79,6 +79,8 @@ class ResourceCreationAPI { PP_ImageDataFormat format, const PP_Size& size, PP_Bool init_to_zero) = 0; + virtual PP_Resource CreateScrollbar(PP_Instance instance, + PP_Bool vertical) = 0; virtual PP_Resource CreateSurface3D(PP_Instance instance, PP_Config3D_Dev config, const int32_t* attrib_list) = 0; diff --git a/ppapi/thunk/thunk.h b/ppapi/thunk/thunk.h index d9ad39e..645c5c6 100644 --- a/ppapi/thunk/thunk.h +++ b/ppapi/thunk/thunk.h @@ -34,6 +34,7 @@ struct PPB_ImageDataTrusted; struct PPB_Instance; struct PPB_Instance_Private; struct PPB_LayerCompositor_Dev; +struct PPB_Scrollbar_0_4_Dev; struct PPB_Surface3D_Dev; struct PPB_Transport_Dev; struct PPB_URLLoader; @@ -86,6 +87,7 @@ const PPB_Instance_0_4* GetPPB_Instance_0_4_Thunk(); const PPB_Instance_0_5* GetPPB_Instance_0_5_Thunk(); const PPB_Instance_Private* GetPPB_Instance_Private_Thunk(); const PPB_LayerCompositor_Dev* GetPPB_LayerCompositor_Thunk(); +const PPB_Scrollbar_0_4_Dev* GetPPB_Scrollbar_Thunk(); const PPB_Surface3D_Dev* GetPPB_Surface3D_Thunk(); const PPB_Transport_Dev* GetPPB_Transport_Thunk(); const PPB_URLLoader* GetPPB_URLLoader_Thunk(); |