| 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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/linked_ptr.h" | 10 #include "base/memory/linked_ptr.h" |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 490 |
| 491 bool PluginInstance::Initialize(WebPluginContainer* container, | 491 bool PluginInstance::Initialize(WebPluginContainer* container, |
| 492 const std::vector<std::string>& arg_names, | 492 const std::vector<std::string>& arg_names, |
| 493 const std::vector<std::string>& arg_values, | 493 const std::vector<std::string>& arg_values, |
| 494 const GURL& plugin_url, | 494 const GURL& plugin_url, |
| 495 bool full_frame) { | 495 bool full_frame) { |
| 496 container_ = container; | 496 container_ = container; |
| 497 plugin_url_ = plugin_url; | 497 plugin_url_ = plugin_url; |
| 498 full_frame_ = full_frame; | 498 full_frame_ = full_frame; |
| 499 | 499 |
| 500 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents()); |
| 501 |
| 500 argn_ = arg_names; | 502 argn_ = arg_names; |
| 501 argv_ = arg_values; | 503 argv_ = arg_values; |
| 502 scoped_array<const char*> argn_array(StringVectorToArgArray(argn_)); | 504 scoped_array<const char*> argn_array(StringVectorToArgArray(argn_)); |
| 503 scoped_array<const char*> argv_array(StringVectorToArgArray(argv_)); | 505 scoped_array<const char*> argv_array(StringVectorToArgArray(argv_)); |
| 504 return PP_ToBool(instance_interface_->DidCreate(pp_instance(), | 506 return PP_ToBool(instance_interface_->DidCreate(pp_instance(), |
| 505 argn_.size(), | 507 argn_.size(), |
| 506 argn_array.get(), | 508 argn_array.get(), |
| 507 argv_array.get())); | 509 argv_array.get())); |
| 508 } | 510 } |
| 509 | 511 |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 PPP_ZOOM_DEV_INTERFACE)); | 1048 PPP_ZOOM_DEV_INTERFACE)); |
| 1047 } | 1049 } |
| 1048 | 1050 |
| 1049 return !!plugin_zoom_interface_; | 1051 return !!plugin_zoom_interface_; |
| 1050 } | 1052 } |
| 1051 | 1053 |
| 1052 bool PluginInstance::PluginHasFocus() const { | 1054 bool PluginInstance::PluginHasFocus() const { |
| 1053 return has_webkit_focus_ && has_content_area_focus_; | 1055 return has_webkit_focus_ && has_content_area_focus_; |
| 1054 } | 1056 } |
| 1055 | 1057 |
| 1058 bool PluginInstance::IsAcceptingTouchEvents() const { |
| 1059 return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH) || |
| 1060 (input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH); |
| 1061 } |
| 1062 |
| 1056 void PluginInstance::ScheduleAsyncDidChangeView( | 1063 void PluginInstance::ScheduleAsyncDidChangeView( |
| 1057 const ::ppapi::ViewData& previous_view) { | 1064 const ::ppapi::ViewData& previous_view) { |
| 1058 if (view_change_weak_ptr_factory_.HasWeakPtrs()) | 1065 if (view_change_weak_ptr_factory_.HasWeakPtrs()) |
| 1059 return; // Already scheduled. | 1066 return; // Already scheduled. |
| 1060 MessageLoop::current()->PostTask( | 1067 MessageLoop::current()->PostTask( |
| 1061 FROM_HERE, base::Bind(&PluginInstance::SendAsyncDidChangeView, | 1068 FROM_HERE, base::Bind(&PluginInstance::SendAsyncDidChangeView, |
| 1062 view_change_weak_ptr_factory_.GetWeakPtr(), | 1069 view_change_weak_ptr_factory_.GetWeakPtr(), |
| 1063 previous_view)); | 1070 previous_view)); |
| 1064 } | 1071 } |
| 1065 | 1072 |
| (...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1869 } | 1876 } |
| 1870 | 1877 |
| 1871 ::ppapi::thunk::PPB_Flash_API* PluginInstance::GetFlashAPI() { | 1878 ::ppapi::thunk::PPB_Flash_API* PluginInstance::GetFlashAPI() { |
| 1872 return &flash_impl_; | 1879 return &flash_impl_; |
| 1873 } | 1880 } |
| 1874 | 1881 |
| 1875 int32_t PluginInstance::RequestInputEvents(PP_Instance instance, | 1882 int32_t PluginInstance::RequestInputEvents(PP_Instance instance, |
| 1876 uint32_t event_classes) { | 1883 uint32_t event_classes) { |
| 1877 input_event_mask_ |= event_classes; | 1884 input_event_mask_ |= event_classes; |
| 1878 filtered_input_event_mask_ &= ~(event_classes); | 1885 filtered_input_event_mask_ &= ~(event_classes); |
| 1886 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH) |
| 1887 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents()); |
| 1879 return ValidateRequestInputEvents(false, event_classes); | 1888 return ValidateRequestInputEvents(false, event_classes); |
| 1880 } | 1889 } |
| 1881 | 1890 |
| 1882 int32_t PluginInstance::RequestFilteringInputEvents(PP_Instance instance, | 1891 int32_t PluginInstance::RequestFilteringInputEvents(PP_Instance instance, |
| 1883 uint32_t event_classes) { | 1892 uint32_t event_classes) { |
| 1884 filtered_input_event_mask_ |= event_classes; | 1893 filtered_input_event_mask_ |= event_classes; |
| 1885 input_event_mask_ &= ~(event_classes); | 1894 input_event_mask_ &= ~(event_classes); |
| 1895 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH) |
| 1896 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents()); |
| 1886 return ValidateRequestInputEvents(true, event_classes); | 1897 return ValidateRequestInputEvents(true, event_classes); |
| 1887 } | 1898 } |
| 1888 | 1899 |
| 1889 void PluginInstance::ClearInputEventRequest(PP_Instance instance, | 1900 void PluginInstance::ClearInputEventRequest(PP_Instance instance, |
| 1890 uint32_t event_classes) { | 1901 uint32_t event_classes) { |
| 1891 input_event_mask_ &= ~(event_classes); | 1902 input_event_mask_ &= ~(event_classes); |
| 1892 filtered_input_event_mask_ &= ~(event_classes); | 1903 filtered_input_event_mask_ &= ~(event_classes); |
| 1904 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH) |
| 1905 container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents()); |
| 1893 } | 1906 } |
| 1894 | 1907 |
| 1895 void PluginInstance::ZoomChanged(PP_Instance instance, double factor) { | 1908 void PluginInstance::ZoomChanged(PP_Instance instance, double factor) { |
| 1896 // We only want to tell the page to change its zoom if the whole page is the | 1909 // We only want to tell the page to change its zoom if the whole page is the |
| 1897 // plugin. If we're in an iframe, then don't do anything. | 1910 // plugin. If we're in an iframe, then don't do anything. |
| 1898 if (!IsFullPagePlugin()) | 1911 if (!IsFullPagePlugin()) |
| 1899 return; | 1912 return; |
| 1900 container()->zoomLevelChanged(WebView::zoomFactorToZoomLevel(factor)); | 1913 container()->zoomLevelChanged(WebView::zoomFactorToZoomLevel(factor)); |
| 1901 } | 1914 } |
| 1902 | 1915 |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2201 screen_size_for_fullscreen_ = gfx::Size(); | 2214 screen_size_for_fullscreen_ = gfx::Size(); |
| 2202 WebElement element = container_->element(); | 2215 WebElement element = container_->element(); |
| 2203 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2216 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
| 2204 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2217 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
| 2205 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2218 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
| 2206 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2219 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
| 2207 } | 2220 } |
| 2208 | 2221 |
| 2209 } // namespace ppapi | 2222 } // namespace ppapi |
| 2210 } // namespace webkit | 2223 } // namespace webkit |
| OLD | NEW |