| 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" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "ppapi/c/dev/ppb_find_dev.h" | 12 #include "ppapi/c/dev/ppb_find_dev.h" |
| 13 #include "ppapi/c/dev/ppb_fullscreen_dev.h" | 13 #include "ppapi/c/dev/ppb_fullscreen_dev.h" |
| 14 #include "ppapi/c/dev/ppb_memory_dev.h" | 14 #include "ppapi/c/dev/ppb_memory_dev.h" |
| 15 #include "ppapi/c/dev/ppb_zoom_dev.h" | 15 #include "ppapi/c/dev/ppb_zoom_dev.h" |
| 16 #include "ppapi/c/dev/ppp_find_dev.h" | 16 #include "ppapi/c/dev/ppp_find_dev.h" |
| 17 #include "ppapi/c/dev/ppp_resize_dev.h" |
| 17 #include "ppapi/c/dev/ppp_policy_update_dev.h" | 18 #include "ppapi/c/dev/ppp_policy_update_dev.h" |
| 18 #include "ppapi/c/dev/ppp_selection_dev.h" | 19 #include "ppapi/c/dev/ppp_selection_dev.h" |
| 19 #include "ppapi/c/dev/ppp_zoom_dev.h" | 20 #include "ppapi/c/dev/ppp_zoom_dev.h" |
| 20 #include "ppapi/c/pp_input_event.h" | 21 #include "ppapi/c/pp_input_event.h" |
| 21 #include "ppapi/c/pp_instance.h" | 22 #include "ppapi/c/pp_instance.h" |
| 22 #include "ppapi/c/pp_rect.h" | 23 #include "ppapi/c/pp_rect.h" |
| 23 #include "ppapi/c/pp_resource.h" | 24 #include "ppapi/c/pp_resource.h" |
| 24 #include "ppapi/c/pp_var.h" | 25 #include "ppapi/c/pp_var.h" |
| 25 #include "ppapi/c/ppb_core.h" | 26 #include "ppapi/c/ppb_core.h" |
| 26 #include "ppapi/c/ppb_instance.h" | 27 #include "ppapi/c/ppb_instance.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 full_frame_(false), | 217 full_frame_(false), |
| 217 has_webkit_focus_(false), | 218 has_webkit_focus_(false), |
| 218 has_content_area_focus_(false), | 219 has_content_area_focus_(false), |
| 219 find_identifier_(-1), | 220 find_identifier_(-1), |
| 220 plugin_find_interface_(NULL), | 221 plugin_find_interface_(NULL), |
| 221 plugin_messaging_interface_(NULL), | 222 plugin_messaging_interface_(NULL), |
| 222 plugin_input_event_interface_(NULL), | 223 plugin_input_event_interface_(NULL), |
| 223 plugin_private_interface_(NULL), | 224 plugin_private_interface_(NULL), |
| 224 plugin_pdf_interface_(NULL), | 225 plugin_pdf_interface_(NULL), |
| 225 plugin_policy_updated_interface_(NULL), | 226 plugin_policy_updated_interface_(NULL), |
| 227 plugin_resize_interface_(NULL), |
| 226 plugin_selection_interface_(NULL), | 228 plugin_selection_interface_(NULL), |
| 227 plugin_zoom_interface_(NULL), | 229 plugin_zoom_interface_(NULL), |
| 228 checked_for_plugin_input_event_interface_(false), | 230 checked_for_plugin_input_event_interface_(false), |
| 229 checked_for_plugin_messaging_interface_(false), | 231 checked_for_plugin_messaging_interface_(false), |
| 230 plugin_print_interface_(NULL), | 232 plugin_print_interface_(NULL), |
| 231 plugin_graphics_3d_interface_(NULL), | 233 plugin_graphics_3d_interface_(NULL), |
| 232 always_on_top_(false), | 234 always_on_top_(false), |
| 233 fullscreen_container_(NULL), | 235 fullscreen_container_(NULL), |
| 234 fullscreen_(false), | 236 fullscreen_(false), |
| 235 message_channel_(NULL), | 237 message_channel_(NULL), |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 | 667 |
| 666 void PluginInstance::StopFind() { | 668 void PluginInstance::StopFind() { |
| 667 // Keep a reference on the stack. See NOTE above. | 669 // Keep a reference on the stack. See NOTE above. |
| 668 scoped_refptr<PluginInstance> ref(this); | 670 scoped_refptr<PluginInstance> ref(this); |
| 669 if (!LoadFindInterface()) | 671 if (!LoadFindInterface()) |
| 670 return; | 672 return; |
| 671 find_identifier_ = -1; | 673 find_identifier_ = -1; |
| 672 plugin_find_interface_->StopFind(pp_instance()); | 674 plugin_find_interface_->StopFind(pp_instance()); |
| 673 } | 675 } |
| 674 | 676 |
| 677 void PluginInstance::WillStartLiveResize() { |
| 678 if (!LoadResizeInterface()) |
| 679 return; |
| 680 plugin_resize_interface_->WillStartLiveResize(pp_instance()); |
| 681 } |
| 682 |
| 683 void PluginInstance::WillEndLiveResize() { |
| 684 if (!LoadResizeInterface()) |
| 685 return; |
| 686 plugin_resize_interface_->WillEndLiveResize(pp_instance()); |
| 687 } |
| 688 |
| 675 bool PluginInstance::LoadFindInterface() { | 689 bool PluginInstance::LoadFindInterface() { |
| 676 if (!plugin_find_interface_) { | 690 if (!plugin_find_interface_) { |
| 677 plugin_find_interface_ = | 691 plugin_find_interface_ = |
| 678 static_cast<const PPP_Find_Dev*>(module_->GetPluginInterface( | 692 static_cast<const PPP_Find_Dev*>(module_->GetPluginInterface( |
| 679 PPP_FIND_DEV_INTERFACE)); | 693 PPP_FIND_DEV_INTERFACE)); |
| 680 } | 694 } |
| 681 | 695 |
| 682 return !!plugin_find_interface_; | 696 return !!plugin_find_interface_; |
| 683 } | 697 } |
| 684 | 698 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 | 759 |
| 746 bool PluginInstance::LoadPrivateInterface() { | 760 bool PluginInstance::LoadPrivateInterface() { |
| 747 if (!plugin_private_interface_) { | 761 if (!plugin_private_interface_) { |
| 748 plugin_private_interface_ = static_cast<const PPP_Instance_Private*>( | 762 plugin_private_interface_ = static_cast<const PPP_Instance_Private*>( |
| 749 module_->GetPluginInterface(PPP_INSTANCE_PRIVATE_INTERFACE)); | 763 module_->GetPluginInterface(PPP_INSTANCE_PRIVATE_INTERFACE)); |
| 750 } | 764 } |
| 751 | 765 |
| 752 return !!plugin_private_interface_; | 766 return !!plugin_private_interface_; |
| 753 } | 767 } |
| 754 | 768 |
| 769 bool PluginInstance::LoadResizeInterface() { |
| 770 if (!plugin_resize_interface_) { |
| 771 plugin_resize_interface_ = |
| 772 static_cast<const PPP_Resize_Dev*>(module_->GetPluginInterface( |
| 773 PPP_RESIZE_DEV_INTERFACE)); |
| 774 } |
| 775 |
| 776 return !!plugin_resize_interface_; |
| 777 } |
| 778 |
| 755 bool PluginInstance::LoadSelectionInterface() { | 779 bool PluginInstance::LoadSelectionInterface() { |
| 756 if (!plugin_selection_interface_) { | 780 if (!plugin_selection_interface_) { |
| 757 plugin_selection_interface_ = | 781 plugin_selection_interface_ = |
| 758 static_cast<const PPP_Selection_Dev*>(module_->GetPluginInterface( | 782 static_cast<const PPP_Selection_Dev*>(module_->GetPluginInterface( |
| 759 PPP_SELECTION_DEV_INTERFACE)); | 783 PPP_SELECTION_DEV_INTERFACE)); |
| 760 } | 784 } |
| 761 | 785 |
| 762 return !!plugin_selection_interface_; | 786 return !!plugin_selection_interface_; |
| 763 } | 787 } |
| 764 | 788 |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 void PluginInstance::PostMessage(PP_Instance instance, PP_Var message) { | 1562 void PluginInstance::PostMessage(PP_Instance instance, PP_Var message) { |
| 1539 message_channel_->PostMessageToJavaScript(message); | 1563 message_channel_->PostMessageToJavaScript(message); |
| 1540 } | 1564 } |
| 1541 | 1565 |
| 1542 void PluginInstance::SubscribeToPolicyUpdates(PP_Instance instance) { | 1566 void PluginInstance::SubscribeToPolicyUpdates(PP_Instance instance) { |
| 1543 delegate()->SubscribeToPolicyUpdates(this); | 1567 delegate()->SubscribeToPolicyUpdates(this); |
| 1544 } | 1568 } |
| 1545 | 1569 |
| 1546 } // namespace ppapi | 1570 } // namespace ppapi |
| 1547 } // namespace webkit | 1571 } // namespace webkit |
| OLD | NEW |