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

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

Issue 7740038: Use macros to define pepper interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: New patch Created 9 years, 3 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/ppp_mouse_lock_proxy.h ('k') | ppapi/proxy/ppp_video_decoder_proxy.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ppp_mouse_lock_proxy.h" 5 #include "ppapi/proxy/ppp_mouse_lock_proxy.h"
6 6
7 #include "ppapi/c/dev/ppp_mouse_lock_dev.h" 7 #include "ppapi/c/dev/ppp_mouse_lock_dev.h"
8 #include "ppapi/proxy/host_dispatcher.h" 8 #include "ppapi/proxy/host_dispatcher.h"
9 #include "ppapi/proxy/ppapi_messages.h" 9 #include "ppapi/proxy/ppapi_messages.h"
10 10
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 23
24 dispatcher->Send(new PpapiMsg_PPPMouseLock_MouseLockLost( 24 dispatcher->Send(new PpapiMsg_PPPMouseLock_MouseLockLost(
25 INTERFACE_ID_PPP_MOUSE_LOCK_DEV, instance)); 25 INTERFACE_ID_PPP_MOUSE_LOCK_DEV, instance));
26 } 26 }
27 27
28 static const PPP_MouseLock_Dev mouse_lock_interface = { 28 static const PPP_MouseLock_Dev mouse_lock_interface = {
29 &MouseLockLost 29 &MouseLockLost
30 }; 30 };
31 31
32 InterfaceProxy* CreateMouseLockProxy(Dispatcher* dispatcher, 32 InterfaceProxy* CreateMouseLockProxy(Dispatcher* dispatcher) {
33 const void* target_interface) { 33 return new PPP_MouseLock_Proxy(dispatcher);
34 return new PPP_MouseLock_Proxy(dispatcher, target_interface);
35 } 34 }
36 35
37 } // namespace 36 } // namespace
38 37
39 PPP_MouseLock_Proxy::PPP_MouseLock_Proxy(Dispatcher* dispatcher, 38 PPP_MouseLock_Proxy::PPP_MouseLock_Proxy(Dispatcher* dispatcher)
40 const void* target_interface) 39 : InterfaceProxy(dispatcher) {
41 : InterfaceProxy(dispatcher, target_interface) { 40 if (dispatcher->IsPlugin()) {
41 ppp_mouse_lock_impl_ = static_cast<const PPP_MouseLock_Dev*>(
42 dispatcher->local_get_interface()(PPP_MOUSELOCK_DEV_INTERFACE));
43 }
42 } 44 }
43 45
44 PPP_MouseLock_Proxy::~PPP_MouseLock_Proxy() { 46 PPP_MouseLock_Proxy::~PPP_MouseLock_Proxy() {
45 } 47 }
46 48
47 // static 49 // static
48 const InterfaceProxy::Info* PPP_MouseLock_Proxy::GetInfo() { 50 const InterfaceProxy::Info* PPP_MouseLock_Proxy::GetInfo() {
49 static const Info info = { 51 static const Info info = {
50 &mouse_lock_interface, 52 &mouse_lock_interface,
51 PPP_MOUSELOCK_DEV_INTERFACE, 53 PPP_MOUSELOCK_DEV_INTERFACE,
52 INTERFACE_ID_PPP_MOUSE_LOCK_DEV, 54 INTERFACE_ID_PPP_MOUSE_LOCK_DEV,
53 false, 55 false,
54 &CreateMouseLockProxy, 56 &CreateMouseLockProxy,
55 }; 57 };
56 return &info; 58 return &info;
57 } 59 }
58 60
59 bool PPP_MouseLock_Proxy::OnMessageReceived(const IPC::Message& msg) { 61 bool PPP_MouseLock_Proxy::OnMessageReceived(const IPC::Message& msg) {
60 bool handled = true; 62 bool handled = true;
61 IPC_BEGIN_MESSAGE_MAP(PPP_MouseLock_Proxy, msg) 63 IPC_BEGIN_MESSAGE_MAP(PPP_MouseLock_Proxy, msg)
62 IPC_MESSAGE_HANDLER(PpapiMsg_PPPMouseLock_MouseLockLost, 64 IPC_MESSAGE_HANDLER(PpapiMsg_PPPMouseLock_MouseLockLost,
63 OnMsgMouseLockLost) 65 OnMsgMouseLockLost)
64 IPC_MESSAGE_UNHANDLED(handled = false) 66 IPC_MESSAGE_UNHANDLED(handled = false)
65 IPC_END_MESSAGE_MAP() 67 IPC_END_MESSAGE_MAP()
66 return handled; 68 return handled;
67 } 69 }
68 70
69 void PPP_MouseLock_Proxy::OnMsgMouseLockLost(PP_Instance instance) { 71 void PPP_MouseLock_Proxy::OnMsgMouseLockLost(PP_Instance instance) {
70 if (ppp_mouse_lock_target()) 72 if (ppp_mouse_lock_impl_)
71 ppp_mouse_lock_target()->MouseLockLost(instance); 73 ppp_mouse_lock_impl_->MouseLockLost(instance);
72 } 74 }
73 75
74 } // namespace proxy 76 } // namespace proxy
75 } // namespace ppapi 77 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppp_mouse_lock_proxy.h ('k') | ppapi/proxy/ppp_video_decoder_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698