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

Side by Side Diff: ppapi/proxy/ppb_flash_proxy.cc

Issue 9369003: Pepper: Add a function to PPB_Flash to check if a rect is topmost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add stubs for InvokePrinting() and UpdateActivity() Created 8 years, 10 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
« no previous file with comments | « ppapi/proxy/ppb_flash_proxy.h ('k') | webkit/plugins/ppapi/plugin_module.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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/proxy/ppb_flash_proxy.h" 5 #include "ppapi/proxy/ppb_flash_proxy.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "ppapi/c/dev/ppb_font_dev.h" 10 #include "ppapi/c/dev/ppb_font_dev.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 ProxyAutoLock lock; 191 ProxyAutoLock lock;
192 std::string args = ProxyModule::GetInstance()->GetFlashCommandLineArgs(); 192 std::string args = ProxyModule::GetInstance()->GetFlashCommandLineArgs();
193 return StringVar::StringToPPVar(args); 193 return StringVar::StringToPPVar(args);
194 } 194 }
195 195
196 void PreLoadFontWin(const void* logfontw) { 196 void PreLoadFontWin(const void* logfontw) {
197 ProxyAutoLock lock; 197 ProxyAutoLock lock;
198 PluginGlobals::Get()->plugin_proxy_delegate()->PreCacheFont(logfontw); 198 PluginGlobals::Get()->plugin_proxy_delegate()->PreCacheFont(logfontw);
199 } 199 }
200 200
201 PP_Bool IsRectTopmost(PP_Instance instance, const PP_Rect* rect) {
202 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
203 if (!dispatcher)
204 return PP_FALSE;
205 PP_Bool result = PP_FALSE;
206 dispatcher->Send(new PpapiHostMsg_PPBFlash_IsRectTopmost(
207 API_ID_PPB_FLASH, instance, *rect, &result));
208 return result;
209 }
210
211 int32_t InvokePrinting(PP_Instance instance) {
212 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
213 if (!dispatcher)
214 return PP_ERROR_BADARGUMENT;
215
216 // TODO(viettrungluu): Implement me.
217
218 return PP_ERROR_NOTSUPPORTED;
219 }
220
221 void UpdateActivity(PP_Instance instance) {
222 // TODO(viettrungluu): Implement me.
223 }
224
201 const PPB_Flash_11 flash_interface_11 = { 225 const PPB_Flash_11 flash_interface_11 = {
202 &SetInstanceAlwaysOnTop, 226 &SetInstanceAlwaysOnTop,
203 &DrawGlyphs11, 227 &DrawGlyphs11,
204 &GetProxyForURL, 228 &GetProxyForURL,
205 &Navigate11, 229 &Navigate11,
206 &RunMessageLoop, 230 &RunMessageLoop,
207 &QuitMessageLoop, 231 &QuitMessageLoop,
208 &GetLocalTimeZoneOffset, 232 &GetLocalTimeZoneOffset,
209 &GetCommandLineArgs 233 &GetCommandLineArgs
210 }; 234 };
211 235
212 const PPB_Flash flash_interface_12 = { 236 const PPB_Flash_12_0 flash_interface_12_0 = {
213 &SetInstanceAlwaysOnTop, 237 &SetInstanceAlwaysOnTop,
214 &DrawGlyphs, 238 &DrawGlyphs,
215 &GetProxyForURL, 239 &GetProxyForURL,
216 &Navigate, 240 &Navigate,
217 &RunMessageLoop, 241 &RunMessageLoop,
218 &QuitMessageLoop, 242 &QuitMessageLoop,
219 &GetLocalTimeZoneOffset, 243 &GetLocalTimeZoneOffset,
220 &GetCommandLineArgs, 244 &GetCommandLineArgs,
221 &PreLoadFontWin 245 &PreLoadFontWin
222 }; 246 };
223 247
248 const PPB_Flash_12_1 flash_interface_12_1 = {
249 &SetInstanceAlwaysOnTop,
250 &DrawGlyphs,
251 &GetProxyForURL,
252 &Navigate,
253 &RunMessageLoop,
254 &QuitMessageLoop,
255 &GetLocalTimeZoneOffset,
256 &GetCommandLineArgs,
257 &PreLoadFontWin,
258 &IsRectTopmost,
259 &InvokePrinting,
260 &UpdateActivity
261 };
262
224 } // namespace 263 } // namespace
225 264
226 PPB_Flash_Proxy::PPB_Flash_Proxy(Dispatcher* dispatcher) 265 PPB_Flash_Proxy::PPB_Flash_Proxy(Dispatcher* dispatcher)
227 : InterfaceProxy(dispatcher), 266 : InterfaceProxy(dispatcher),
228 ppb_flash_impl_(NULL) { 267 ppb_flash_impl_(NULL) {
229 if (!dispatcher->IsPlugin()) 268 if (!dispatcher->IsPlugin())
230 ppb_flash_impl_ = static_cast<const PPB_Flash*>( 269 ppb_flash_impl_ = static_cast<const PPB_Flash*>(
231 dispatcher->local_get_interface()(PPB_FLASH_INTERFACE)); 270 dispatcher->local_get_interface()(PPB_FLASH_INTERFACE));
232 } 271 }
233 272
234 PPB_Flash_Proxy::~PPB_Flash_Proxy() { 273 PPB_Flash_Proxy::~PPB_Flash_Proxy() {
235 } 274 }
236 275
237 // static 276 // static
238 const PPB_Flash_11* PPB_Flash_Proxy::GetInterface11() { 277 const PPB_Flash_11* PPB_Flash_Proxy::GetInterface11() {
239 return &flash_interface_11; 278 return &flash_interface_11;
240 } 279 }
241 280
242 // static 281 // static
243 const PPB_Flash* PPB_Flash_Proxy::GetInterface12_0() { 282 const PPB_Flash_12_0* PPB_Flash_Proxy::GetInterface12_0() {
244 return &flash_interface_12; 283 return &flash_interface_12_0;
284 }
285
286 // static
287 const PPB_Flash_12_1* PPB_Flash_Proxy::GetInterface12_1() {
288 return &flash_interface_12_1;
245 } 289 }
246 290
247 bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) { 291 bool PPB_Flash_Proxy::OnMessageReceived(const IPC::Message& msg) {
248 // Prevent the dispatcher from going away during a call to Navigate. 292 // Prevent the dispatcher from going away during a call to Navigate.
249 // This must happen OUTSIDE of OnMsgNavigate since the handling code use 293 // This must happen OUTSIDE of OnMsgNavigate since the handling code use
250 // the dispatcher upon return of the function (sending the reply message). 294 // the dispatcher upon return of the function (sending the reply message).
251 ScopedModuleReference death_grip(dispatcher()); 295 ScopedModuleReference death_grip(dispatcher());
252 296
253 bool handled = true; 297 bool handled = true;
254 IPC_BEGIN_MESSAGE_MAP(PPB_Flash_Proxy, msg) 298 IPC_BEGIN_MESSAGE_MAP(PPB_Flash_Proxy, msg)
255 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop, 299 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop,
256 OnMsgSetInstanceAlwaysOnTop) 300 OnMsgSetInstanceAlwaysOnTop)
257 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_DrawGlyphs, 301 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_DrawGlyphs,
258 OnMsgDrawGlyphs) 302 OnMsgDrawGlyphs)
259 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetProxyForURL, 303 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetProxyForURL,
260 OnMsgGetProxyForURL) 304 OnMsgGetProxyForURL)
261 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_Navigate, OnMsgNavigate) 305 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_Navigate, OnMsgNavigate)
262 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_RunMessageLoop, 306 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_RunMessageLoop,
263 OnMsgRunMessageLoop) 307 OnMsgRunMessageLoop)
264 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QuitMessageLoop, 308 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_QuitMessageLoop,
265 OnMsgQuitMessageLoop) 309 OnMsgQuitMessageLoop)
266 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset, 310 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_GetLocalTimeZoneOffset,
267 OnMsgGetLocalTimeZoneOffset) 311 OnMsgGetLocalTimeZoneOffset)
312 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlash_IsRectTopmost,
313 OnMsgIsRectTopmost)
268 IPC_MESSAGE_UNHANDLED(handled = false) 314 IPC_MESSAGE_UNHANDLED(handled = false)
269 IPC_END_MESSAGE_MAP() 315 IPC_END_MESSAGE_MAP()
270 // TODO(brettw) handle bad messages! 316 // TODO(brettw) handle bad messages!
271 return handled; 317 return handled;
272 } 318 }
273 319
274 void PPB_Flash_Proxy::OnMsgSetInstanceAlwaysOnTop( 320 void PPB_Flash_Proxy::OnMsgSetInstanceAlwaysOnTop(
275 PP_Instance instance, 321 PP_Instance instance,
276 PP_Bool on_top) { 322 PP_Bool on_top) {
277 ppb_flash_impl_->SetInstanceAlwaysOnTop(instance, on_top); 323 ppb_flash_impl_->SetInstanceAlwaysOnTop(instance, on_top);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 void PPB_Flash_Proxy::OnMsgQuitMessageLoop(PP_Instance instance) { 397 void PPB_Flash_Proxy::OnMsgQuitMessageLoop(PP_Instance instance) {
352 ppb_flash_impl_->QuitMessageLoop(instance); 398 ppb_flash_impl_->QuitMessageLoop(instance);
353 } 399 }
354 400
355 void PPB_Flash_Proxy::OnMsgGetLocalTimeZoneOffset(PP_Instance instance, 401 void PPB_Flash_Proxy::OnMsgGetLocalTimeZoneOffset(PP_Instance instance,
356 PP_Time t, 402 PP_Time t,
357 double* result) { 403 double* result) {
358 *result = ppb_flash_impl_->GetLocalTimeZoneOffset(instance, t); 404 *result = ppb_flash_impl_->GetLocalTimeZoneOffset(instance, t);
359 } 405 }
360 406
407 void PPB_Flash_Proxy::OnMsgIsRectTopmost(PP_Instance instance,
408 PP_Rect rect,
409 PP_Bool* result) {
410 *result = ppb_flash_impl_->IsRectTopmost(instance, &rect);
411 }
412
361 } // namespace proxy 413 } // namespace proxy
362 } // namespace ppapi 414 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_flash_proxy.h ('k') | webkit/plugins/ppapi/plugin_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698