2
* Copyright (C) 2011 Research In Motion Limited. All rights reserved.
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
#include "NPCallbacksBlackBerry.h"
22
#include "PluginViewPrivateBlackBerry.h"
24
#if USE(ACCELERATED_COMPOSITING)
25
#include "PluginLayerWebKitThread.h"
30
PthreadMutexLocker::PthreadMutexLocker(pthread_mutex_t* mutex)
33
pthread_mutex_lock(m_mutex);
36
PthreadMutexLocker::~PthreadMutexLocker()
38
pthread_mutex_unlock(m_mutex);
41
PthreadReadLocker::PthreadReadLocker(pthread_rwlock_t* rwlock)
44
pthread_rwlock_rdlock(m_rwlock);
47
PthreadReadLocker::~PthreadReadLocker()
49
pthread_rwlock_unlock(m_rwlock);
52
PthreadWriteLocker::PthreadWriteLocker(pthread_rwlock_t* rwlock)
55
pthread_rwlock_wrlock(m_rwlock);
58
PthreadWriteLocker::~PthreadWriteLocker()
60
pthread_rwlock_unlock(m_rwlock);
63
#if USE(ACCELERATED_COMPOSITING)
64
void npSetHolePunchHandler(void* holePunchData)
66
OwnPtr<HolePunchData> data = adoptPtr(static_cast<HolePunchData*>(holePunchData));
68
data->layer->setHolePunchRect(IntRect(data->x, data->y, data->w, data->h));
72
// NPAPI callback functions
74
void setVisibleRects(NPP instance, const NPRect rects[], int32_t count)
76
PluginView* view = static_cast<PluginView*>(instance->ndata);
77
PluginViewPrivate* viewPrivate = view->getPrivate();
78
viewPrivate->setVisibleRects(rects, count);
81
void clearVisibleRects(NPP instance)
83
PluginView* view = static_cast<PluginView*>(instance->ndata);
84
PluginViewPrivate* viewPrivate = view->getPrivate();
85
viewPrivate->clearVisibleRects();
88
void showKeyboard(NPP instance, bool value)
90
PluginView* view = static_cast<PluginView*>(instance->ndata);
91
PluginViewPrivate* viewPrivate = view->getPrivate();
92
viewPrivate->showKeyboard(value);
95
void requestFullScreen(NPP instance)
97
PluginView* view = static_cast<PluginView*>(instance->ndata);
98
PluginViewPrivate* viewPrivate = view->getPrivate();
99
viewPrivate->requestFullScreen();
102
void exitFullScreen(NPP instance)
104
PluginView* view = static_cast<PluginView*>(instance->ndata);
105
PluginViewPrivate* viewPrivate = view->getPrivate();
106
viewPrivate->exitFullScreen();
109
void requestCenterFitZoom(NPP instance)
111
PluginView* view = static_cast<PluginView*>(instance->ndata);
112
PluginViewPrivate* viewPrivate = view->getPrivate();
113
viewPrivate->requestCenterFitZoom();
116
void lockOrientation(NPP instance, bool landscape)
118
PluginView* view = static_cast<PluginView*>(instance->ndata);
119
PluginViewPrivate* viewPrivate = view->getPrivate();
120
viewPrivate->lockOrientation(landscape);
123
void unlockOrientation(NPP instance)
125
PluginView* view = static_cast<PluginView*>(instance->ndata);
126
PluginViewPrivate* viewPrivate = view->getPrivate();
127
viewPrivate->unlockOrientation();
130
void preventIdle(NPP instance, bool preventIdle)
132
PluginView* view = static_cast<PluginView*>(instance->ndata);
133
PluginViewPrivate* viewPrivate = view->getPrivate();
134
viewPrivate->preventIdle(preventIdle);
137
NPSurface lockBackBuffer(NPP instance)
139
PluginView* view = static_cast<PluginView*>(instance->ndata);
140
PluginViewPrivate* viewPrivate = view->getPrivate();
141
return viewPrivate->lockBackBuffer();
144
void unlockBackBuffer(NPP instance)
146
PluginView* view = static_cast<PluginView*>(instance->ndata);
147
PluginViewPrivate* viewPrivate = view->getPrivate();
148
viewPrivate->unlockBackBuffer();
151
NPSurface lockReadFrontBuffer(NPP instance)
153
PluginView* view = static_cast<PluginView*>(instance->ndata);
154
PluginViewPrivate* viewPrivate = view->getPrivate();
155
return viewPrivate->lockReadFrontBuffer();
158
void unlockReadFrontBuffer(NPP instance)
160
PluginView* view = static_cast<PluginView*>(instance->ndata);
161
PluginViewPrivate* viewPrivate = view->getPrivate();
162
viewPrivate->unlockReadFrontBuffer();
165
void swapBuffers(NPP instance)
167
PluginView* view = static_cast<PluginView*>(instance->ndata);
168
PluginViewPrivate* viewPrivate = view->getPrivate();
169
viewPrivate->swapBuffers();
172
bool createBuffers(NPP instance, NPSurfaceFormat format, int width, int height)
174
PluginView* view = static_cast<PluginView*>(instance->ndata);
175
PluginViewPrivate* viewPrivate = view->getPrivate();
176
return viewPrivate->createBuffers(format, width, height);
179
bool destroyBuffers(NPP instance)
181
PluginView* view = static_cast<PluginView*>(instance->ndata);
182
PluginViewPrivate* viewPrivate = view->getPrivate();
183
return viewPrivate->destroyBuffers();
186
bool resizeBuffers(NPP instance, NPSurfaceFormat format, int width, int height)
188
PluginView* view = static_cast<PluginView*>(instance->ndata);
189
PluginViewPrivate* viewPrivate = view->getPrivate();
190
return viewPrivate->resizeBuffers(format, width, height);
193
void setHolePunch(NPP instance, int x, int y, int width, int height)
195
PluginView* view = static_cast<PluginView*>(instance->ndata);
196
PluginViewPrivate* viewPrivate = view->getPrivate();
197
viewPrivate->setHolePunch(x, y, width, height);
200
NPCallbacks s_NpCallbacks = {
206
requestCenterFitZoom,
213
unlockReadFrontBuffer,
221
} // Namespace WebCore