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

Side by Side Diff: ppapi/cpp/dev/widget_dev.cc

Issue 1161563002: Remove unused in-process pepper APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « ppapi/cpp/dev/widget_dev.h ('k') | ppapi/cpp/dev/zoom_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ppapi/cpp/dev/widget_dev.h"
6
7 #include "ppapi/c/dev/ppb_widget_dev.h"
8 #include "ppapi/cpp/image_data.h"
9 #include "ppapi/cpp/input_event.h"
10 #include "ppapi/cpp/instance.h"
11 #include "ppapi/cpp/module.h"
12 #include "ppapi/cpp/rect.h"
13 #include "ppapi/cpp/module_impl.h"
14
15 namespace pp {
16
17 namespace {
18
19 template <> const char* interface_name<PPB_Widget_Dev_0_3>() {
20 return PPB_WIDGET_DEV_INTERFACE_0_3;
21 }
22
23 template <> const char* interface_name<PPB_Widget_Dev_0_4>() {
24 return PPB_WIDGET_DEV_INTERFACE_0_4;
25 }
26
27 } // namespace
28
29 Widget_Dev::Widget_Dev(PP_Resource resource) : Resource(resource) {
30 }
31
32 Widget_Dev::Widget_Dev(const Widget_Dev& other) : Resource(other) {
33 }
34
35 bool Widget_Dev::Paint(const Rect& rect, ImageData* image) {
36 if (has_interface<PPB_Widget_Dev_0_4>()) {
37 return PP_ToBool(get_interface<PPB_Widget_Dev_0_4>()->Paint(
38 pp_resource(), &rect.pp_rect(), image->pp_resource()));
39 } else if (has_interface<PPB_Widget_Dev_0_3>()) {
40 return PP_ToBool(get_interface<PPB_Widget_Dev_0_3>()->Paint(
41 pp_resource(), &rect.pp_rect(), image->pp_resource()));
42 }
43 return false;
44 }
45
46 bool Widget_Dev::HandleEvent(const InputEvent& event) {
47 if (has_interface<PPB_Widget_Dev_0_4>()) {
48 return PP_ToBool(get_interface<PPB_Widget_Dev_0_4>()->HandleEvent(
49 pp_resource(), event.pp_resource()));
50 } else if (has_interface<PPB_Widget_Dev_0_3>()) {
51 return PP_ToBool(get_interface<PPB_Widget_Dev_0_3>()->HandleEvent(
52 pp_resource(), event.pp_resource()));
53 }
54 return false;
55 }
56
57 bool Widget_Dev::GetLocation(Rect* location) {
58 if (has_interface<PPB_Widget_Dev_0_4>()) {
59 return PP_ToBool(get_interface<PPB_Widget_Dev_0_4>()->GetLocation(
60 pp_resource(), &location->pp_rect()));
61 } else if (has_interface<PPB_Widget_Dev_0_3>()) {
62 return PP_ToBool(get_interface<PPB_Widget_Dev_0_3>()->GetLocation(
63 pp_resource(), &location->pp_rect()));
64 }
65 return false;
66 }
67
68 void Widget_Dev::SetLocation(const Rect& location) {
69 if (has_interface<PPB_Widget_Dev_0_4>()) {
70 get_interface<PPB_Widget_Dev_0_4>()->SetLocation(pp_resource(),
71 &location.pp_rect());
72 } else if (has_interface<PPB_Widget_Dev_0_3>()) {
73 get_interface<PPB_Widget_Dev_0_3>()->SetLocation(pp_resource(),
74 &location.pp_rect());
75 }
76 }
77
78 void Widget_Dev::SetScale(float scale) {
79 if (has_interface<PPB_Widget_Dev_0_4>())
80 get_interface<PPB_Widget_Dev_0_4>()->SetScale(pp_resource(), scale);
81 }
82
83 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/widget_dev.h ('k') | ppapi/cpp/dev/zoom_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698