OLD | NEW |
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/ppp_instance_proxy.h" | 5 #include "ppapi/proxy/ppp_instance_proxy.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "ppapi/c/pp_var.h" | 10 #include "ppapi/c/pp_var.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "ppapi/shared_impl/ppb_view_shared.h" | 21 #include "ppapi/shared_impl/ppb_view_shared.h" |
22 #include "ppapi/shared_impl/scoped_pp_resource.h" | 22 #include "ppapi/shared_impl/scoped_pp_resource.h" |
23 #include "ppapi/thunk/enter.h" | 23 #include "ppapi/thunk/enter.h" |
24 #include "ppapi/thunk/ppb_view_api.h" | 24 #include "ppapi/thunk/ppb_view_api.h" |
25 | 25 |
26 namespace ppapi { | 26 namespace ppapi { |
27 namespace proxy { | 27 namespace proxy { |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
| 31 #if !defined(OS_NACL) |
31 PP_Bool IsFlashFullscreen(PP_Instance instance, | 32 PP_Bool IsFlashFullscreen(PP_Instance instance, |
32 HostDispatcher* dispatcher) { | 33 HostDispatcher* dispatcher) { |
33 const PPB_FlashFullscreen* flash_fullscreen_interface = | 34 const PPB_FlashFullscreen* flash_fullscreen_interface = |
34 static_cast<const PPB_FlashFullscreen*>( | 35 static_cast<const PPB_FlashFullscreen*>( |
35 dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE)); | 36 dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE)); |
36 DCHECK(flash_fullscreen_interface); | 37 DCHECK(flash_fullscreen_interface); |
37 return flash_fullscreen_interface->IsFullscreen(instance); | 38 return flash_fullscreen_interface->IsFullscreen(instance); |
38 } | 39 } |
39 | 40 |
40 PP_Bool DidCreate(PP_Instance instance, | 41 PP_Bool DidCreate(PP_Instance instance, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 return result; | 113 return result; |
113 } | 114 } |
114 | 115 |
115 static const PPP_Instance_1_1 instance_interface = { | 116 static const PPP_Instance_1_1 instance_interface = { |
116 &DidCreate, | 117 &DidCreate, |
117 &DidDestroy, | 118 &DidDestroy, |
118 &DidChangeView, | 119 &DidChangeView, |
119 &DidChangeFocus, | 120 &DidChangeFocus, |
120 &HandleDocumentLoad | 121 &HandleDocumentLoad |
121 }; | 122 }; |
| 123 #endif // !defined(OS_NACL) |
122 | 124 |
123 } // namespace | 125 } // namespace |
124 | 126 |
125 PPP_Instance_Proxy::PPP_Instance_Proxy(Dispatcher* dispatcher) | 127 PPP_Instance_Proxy::PPP_Instance_Proxy(Dispatcher* dispatcher) |
126 : InterfaceProxy(dispatcher) { | 128 : InterfaceProxy(dispatcher) { |
127 if (dispatcher->IsPlugin()) { | 129 if (dispatcher->IsPlugin()) { |
128 // The PPP_Instance proxy works by always proxying the 1.1 version of the | 130 // The PPP_Instance proxy works by always proxying the 1.1 version of the |
129 // interface, and then detecting in the plugin process which one to use. | 131 // interface, and then detecting in the plugin process which one to use. |
130 // PPP_Instance_Combined handles dispatching to whatever interface is | 132 // PPP_Instance_Combined handles dispatching to whatever interface is |
131 // supported. | 133 // supported. |
132 // | 134 // |
133 // This means that if the plugin supports either 1.0 or 1.1 version of | 135 // This means that if the plugin supports either 1.0 or 1.1 version of |
134 // the interface, we want to say it supports the 1.1 version since we'll | 136 // the interface, we want to say it supports the 1.1 version since we'll |
135 // convert it here. This magic conversion code is hardcoded into | 137 // convert it here. This magic conversion code is hardcoded into |
136 // PluginDispatcher::OnMsgSupportsInterface. | 138 // PluginDispatcher::OnMsgSupportsInterface. |
137 combined_interface_.reset(PPP_Instance_Combined::Create( | 139 combined_interface_.reset(PPP_Instance_Combined::Create( |
138 base::Bind(dispatcher->local_get_interface()))); | 140 base::Bind(dispatcher->local_get_interface()))); |
139 } | 141 } |
140 } | 142 } |
141 | 143 |
142 PPP_Instance_Proxy::~PPP_Instance_Proxy() { | 144 PPP_Instance_Proxy::~PPP_Instance_Proxy() { |
143 } | 145 } |
144 | 146 |
| 147 #if !defined(OS_NACL) |
145 // static | 148 // static |
146 const PPP_Instance* PPP_Instance_Proxy::GetInstanceInterface() { | 149 const PPP_Instance* PPP_Instance_Proxy::GetInstanceInterface() { |
147 return &instance_interface; | 150 return &instance_interface; |
148 } | 151 } |
| 152 #endif // !defined(OS_NACL) |
149 | 153 |
150 bool PPP_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { | 154 bool PPP_Instance_Proxy::OnMessageReceived(const IPC::Message& msg) { |
151 bool handled = true; | 155 bool handled = true; |
152 IPC_BEGIN_MESSAGE_MAP(PPP_Instance_Proxy, msg) | 156 IPC_BEGIN_MESSAGE_MAP(PPP_Instance_Proxy, msg) |
153 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidCreate, | 157 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidCreate, |
154 OnPluginMsgDidCreate) | 158 OnPluginMsgDidCreate) |
155 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidDestroy, | 159 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidDestroy, |
156 OnPluginMsgDidDestroy) | 160 OnPluginMsgDidDestroy) |
157 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidChangeView, | 161 IPC_MESSAGE_HANDLER(PpapiMsg_PPPInstance_DidChangeView, |
158 OnPluginMsgDidChangeView) | 162 OnPluginMsgDidChangeView) |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // with. The plugin will normally take an additional reference which will keep | 254 // with. The plugin will normally take an additional reference which will keep |
251 // the resource alive in the plugin (and the one reference in the renderer | 255 // the resource alive in the plugin (and the one reference in the renderer |
252 // representing all plugin references). | 256 // representing all plugin references). |
253 // Once all references at the plugin side are released, the renderer side will | 257 // Once all references at the plugin side are released, the renderer side will |
254 // be notified and release the reference added in HandleDocumentLoad() above. | 258 // be notified and release the reference added in HandleDocumentLoad() above. |
255 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(plugin_loader); | 259 PpapiGlobals::Get()->GetResourceTracker()->ReleaseResource(plugin_loader); |
256 } | 260 } |
257 | 261 |
258 } // namespace proxy | 262 } // namespace proxy |
259 } // namespace ppapi | 263 } // namespace ppapi |
OLD | NEW |