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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 instance->delegate()->ZoomLimitsChanged(minimum_factor, maximium_factor); | 229 instance->delegate()->ZoomLimitsChanged(minimum_factor, maximium_factor); |
230 } | 230 } |
231 | 231 |
232 const PPB_Zoom_Dev ppb_zoom = { | 232 const PPB_Zoom_Dev ppb_zoom = { |
233 &ZoomChanged, | 233 &ZoomChanged, |
234 &ZoomLimitsChanged | 234 &ZoomLimitsChanged |
235 }; | 235 }; |
236 | 236 |
237 } // namespace | 237 } // namespace |
238 | 238 |
239 PluginInstance::PluginInstance(PluginDelegate* delegate, | 239 // static |
240 PluginModule* module, | 240 PluginInstance* PluginInstance::Create0_5(PluginDelegate* delegate, |
241 PPP_Instance_Combined* instance_interface) | 241 PluginModule* module, |
| 242 const void* ppp_instance_if_0_5) { |
| 243 const PPP_Instance_0_5* interface = |
| 244 static_cast<const PPP_Instance_0_5*>(ppp_instance_if_0_5); |
| 245 return new PluginInstance( |
| 246 delegate, |
| 247 module, |
| 248 new ::ppapi::PPP_Instance_Combined(*interface)); |
| 249 } |
| 250 |
| 251 // static |
| 252 PluginInstance* PluginInstance::Create0_4(PluginDelegate* delegate, |
| 253 PluginModule* module, |
| 254 const void* ppp_instance_if_0_4) { |
| 255 const PPP_Instance_0_4* interface = |
| 256 static_cast<const PPP_Instance_0_4*>(ppp_instance_if_0_4); |
| 257 return new PluginInstance( |
| 258 delegate, |
| 259 module, |
| 260 new ::ppapi::PPP_Instance_Combined(*interface)); |
| 261 } |
| 262 |
| 263 PluginInstance::PluginInstance( |
| 264 PluginDelegate* delegate, |
| 265 PluginModule* module, |
| 266 ::ppapi::PPP_Instance_Combined* instance_interface) |
242 : delegate_(delegate), | 267 : delegate_(delegate), |
243 module_(module), | 268 module_(module), |
244 instance_interface_(instance_interface), | 269 instance_interface_(instance_interface), |
245 pp_instance_(0), | 270 pp_instance_(0), |
246 container_(NULL), | 271 container_(NULL), |
247 full_frame_(false), | 272 full_frame_(false), |
248 has_webkit_focus_(false), | 273 has_webkit_focus_(false), |
249 has_content_area_focus_(false), | 274 has_content_area_focus_(false), |
250 find_identifier_(-1), | 275 find_identifier_(-1), |
251 plugin_find_interface_(NULL), | 276 plugin_find_interface_(NULL), |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 bool PluginInstance::LoadFindInterface() { | 706 bool PluginInstance::LoadFindInterface() { |
682 if (!plugin_find_interface_) { | 707 if (!plugin_find_interface_) { |
683 plugin_find_interface_ = | 708 plugin_find_interface_ = |
684 static_cast<const PPP_Find_Dev*>(module_->GetPluginInterface( | 709 static_cast<const PPP_Find_Dev*>(module_->GetPluginInterface( |
685 PPP_FIND_DEV_INTERFACE)); | 710 PPP_FIND_DEV_INTERFACE)); |
686 } | 711 } |
687 | 712 |
688 return !!plugin_find_interface_; | 713 return !!plugin_find_interface_; |
689 } | 714 } |
690 | 715 |
691 PluginInstance::PPP_Instance_Combined::PPP_Instance_Combined( | |
692 const PPP_Instance_0_5& instance_if) | |
693 : PPP_Instance_0_5(instance_if), | |
694 GetInstanceObject_0_4(NULL) {} | |
695 | |
696 PluginInstance::PPP_Instance_Combined::PPP_Instance_Combined( | |
697 const PPP_Instance_0_4& instance_if) | |
698 : PPP_Instance_0_5(), // Zero-initialize. | |
699 GetInstanceObject_0_4(instance_if.GetInstanceObject) { | |
700 DidCreate = instance_if.DidCreate; | |
701 DidDestroy = instance_if.DidDestroy; | |
702 DidChangeView = instance_if.DidChangeView; | |
703 DidChangeFocus = instance_if.DidChangeFocus; | |
704 HandleInputEvent = instance_if.HandleInputEvent; | |
705 HandleDocumentLoad = instance_if.HandleDocumentLoad; | |
706 } | |
707 | |
708 bool PluginInstance::LoadMessagingInterface() { | 716 bool PluginInstance::LoadMessagingInterface() { |
709 if (!checked_for_plugin_messaging_interface_) { | 717 if (!checked_for_plugin_messaging_interface_) { |
710 checked_for_plugin_messaging_interface_ = true; | 718 checked_for_plugin_messaging_interface_ = true; |
711 plugin_messaging_interface_ = | 719 plugin_messaging_interface_ = |
712 static_cast<const PPP_Messaging*>(module_->GetPluginInterface( | 720 static_cast<const PPP_Messaging*>(module_->GetPluginInterface( |
713 PPP_MESSAGING_INTERFACE)); | 721 PPP_MESSAGING_INTERFACE)); |
714 } | 722 } |
715 | 723 |
716 return !!plugin_messaging_interface_; | 724 return !!plugin_messaging_interface_; |
717 } | 725 } |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1504 } | 1512 } |
1505 | 1513 |
1506 PP_Bool PluginInstance::GetScreenSize(PP_Instance instance, PP_Size* size) { | 1514 PP_Bool PluginInstance::GetScreenSize(PP_Instance instance, PP_Size* size) { |
1507 gfx::Size screen_size = delegate()->GetScreenSize(); | 1515 gfx::Size screen_size = delegate()->GetScreenSize(); |
1508 *size = PP_MakeSize(screen_size.width(), screen_size.height()); | 1516 *size = PP_MakeSize(screen_size.width(), screen_size.height()); |
1509 return PP_TRUE; | 1517 return PP_TRUE; |
1510 } | 1518 } |
1511 | 1519 |
1512 } // namespace ppapi | 1520 } // namespace ppapi |
1513 } // namespace webkit | 1521 } // namespace webkit |
OLD | NEW |