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

Side by Side Diff: ppapi/thunk/ppb_scrollbar_thunk.cc

Issue 7538006: Pepper and WebKit API change to support a plugin knowing if a scrollbar is an overlay one. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Keep the logic to call WebScrollbarGroupImpl's methods in WebKit entirely Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/thunk/thunk.h" 5 #include "ppapi/thunk/thunk.h"
6 #include "ppapi/thunk/enter.h" 6 #include "ppapi/thunk/enter.h"
7 #include "ppapi/thunk/ppb_scrollbar_api.h" 7 #include "ppapi/thunk/ppb_scrollbar_api.h"
8 #include "ppapi/thunk/resource_creation_api.h" 8 #include "ppapi/thunk/resource_creation_api.h"
9 9
10 namespace ppapi { 10 namespace ppapi {
11 namespace thunk { 11 namespace thunk {
12 12
13 typedef EnterResource<PPB_Scrollbar_API> EnterScrollbar; 13 typedef EnterResource<PPB_Scrollbar_API> EnterScrollbar;
14 14
15 namespace { 15 namespace {
16 16
17 PP_Resource Create(PP_Instance instance, PP_Bool vertical) { 17 PP_Resource Create(PP_Resource scrollbar_group, PP_Bool vertical) {
18 EnterFunction<ResourceCreationAPI> enter(instance, true); 18 EnterFunctionGivenResource<ResourceCreationAPI> enter(scrollbar_group, true);
19 if (enter.failed()) 19 if (enter.failed())
20 return 0; 20 return 0;
21 return enter.functions()->CreateScrollbar(instance, vertical); 21
22 return enter.functions()->CreateScrollbar(scrollbar_group, vertical);
22 } 23 }
23 24
24 PP_Bool IsScrollbar(PP_Resource resource) { 25 PP_Bool IsScrollbar(PP_Resource resource) {
25 EnterScrollbar enter(resource, false); 26 EnterScrollbar enter(resource, false);
26 return PP_FromBool(enter.succeeded()); 27 return PP_FromBool(enter.succeeded());
27 } 28 }
28 29
29 uint32_t GetThickness(PP_Resource scrollbar) { 30 uint32_t GetThickness(PP_Resource scrollbar) {
30 EnterScrollbar enter(scrollbar, true); 31 EnterScrollbar enter(scrollbar, true);
31 if (enter.failed()) 32 if (enter.failed())
32 return 0; 33 return 0;
33 return enter.object()->GetThickness(); 34 return enter.object()->GetThickness();
34 } 35 }
35 36
37 PP_Bool IsOverlay(PP_Resource scrollbar) {
38 EnterScrollbar enter(scrollbar, true);
39 if (enter.failed())
40 return PP_FALSE;
41 return PP_FromBool(enter.object()->IsOverlay());
42 }
43
36 uint32_t GetValue(PP_Resource scrollbar) { 44 uint32_t GetValue(PP_Resource scrollbar) {
37 EnterScrollbar enter(scrollbar, true); 45 EnterScrollbar enter(scrollbar, true);
38 if (enter.failed()) 46 if (enter.failed())
39 return 0; 47 return 0;
40 return enter.object()->GetValue(); 48 return enter.object()->GetValue();
41 } 49 }
42 50
43 void SetValue(PP_Resource scrollbar, uint32_t value) { 51 void SetValue(PP_Resource scrollbar, uint32_t value) {
44 EnterScrollbar enter(scrollbar, true); 52 EnterScrollbar enter(scrollbar, true);
45 if (enter.succeeded()) 53 if (enter.succeeded())
(...skipping 13 matching lines...) Expand all
59 if (enter.succeeded()) 67 if (enter.succeeded())
60 enter.object()->SetTickMarks(tick_marks, count); 68 enter.object()->SetTickMarks(tick_marks, count);
61 } 69 }
62 70
63 void ScrollBy(PP_Resource scrollbar, PP_ScrollBy_Dev unit, int32_t multiplier) { 71 void ScrollBy(PP_Resource scrollbar, PP_ScrollBy_Dev unit, int32_t multiplier) {
64 EnterScrollbar enter(scrollbar, true); 72 EnterScrollbar enter(scrollbar, true);
65 if (enter.succeeded()) 73 if (enter.succeeded())
66 enter.object()->ScrollBy(unit, multiplier); 74 enter.object()->ScrollBy(unit, multiplier);
67 } 75 }
68 76
69 const PPB_Scrollbar_0_4_Dev g_ppb_scrollbar_thunk = { 77 const PPB_Scrollbar_Dev g_ppb_scrollbar_thunk = {
70 &Create, 78 &Create,
71 &IsScrollbar, 79 &IsScrollbar,
72 &GetThickness, 80 &GetThickness,
81 &IsOverlay,
73 &GetValue, 82 &GetValue,
74 &SetValue, 83 &SetValue,
75 &SetDocumentSize, 84 &SetDocumentSize,
76 &SetTickMarks, 85 &SetTickMarks,
77 &ScrollBy 86 &ScrollBy
78 }; 87 };
79 88
80 } // namespace 89 } // namespace
81 90
82 const PPB_Scrollbar_0_4_Dev* GetPPB_Scrollbar_Thunk() { 91 const PPB_Scrollbar_Dev* GetPPB_Scrollbar_Thunk() {
83 return &g_ppb_scrollbar_thunk; 92 return &g_ppb_scrollbar_thunk;
84 } 93 }
85 94
86 } // namespace thunk 95 } // namespace thunk
87 } // namespace ppapi 96 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698