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 "webkit/glue/plugins/pepper_scrollbar.h" | 5 #include "webkit/glue/plugins/pepper_scrollbar.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "ppapi/c/dev/ppp_scrollbar_dev.h" | 9 #include "ppapi/c/dev/ppp_scrollbar_dev.h" |
10 #include "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
11 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" | 11 #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" |
12 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" | 12 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" |
13 #include "third_party/WebKit/WebKit/chromium/public/WebScrollbar.h" | 13 #include "third_party/WebKit/WebKit/chromium/public/WebScrollbar.h" |
14 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" | 14 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" |
| 15 #include "webkit/glue/plugins/pepper_common.h" |
15 #include "webkit/glue/plugins/pepper_event_conversion.h" | 16 #include "webkit/glue/plugins/pepper_event_conversion.h" |
16 #include "webkit/glue/plugins/pepper_image_data.h" | 17 #include "webkit/glue/plugins/pepper_image_data.h" |
17 #include "webkit/glue/plugins/pepper_plugin_instance.h" | 18 #include "webkit/glue/plugins/pepper_plugin_instance.h" |
18 #include "webkit/glue/plugins/pepper_plugin_module.h" | 19 #include "webkit/glue/plugins/pepper_plugin_module.h" |
19 #include "webkit/glue/webkit_glue.h" | 20 #include "webkit/glue/webkit_glue.h" |
20 | 21 |
21 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
22 #include "base/win/windows_version.h" | 23 #include "base/win/windows_version.h" |
23 #endif | 24 #endif |
24 | 25 |
25 using WebKit::WebInputEvent; | 26 using WebKit::WebInputEvent; |
26 using WebKit::WebRect; | 27 using WebKit::WebRect; |
27 using WebKit::WebScrollbar; | 28 using WebKit::WebScrollbar; |
28 | 29 |
29 namespace pepper { | 30 namespace pepper { |
30 | 31 |
31 namespace { | 32 namespace { |
32 | 33 |
33 PP_Resource Create(PP_Instance instance_id, bool vertical) { | 34 PP_Resource Create(PP_Instance instance_id, PP_Bool vertical) { |
34 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); | 35 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); |
35 if (!instance) | 36 if (!instance) |
36 return 0; | 37 return 0; |
37 | 38 |
38 scoped_refptr<Scrollbar> scrollbar(new Scrollbar(instance, vertical)); | 39 scoped_refptr<Scrollbar> scrollbar(new Scrollbar(instance, |
| 40 PPBoolToBool(vertical))); |
39 return scrollbar->GetReference(); | 41 return scrollbar->GetReference(); |
40 } | 42 } |
41 | 43 |
42 bool IsScrollbar(PP_Resource resource) { | 44 PP_Bool IsScrollbar(PP_Resource resource) { |
43 return !!Resource::GetAs<Scrollbar>(resource); | 45 return BoolToPPBool(!!Resource::GetAs<Scrollbar>(resource)); |
44 } | 46 } |
45 | 47 |
46 uint32_t GetThickness() { | 48 uint32_t GetThickness() { |
47 return WebScrollbar::defaultThickness(); | 49 return WebScrollbar::defaultThickness(); |
48 } | 50 } |
49 | 51 |
50 uint32_t GetValue(PP_Resource resource) { | 52 uint32_t GetValue(PP_Resource resource) { |
51 scoped_refptr<Scrollbar> scrollbar(Resource::GetAs<Scrollbar>(resource)); | 53 scoped_refptr<Scrollbar> scrollbar(Resource::GetAs<Scrollbar>(resource)); |
52 if (!scrollbar) | 54 if (!scrollbar) |
53 return 0; | 55 return 0; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 PP_Rect pp_rect; | 233 PP_Rect pp_rect; |
232 pp_rect.point.x = dirty_.x(); | 234 pp_rect.point.x = dirty_.x(); |
233 pp_rect.point.y = dirty_.y(); | 235 pp_rect.point.y = dirty_.y(); |
234 pp_rect.size.width = dirty_.width(); | 236 pp_rect.size.width = dirty_.width(); |
235 pp_rect.size.height = dirty_.height(); | 237 pp_rect.size.height = dirty_.height(); |
236 dirty_ = gfx::Rect(); | 238 dirty_ = gfx::Rect(); |
237 Invalidate(&pp_rect); | 239 Invalidate(&pp_rect); |
238 } | 240 } |
239 | 241 |
240 } // namespace pepper | 242 } // namespace pepper |
OLD | NEW |