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

Side by Side Diff: webkit/glue/plugins/pepper_widget.cc

Issue 4310002: Make PPAPI headers compile with C compilers (gcc on Linux & Mac and MSVS on W... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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
« no previous file with comments | « webkit/glue/plugins/pepper_video_decoder.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_widget.h" 5 #include "webkit/glue/plugins/pepper_widget.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ppapi/c/dev/ppb_widget_dev.h" 8 #include "ppapi/c/dev/ppb_widget_dev.h"
9 #include "ppapi/c/dev/ppp_widget_dev.h" 9 #include "ppapi/c/dev/ppp_widget_dev.h"
10 #include "ppapi/c/pp_completion_callback.h" 10 #include "ppapi/c/pp_completion_callback.h"
11 #include "ppapi/c/pp_errors.h" 11 #include "ppapi/c/pp_errors.h"
12 #include "webkit/glue/plugins/pepper_common.h"
12 #include "webkit/glue/plugins/pepper_image_data.h" 13 #include "webkit/glue/plugins/pepper_image_data.h"
13 #include "webkit/glue/plugins/pepper_plugin_instance.h" 14 #include "webkit/glue/plugins/pepper_plugin_instance.h"
14 #include "webkit/glue/plugins/pepper_plugin_module.h" 15 #include "webkit/glue/plugins/pepper_plugin_module.h"
15 16
16 namespace pepper { 17 namespace pepper {
17 18
18 namespace { 19 namespace {
19 20
20 bool IsWidget(PP_Resource resource) { 21 PP_Bool IsWidget(PP_Resource resource) {
21 return !!Resource::GetAs<Widget>(resource); 22 return BoolToPPBool(!!Resource::GetAs<Widget>(resource));
22 } 23 }
23 24
24 bool Paint(PP_Resource resource, const PP_Rect* rect, PP_Resource image_id) { 25 PP_Bool Paint(PP_Resource resource, const PP_Rect* rect, PP_Resource image_id) {
25 scoped_refptr<Widget> widget(Resource::GetAs<Widget>(resource)); 26 scoped_refptr<Widget> widget(Resource::GetAs<Widget>(resource));
26 if (!widget) 27 if (!widget)
27 return false; 28 return PP_FALSE;
28 29
29 scoped_refptr<ImageData> image(Resource::GetAs<ImageData>(image_id)); 30 scoped_refptr<ImageData> image(Resource::GetAs<ImageData>(image_id));
30 if (!image) 31 if (!image)
31 return false; 32 return PP_FALSE;
32 33
33 return widget->Paint(rect, image); 34 return BoolToPPBool(widget->Paint(rect, image));
34 } 35 }
35 36
36 bool HandleEvent(PP_Resource resource, const PP_InputEvent* event) { 37 PP_Bool HandleEvent(PP_Resource resource, const PP_InputEvent* event) {
37 scoped_refptr<Widget> widget(Resource::GetAs<Widget>(resource)); 38 scoped_refptr<Widget> widget(Resource::GetAs<Widget>(resource));
38 return widget && widget->HandleEvent(event); 39 return BoolToPPBool(widget && widget->HandleEvent(event));
39 } 40 }
40 41
41 bool GetLocation(PP_Resource resource, PP_Rect* location) { 42 PP_Bool GetLocation(PP_Resource resource, PP_Rect* location) {
42 scoped_refptr<Widget> widget(Resource::GetAs<Widget>(resource)); 43 scoped_refptr<Widget> widget(Resource::GetAs<Widget>(resource));
43 return widget && widget->GetLocation(location); 44 return BoolToPPBool(widget && widget->GetLocation(location));
44 } 45 }
45 46
46 void SetLocation(PP_Resource resource, const PP_Rect* location) { 47 void SetLocation(PP_Resource resource, const PP_Rect* location) {
47 scoped_refptr<Widget> widget(Resource::GetAs<Widget>(resource)); 48 scoped_refptr<Widget> widget(Resource::GetAs<Widget>(resource));
48 if (widget) 49 if (widget)
49 widget->SetLocation(location); 50 widget->SetLocation(location);
50 } 51 }
51 52
52 const PPB_Widget_Dev ppb_widget = { 53 const PPB_Widget_Dev ppb_widget = {
53 &IsWidget, 54 &IsWidget,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 void Widget::Invalidate(const PP_Rect* dirty) { 86 void Widget::Invalidate(const PP_Rect* dirty) {
86 const PPP_Widget_Dev* widget = static_cast<const PPP_Widget_Dev*>( 87 const PPP_Widget_Dev* widget = static_cast<const PPP_Widget_Dev*>(
87 module()->GetPluginInterface(PPP_WIDGET_DEV_INTERFACE)); 88 module()->GetPluginInterface(PPP_WIDGET_DEV_INTERFACE));
88 if (!widget) 89 if (!widget)
89 return; 90 return;
90 ScopedResourceId resource(this); 91 ScopedResourceId resource(this);
91 widget->Invalidate(instance_->pp_instance(), resource.id, dirty); 92 widget->Invalidate(instance_->pp_instance(), resource.id, dirty);
92 } 93 }
93 94
94 } // namespace pepper 95 } // namespace pepper
OLDNEW
« no previous file with comments | « webkit/glue/plugins/pepper_video_decoder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698