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

Side by Side Diff: webkit/plugins/ppapi/ppb_widget_impl.cc

Issue 20165002: Move webkit/plugins/ppapi to content/renderer/pepper. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: more more clang fun Created 7 years, 5 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
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "webkit/plugins/ppapi/ppb_widget_impl.h"
6
7 #include "ppapi/c/dev/ppp_widget_dev.h"
8 #include "ppapi/thunk/enter.h"
9 #include "ppapi/thunk/ppb_input_event_api.h"
10 #include "ppapi/thunk/ppb_widget_api.h"
11 #include "webkit/plugins/ppapi/ppapi_plugin_instance_impl.h"
12 #include "webkit/plugins/ppapi/ppb_image_data_impl.h"
13 #include "webkit/plugins/ppapi/plugin_module.h"
14 #include "webkit/plugins/ppapi/resource_helper.h"
15
16 using ppapi::thunk::EnterResourceNoLock;
17 using ppapi::thunk::PPB_ImageData_API;
18 using ppapi::thunk::PPB_InputEvent_API;
19 using ppapi::thunk::PPB_Widget_API;
20
21 namespace webkit {
22 namespace ppapi {
23
24 PPB_Widget_Impl::PPB_Widget_Impl(PP_Instance instance)
25 : Resource(::ppapi::OBJECT_IS_IMPL, instance),
26 scale_(1.0f) {
27 memset(&location_, 0, sizeof(location_));
28 }
29
30 PPB_Widget_Impl::~PPB_Widget_Impl() {
31 }
32
33 PPB_Widget_API* PPB_Widget_Impl::AsPPB_Widget_API() {
34 return this;
35 }
36
37 PP_Bool PPB_Widget_Impl::Paint(const PP_Rect* rect, PP_Resource image_id) {
38 EnterResourceNoLock<PPB_ImageData_API> enter(image_id, true);
39 if (enter.failed())
40 return PP_FALSE;
41 return PaintInternal(gfx::Rect(rect->point.x, rect->point.y,
42 rect->size.width, rect->size.height),
43 static_cast<PPB_ImageData_Impl*>(enter.object()));
44 }
45
46 PP_Bool PPB_Widget_Impl::HandleEvent(PP_Resource pp_input_event) {
47 EnterResourceNoLock<PPB_InputEvent_API> enter(pp_input_event, true);
48 if (enter.failed())
49 return PP_FALSE;
50 return HandleEventInternal(enter.object()->GetInputEventData());
51 }
52
53 PP_Bool PPB_Widget_Impl::GetLocation(PP_Rect* location) {
54 *location = location_;
55 return PP_TRUE;
56 }
57
58 void PPB_Widget_Impl::SetLocation(const PP_Rect* location) {
59 location_ = *location;
60 SetLocationInternal(location);
61 }
62
63 void PPB_Widget_Impl::SetScale(float scale) {
64 scale_ = scale;
65 }
66
67 void PPB_Widget_Impl::Invalidate(const PP_Rect* dirty) {
68 PluginInstanceImpl* plugin_instance = ResourceHelper::GetPluginInstance(this);
69 if (!plugin_instance)
70 return;
71 const PPP_Widget_Dev* widget = static_cast<const PPP_Widget_Dev*>(
72 plugin_instance->module()->GetPluginInterface(PPP_WIDGET_DEV_INTERFACE));
73 if (!widget)
74 return;
75 widget->Invalidate(pp_instance(), pp_resource(), dirty);
76 }
77
78 } // namespace ppapi
79 } // namespace webkit
80
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_widget_impl.h ('k') | webkit/plugins/ppapi/ppb_x509_certificate_private_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698