| 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 "ppapi/cpp/dev/widget_dev.h" | 5 #include "ppapi/cpp/dev/widget_dev.h" |
| 6 | 6 |
| 7 #include "ppapi/c/dev/ppb_widget_dev.h" | 7 #include "ppapi/c/dev/ppb_widget_dev.h" |
| 8 #include "ppapi/cpp/common.h" | 8 #include "ppapi/cpp/common.h" |
| 9 #include "ppapi/cpp/image_data.h" | 9 #include "ppapi/cpp/image_data.h" |
| 10 #include "ppapi/cpp/instance.h" | 10 #include "ppapi/cpp/instance.h" |
| 11 #include "ppapi/cpp/module.h" | 11 #include "ppapi/cpp/module.h" |
| 12 #include "ppapi/cpp/rect.h" | 12 #include "ppapi/cpp/rect.h" |
| 13 #include "ppapi/cpp/module_impl.h" | 13 #include "ppapi/cpp/module_impl.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 DeviceFuncs<PPB_Widget_Dev> widget_f(PPB_WIDGET_DEV_INTERFACE); | 17 DeviceFuncs<PPB_Widget_Dev> widget_f(PPB_WIDGET_DEV_INTERFACE); |
| 18 | 18 |
| 19 } // namespace | 19 } // namespace |
| 20 | 20 |
| 21 namespace pp { | 21 namespace pp { |
| 22 | 22 |
| 23 Widget_Dev::Widget_Dev(PP_Resource resource) : Resource(resource) { | 23 Widget_Dev::Widget_Dev(PP_Resource resource) : Resource(resource) { |
| 24 } | 24 } |
| 25 | 25 |
| 26 Widget_Dev::Widget_Dev(const Widget_Dev& other) : Resource(other) { | 26 Widget_Dev::Widget_Dev(const Widget_Dev& other) : Resource(other) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 Widget_Dev& Widget_Dev::operator=(const Widget_Dev& other) { | 29 Widget_Dev& Widget_Dev::operator=(const Widget_Dev& other) { |
| 30 Widget_Dev copy(other); | 30 Resource::operator=(other); |
| 31 swap(copy); | |
| 32 return *this; | 31 return *this; |
| 33 } | 32 } |
| 34 | 33 |
| 35 void Widget_Dev::swap(Widget_Dev& other) { | |
| 36 Resource::swap(other); | |
| 37 } | |
| 38 | |
| 39 bool Widget_Dev::Paint(const Rect& rect, ImageData* image) { | 34 bool Widget_Dev::Paint(const Rect& rect, ImageData* image) { |
| 40 if (!widget_f) | 35 if (!widget_f) |
| 41 return false; | 36 return false; |
| 42 return PPBoolToBool(widget_f->Paint(pp_resource(), | 37 return PPBoolToBool(widget_f->Paint(pp_resource(), |
| 43 &rect.pp_rect(), | 38 &rect.pp_rect(), |
| 44 image->pp_resource())); | 39 image->pp_resource())); |
| 45 } | 40 } |
| 46 | 41 |
| 47 bool Widget_Dev::HandleEvent(const PP_InputEvent& event) { | 42 bool Widget_Dev::HandleEvent(const PP_InputEvent& event) { |
| 48 if (!widget_f) | 43 if (!widget_f) |
| 49 return false; | 44 return false; |
| 50 return PPBoolToBool(widget_f->HandleEvent(pp_resource(), &event)); | 45 return PPBoolToBool(widget_f->HandleEvent(pp_resource(), &event)); |
| 51 } | 46 } |
| 52 | 47 |
| 53 bool Widget_Dev::GetLocation(Rect* location) { | 48 bool Widget_Dev::GetLocation(Rect* location) { |
| 54 if (!widget_f) | 49 if (!widget_f) |
| 55 return false; | 50 return false; |
| 56 return PPBoolToBool(widget_f->GetLocation(pp_resource(), | 51 return PPBoolToBool(widget_f->GetLocation(pp_resource(), |
| 57 &location->pp_rect())); | 52 &location->pp_rect())); |
| 58 } | 53 } |
| 59 | 54 |
| 60 void Widget_Dev::SetLocation(const Rect& location) { | 55 void Widget_Dev::SetLocation(const Rect& location) { |
| 61 if (widget_f) | 56 if (widget_f) |
| 62 widget_f->SetLocation(pp_resource(), &location.pp_rect()); | 57 widget_f->SetLocation(pp_resource(), &location.pp_rect()); |
| 63 } | 58 } |
| 64 | 59 |
| 65 } // namespace pp | 60 } // namespace pp |
| OLD | NEW |