Updates version of android sdk and api installed and creates ARM and x86 AVD's.
[chromium-blink-merge.git] / ppapi / proxy / ppp_mouse_lock_proxy.cc
blob10aa47f7bd5cf273f01fde5264785d4a07f3ef04
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
3 // found in the LICENSE file.
5 #include "ppapi/proxy/ppp_mouse_lock_proxy.h"
7 #include "ppapi/c/ppp_mouse_lock.h"
8 #include "ppapi/proxy/host_dispatcher.h"
9 #include "ppapi/proxy/ppapi_messages.h"
10 #include "ppapi/shared_impl/proxy_lock.h"
12 namespace ppapi {
13 namespace proxy {
15 namespace {
17 void MouseLockLost(PP_Instance instance) {
18 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
19 if (!dispatcher) {
20 // The dispatcher should always be valid.
21 NOTREACHED();
22 return;
25 dispatcher->Send(new PpapiMsg_PPPMouseLock_MouseLockLost(
26 API_ID_PPP_MOUSE_LOCK, instance));
29 static const PPP_MouseLock mouse_lock_interface = {
30 &MouseLockLost
33 InterfaceProxy* CreateMouseLockProxy(Dispatcher* dispatcher) {
34 return new PPP_MouseLock_Proxy(dispatcher);
37 } // namespace
39 PPP_MouseLock_Proxy::PPP_MouseLock_Proxy(Dispatcher* dispatcher)
40 : InterfaceProxy(dispatcher),
41 ppp_mouse_lock_impl_(NULL) {
42 if (dispatcher->IsPlugin()) {
43 ppp_mouse_lock_impl_ = static_cast<const PPP_MouseLock*>(
44 dispatcher->local_get_interface()(PPP_MOUSELOCK_INTERFACE));
48 PPP_MouseLock_Proxy::~PPP_MouseLock_Proxy() {
51 // static
52 const InterfaceProxy::Info* PPP_MouseLock_Proxy::GetInfo() {
53 static const Info info = {
54 &mouse_lock_interface,
55 PPP_MOUSELOCK_INTERFACE,
56 API_ID_PPP_MOUSE_LOCK,
57 false,
58 &CreateMouseLockProxy,
60 return &info;
63 bool PPP_MouseLock_Proxy::OnMessageReceived(const IPC::Message& msg) {
64 bool handled = true;
65 IPC_BEGIN_MESSAGE_MAP(PPP_MouseLock_Proxy, msg)
66 IPC_MESSAGE_HANDLER(PpapiMsg_PPPMouseLock_MouseLockLost,
67 OnMsgMouseLockLost)
68 IPC_MESSAGE_UNHANDLED(handled = false)
69 IPC_END_MESSAGE_MAP()
70 return handled;
73 void PPP_MouseLock_Proxy::OnMsgMouseLockLost(PP_Instance instance) {
74 if (ppp_mouse_lock_impl_)
75 CallWhileUnlocked(ppp_mouse_lock_impl_->MouseLockLost, instance);
78 } // namespace proxy
79 } // namespace ppapi