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