| OLD | NEW |
| 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_instance_proxy.h" | 5 #include "ppapi/proxy/ppp_instance_proxy.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ppapi/c/pp_var.h" | 9 #include "ppapi/c/pp_var.h" |
| 10 #include "ppapi/c/ppb_core.h" | 10 #include "ppapi/c/ppb_core.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 | 46 |
| 47 void DidChangeView(PP_Instance instance, | 47 void DidChangeView(PP_Instance instance, |
| 48 const PP_Rect* position, | 48 const PP_Rect* position, |
| 49 const PP_Rect* clip) { | 49 const PP_Rect* clip) { |
| 50 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); | 50 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| 51 const PPB_FlashFullscreen* fullscreen_interface = | 51 const PPB_FlashFullscreen* fullscreen_interface = |
| 52 static_cast<const PPB_FlashFullscreen*>( | 52 static_cast<const PPB_FlashFullscreen*>( |
| 53 dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE)); | 53 dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE)); |
| 54 DCHECK(fullscreen_interface); | 54 DCHECK(fullscreen_interface); |
| 55 const PPB_FlashFullscreen* flash_fullscreen_interface = |
| 56 static_cast<const PPB_FlashFullscreen*>( |
| 57 dispatcher->local_get_interface()(PPB_FLASHFULLSCREEN_INTERFACE)); |
| 58 DCHECK(flash_fullscreen_interface); |
| 55 PP_Bool fullscreen = fullscreen_interface->IsFullscreen(instance); | 59 PP_Bool fullscreen = fullscreen_interface->IsFullscreen(instance); |
| 60 PP_Bool flash_fullscreen = |
| 61 flash_fullscreen_interface->IsFullscreen(instance); |
| 56 dispatcher->Send( | 62 dispatcher->Send( |
| 57 new PpapiMsg_PPPInstance_DidChangeView(INTERFACE_ID_PPP_INSTANCE, | 63 new PpapiMsg_PPPInstance_DidChangeView(INTERFACE_ID_PPP_INSTANCE, |
| 58 instance, *position, *clip, | 64 instance, *position, *clip, |
| 59 fullscreen)); | 65 fullscreen, |
| 66 flash_fullscreen)); |
| 60 } | 67 } |
| 61 | 68 |
| 62 void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) { | 69 void DidChangeFocus(PP_Instance instance, PP_Bool has_focus) { |
| 63 HostDispatcher::GetForInstance(instance)->Send( | 70 HostDispatcher::GetForInstance(instance)->Send( |
| 64 new PpapiMsg_PPPInstance_DidChangeFocus(INTERFACE_ID_PPP_INSTANCE, | 71 new PpapiMsg_PPPInstance_DidChangeFocus(INTERFACE_ID_PPP_INSTANCE, |
| 65 instance, has_focus)); | 72 instance, has_focus)); |
| 66 } | 73 } |
| 67 | 74 |
| 68 PP_Bool HandleDocumentLoad(PP_Instance instance, | 75 PP_Bool HandleDocumentLoad(PP_Instance instance, |
| 69 PP_Resource url_loader) { | 76 PP_Resource url_loader) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 196 |
| 190 void PPP_Instance_Proxy::OnMsgDidDestroy(PP_Instance instance) { | 197 void PPP_Instance_Proxy::OnMsgDidDestroy(PP_Instance instance) { |
| 191 combined_interface_->DidDestroy(instance); | 198 combined_interface_->DidDestroy(instance); |
| 192 ppapi::TrackerBase::Get()->GetResourceTracker()->DidDeleteInstance(instance); | 199 ppapi::TrackerBase::Get()->GetResourceTracker()->DidDeleteInstance(instance); |
| 193 static_cast<PluginDispatcher*>(dispatcher())->DidDestroyInstance(instance); | 200 static_cast<PluginDispatcher*>(dispatcher())->DidDestroyInstance(instance); |
| 194 } | 201 } |
| 195 | 202 |
| 196 void PPP_Instance_Proxy::OnMsgDidChangeView(PP_Instance instance, | 203 void PPP_Instance_Proxy::OnMsgDidChangeView(PP_Instance instance, |
| 197 const PP_Rect& position, | 204 const PP_Rect& position, |
| 198 const PP_Rect& clip, | 205 const PP_Rect& clip, |
| 199 PP_Bool fullscreen) { | 206 PP_Bool fullscreen, |
| 207 PP_Bool flash_fullscreen) { |
| 200 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 208 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 201 if (!dispatcher) | 209 if (!dispatcher) |
| 202 return; | 210 return; |
| 203 InstanceData* data = dispatcher->GetInstanceData(instance); | 211 InstanceData* data = dispatcher->GetInstanceData(instance); |
| 204 if (!data) | 212 if (!data) |
| 205 return; | 213 return; |
| 206 data->position = position; | 214 data->position = position; |
| 207 data->fullscreen = fullscreen; | 215 data->fullscreen = fullscreen; |
| 216 data->flash_fullscreen = flash_fullscreen; |
| 208 combined_interface_->DidChangeView(instance, &position, &clip); | 217 combined_interface_->DidChangeView(instance, &position, &clip); |
| 209 } | 218 } |
| 210 | 219 |
| 211 void PPP_Instance_Proxy::OnMsgDidChangeFocus(PP_Instance instance, | 220 void PPP_Instance_Proxy::OnMsgDidChangeFocus(PP_Instance instance, |
| 212 PP_Bool has_focus) { | 221 PP_Bool has_focus) { |
| 213 combined_interface_->DidChangeFocus(instance, has_focus); | 222 combined_interface_->DidChangeFocus(instance, has_focus); |
| 214 } | 223 } |
| 215 | 224 |
| 216 void PPP_Instance_Proxy::OnMsgHandleDocumentLoad(PP_Instance instance, | 225 void PPP_Instance_Proxy::OnMsgHandleDocumentLoad(PP_Instance instance, |
| 217 const HostResource& url_loader, | 226 const HostResource& url_loader, |
| 218 PP_Bool* result) { | 227 PP_Bool* result) { |
| 219 PP_Resource plugin_loader = | 228 PP_Resource plugin_loader = |
| 220 PPB_URLLoader_Proxy::TrackPluginResource(url_loader); | 229 PPB_URLLoader_Proxy::TrackPluginResource(url_loader); |
| 221 *result = combined_interface_->HandleDocumentLoad(instance, plugin_loader); | 230 *result = combined_interface_->HandleDocumentLoad(instance, plugin_loader); |
| 222 | 231 |
| 223 // This balances the one reference that TrackPluginResource() initialized it | 232 // This balances the one reference that TrackPluginResource() initialized it |
| 224 // with. The plugin will normally take an additional reference which will keep | 233 // with. The plugin will normally take an additional reference which will keep |
| 225 // the resource alive in the plugin (and the one reference in the renderer | 234 // the resource alive in the plugin (and the one reference in the renderer |
| 226 // representing all plugin references). | 235 // representing all plugin references). |
| 227 // Once all references at the plugin side are released, the renderer side will | 236 // Once all references at the plugin side are released, the renderer side will |
| 228 // be notified and release the reference added in HandleDocumentLoad() above. | 237 // be notified and release the reference added in HandleDocumentLoad() above. |
| 229 PluginResourceTracker::GetInstance()->ReleaseResource(plugin_loader); | 238 PluginResourceTracker::GetInstance()->ReleaseResource(plugin_loader); |
| 230 } | 239 } |
| 231 | 240 |
| 232 } // namespace proxy | 241 } // namespace proxy |
| 233 } // namespace ppapi | 242 } // namespace ppapi |
| OLD | NEW |