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

Side by Side Diff: ppapi/cpp/dev/widget_client_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, 7 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_client_dev.h ('k') | ppapi/cpp/dev/widget_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_client_dev.h"
6
7 #include "ppapi/c/dev/ppp_scrollbar_dev.h"
8 #include "ppapi/c/dev/ppp_widget_dev.h"
9 #include "ppapi/cpp/dev/scrollbar_dev.h"
10 #include "ppapi/cpp/dev/widget_dev.h"
11 #include "ppapi/cpp/instance.h"
12 #include "ppapi/cpp/instance_handle.h"
13 #include "ppapi/cpp/module.h"
14 #include "ppapi/cpp/module_impl.h"
15 #include "ppapi/cpp/rect.h"
16
17 namespace pp {
18
19 namespace {
20
21 // PPP_Widget_Dev --------------------------------------------------------------
22
23 const char kPPPWidgetInterface[] = PPP_WIDGET_DEV_INTERFACE;
24
25 void Widget_Invalidate(PP_Instance instance,
26 PP_Resource widget_id,
27 const PP_Rect* dirty_rect) {
28 void* object = Instance::GetPerInstanceObject(instance, kPPPWidgetInterface);
29 if (!object)
30 return;
31 return static_cast<WidgetClient_Dev*>(object)->InvalidateWidget(
32 Widget_Dev(widget_id), *dirty_rect);
33 }
34
35 static PPP_Widget_Dev widget_interface = {
36 &Widget_Invalidate,
37 };
38
39 // PPP_Scrollbar_Dev -----------------------------------------------------------
40
41 const char kPPPScrollbarInterface[] = PPP_SCROLLBAR_DEV_INTERFACE;
42
43 void Scrollbar_ValueChanged(PP_Instance instance,
44 PP_Resource scrollbar_id,
45 uint32_t value) {
46 void* object =
47 Instance::GetPerInstanceObject(instance, kPPPScrollbarInterface);
48 if (!object)
49 return;
50 return static_cast<WidgetClient_Dev*>(object)->ScrollbarValueChanged(
51 Scrollbar_Dev(scrollbar_id), value);
52 }
53
54 void Scrollbar_OverlayChanged(PP_Instance instance,
55 PP_Resource scrollbar_id,
56 PP_Bool overlay) {
57 void* object =
58 Instance::GetPerInstanceObject(instance, kPPPScrollbarInterface);
59 if (!object)
60 return;
61 return static_cast<WidgetClient_Dev*>(object)->ScrollbarOverlayChanged(
62 Scrollbar_Dev(scrollbar_id), PP_ToBool(overlay));
63 }
64
65 static PPP_Scrollbar_Dev scrollbar_interface = {
66 &Scrollbar_ValueChanged,
67 &Scrollbar_OverlayChanged,
68 };
69
70 } // namespace
71
72 WidgetClient_Dev::WidgetClient_Dev(Instance* instance)
73 : associated_instance_(instance) {
74 Module::Get()->AddPluginInterface(kPPPWidgetInterface, &widget_interface);
75 instance->AddPerInstanceObject(kPPPWidgetInterface, this);
76 Module::Get()->AddPluginInterface(kPPPScrollbarInterface,
77 &scrollbar_interface);
78 instance->AddPerInstanceObject(kPPPScrollbarInterface, this);
79 }
80
81 WidgetClient_Dev::~WidgetClient_Dev() {
82 Instance::RemovePerInstanceObject(associated_instance_,
83 kPPPScrollbarInterface, this);
84 Instance::RemovePerInstanceObject(associated_instance_,
85 kPPPWidgetInterface, this);
86 }
87
88 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/widget_client_dev.h ('k') | ppapi/cpp/dev/widget_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698