OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "ppapi/cpp/dev/scrollbar_dev.h" | 7 #include "ppapi/cpp/dev/scrollbar_dev.h" |
8 | 8 |
| 9 #include "ppapi/cpp/dev/scrollbar_group_dev.h" |
9 #include "ppapi/cpp/instance.h" | 10 #include "ppapi/cpp/instance.h" |
10 #include "ppapi/cpp/module.h" | 11 #include "ppapi/cpp/module.h" |
11 #include "ppapi/cpp/module_impl.h" | 12 #include "ppapi/cpp/module_impl.h" |
12 #include "ppapi/cpp/rect.h" | 13 #include "ppapi/cpp/rect.h" |
13 | 14 |
14 namespace pp { | 15 namespace pp { |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 template <> const char* interface_name<PPB_Scrollbar_Dev>() { | 19 template <> const char* interface_name<PPB_Scrollbar_Dev>() { |
19 return PPB_SCROLLBAR_DEV_INTERFACE; | 20 return PPB_SCROLLBAR_DEV_INTERFACE; |
20 } | 21 } |
21 | 22 |
22 } // namespace | 23 } // namespace |
23 | 24 |
24 Scrollbar_Dev::Scrollbar_Dev(PP_Resource resource) : Widget_Dev(resource) { | 25 Scrollbar_Dev::Scrollbar_Dev(PP_Resource resource) : Widget_Dev(resource) { |
25 } | 26 } |
26 | 27 |
27 Scrollbar_Dev::Scrollbar_Dev(const Instance& instance, bool vertical) { | 28 Scrollbar_Dev::Scrollbar_Dev(const ScrollbarGroup_Dev& scrollbar_group, |
| 29 bool vertical) { |
28 if (!has_interface<PPB_Scrollbar_Dev>()) | 30 if (!has_interface<PPB_Scrollbar_Dev>()) |
29 return; | 31 return; |
30 PassRefFromConstructor(get_interface<PPB_Scrollbar_Dev>()->Create( | 32 PassRefFromConstructor(get_interface<PPB_Scrollbar_Dev>()->Create( |
31 instance.pp_instance(), PP_FromBool(vertical))); | 33 scrollbar_group.pp_resource(), PP_FromBool(vertical))); |
32 } | 34 } |
33 | 35 |
34 Scrollbar_Dev::Scrollbar_Dev(const Scrollbar_Dev& other) | 36 Scrollbar_Dev::Scrollbar_Dev(const Scrollbar_Dev& other) |
35 : Widget_Dev(other) { | 37 : Widget_Dev(other) { |
36 } | 38 } |
37 | 39 |
38 uint32_t Scrollbar_Dev::GetThickness() { | 40 uint32_t Scrollbar_Dev::GetThickness() { |
39 if (!has_interface<PPB_Scrollbar_Dev>()) | 41 if (!has_interface<PPB_Scrollbar_Dev>()) |
40 return 0; | 42 return 0; |
41 return get_interface<PPB_Scrollbar_Dev>()->GetThickness(pp_resource()); | 43 return get_interface<PPB_Scrollbar_Dev>()->GetThickness(pp_resource()); |
42 } | 44 } |
43 | 45 |
| 46 bool Scrollbar_Dev::IsOverlay() { |
| 47 if (!has_interface<PPB_Scrollbar_Dev>()) |
| 48 return false; |
| 49 return |
| 50 PP_ToBool(get_interface<PPB_Scrollbar_Dev>()->IsOverlay(pp_resource())); |
| 51 } |
| 52 |
44 uint32_t Scrollbar_Dev::GetValue() { | 53 uint32_t Scrollbar_Dev::GetValue() { |
45 if (!has_interface<PPB_Scrollbar_Dev>()) | 54 if (!has_interface<PPB_Scrollbar_Dev>()) |
46 return 0; | 55 return 0; |
47 return get_interface<PPB_Scrollbar_Dev>()->GetValue(pp_resource()); | 56 return get_interface<PPB_Scrollbar_Dev>()->GetValue(pp_resource()); |
48 } | 57 } |
49 | 58 |
50 void Scrollbar_Dev::SetValue(uint32_t value) { | 59 void Scrollbar_Dev::SetValue(uint32_t value) { |
51 if (has_interface<PPB_Scrollbar_Dev>()) | 60 if (has_interface<PPB_Scrollbar_Dev>()) |
52 get_interface<PPB_Scrollbar_Dev>()->SetValue(pp_resource(), value); | 61 get_interface<PPB_Scrollbar_Dev>()->SetValue(pp_resource(), value); |
53 } | 62 } |
(...skipping 17 matching lines...) Expand all Loading... |
71 } | 80 } |
72 | 81 |
73 void Scrollbar_Dev::ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier) { | 82 void Scrollbar_Dev::ScrollBy(PP_ScrollBy_Dev unit, int32_t multiplier) { |
74 if (has_interface<PPB_Scrollbar_Dev>()) | 83 if (has_interface<PPB_Scrollbar_Dev>()) |
75 get_interface<PPB_Scrollbar_Dev>()->ScrollBy(pp_resource(), | 84 get_interface<PPB_Scrollbar_Dev>()->ScrollBy(pp_resource(), |
76 unit, | 85 unit, |
77 multiplier); | 86 multiplier); |
78 } | 87 } |
79 | 88 |
80 } // namespace pp | 89 } // namespace pp |
OLD | NEW |