Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 10628020: webkit/ppapi: Notify the container when a plugin is accepting touch events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after
1676 underline.endOffset = offsets[i + 1]; 1676 underline.endOffset = offsets[i + 1];
1677 if (input_event.composition_target_segment == static_cast<int32_t>(i - 2)) 1677 if (input_event.composition_target_segment == static_cast<int32_t>(i - 2))
1678 underline.thick = true; 1678 underline.thick = true;
1679 underlines.push_back(underline); 1679 underlines.push_back(underline);
1680 } 1680 }
1681 1681
1682 delegate()->SimulateImeSetComposition( 1682 delegate()->SimulateImeSetComposition(
1683 utf16_text, underlines, offsets[0], offsets[1]); 1683 utf16_text, underlines, offsets[0], offsets[1]);
1684 } 1684 }
1685 1685
1686 bool PluginInstance::IsAcceptingTouchEvents() const {
1687 return (filtered_input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH) ||
1688 (input_event_mask_ & PP_INPUTEVENT_CLASS_TOUCH);
1689 }
1690
1686 void PluginInstance::ClosePendingUserGesture(PP_Instance instance, 1691 void PluginInstance::ClosePendingUserGesture(PP_Instance instance,
1687 PP_TimeTicks timestamp) { 1692 PP_TimeTicks timestamp) {
1688 // Close the pending user gesture if the plugin had a chance to respond. 1693 // Close the pending user gesture if the plugin had a chance to respond.
1689 // Don't close the pending user gesture if the timestamps are equal since 1694 // Don't close the pending user gesture if the timestamps are equal since
1690 // there may be multiple input events with the same timestamp. 1695 // there may be multiple input events with the same timestamp.
1691 if (timestamp > pending_user_gesture_) 1696 if (timestamp > pending_user_gesture_)
1692 pending_user_gesture_ = 0.0; 1697 pending_user_gesture_ = 0.0;
1693 } 1698 }
1694 1699
1695 PP_Bool PluginInstance::BindGraphics(PP_Instance instance, 1700 PP_Bool PluginInstance::BindGraphics(PP_Instance instance,
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 } 1874 }
1870 1875
1871 ::ppapi::thunk::PPB_Flash_API* PluginInstance::GetFlashAPI() { 1876 ::ppapi::thunk::PPB_Flash_API* PluginInstance::GetFlashAPI() {
1872 return &flash_impl_; 1877 return &flash_impl_;
1873 } 1878 }
1874 1879
1875 int32_t PluginInstance::RequestInputEvents(PP_Instance instance, 1880 int32_t PluginInstance::RequestInputEvents(PP_Instance instance,
1876 uint32_t event_classes) { 1881 uint32_t event_classes) {
1877 input_event_mask_ |= event_classes; 1882 input_event_mask_ |= event_classes;
1878 filtered_input_event_mask_ &= ~(event_classes); 1883 filtered_input_event_mask_ &= ~(event_classes);
1884 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH)
1885 container_->setAcceptingTouchEvents(IsAcceptingTouchEvents());
1879 return ValidateRequestInputEvents(false, event_classes); 1886 return ValidateRequestInputEvents(false, event_classes);
1880 } 1887 }
1881 1888
1882 int32_t PluginInstance::RequestFilteringInputEvents(PP_Instance instance, 1889 int32_t PluginInstance::RequestFilteringInputEvents(PP_Instance instance,
1883 uint32_t event_classes) { 1890 uint32_t event_classes) {
1884 filtered_input_event_mask_ |= event_classes; 1891 filtered_input_event_mask_ |= event_classes;
1885 input_event_mask_ &= ~(event_classes); 1892 input_event_mask_ &= ~(event_classes);
1893 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH)
1894 container_->setAcceptingTouchEvents(IsAcceptingTouchEvents());
1886 return ValidateRequestInputEvents(true, event_classes); 1895 return ValidateRequestInputEvents(true, event_classes);
1887 } 1896 }
1888 1897
1889 void PluginInstance::ClearInputEventRequest(PP_Instance instance, 1898 void PluginInstance::ClearInputEventRequest(PP_Instance instance,
1890 uint32_t event_classes) { 1899 uint32_t event_classes) {
1891 input_event_mask_ &= ~(event_classes); 1900 input_event_mask_ &= ~(event_classes);
1892 filtered_input_event_mask_ &= ~(event_classes); 1901 filtered_input_event_mask_ &= ~(event_classes);
1902 if (event_classes & PP_INPUTEVENT_CLASS_TOUCH)
1903 container_->setAcceptingTouchEvents(IsAcceptingTouchEvents());
1893 } 1904 }
1894 1905
1895 void PluginInstance::ZoomChanged(PP_Instance instance, double factor) { 1906 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 1907 // 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. 1908 // plugin. If we're in an iframe, then don't do anything.
1898 if (!IsFullPagePlugin()) 1909 if (!IsFullPagePlugin())
1899 return; 1910 return;
1900 container()->zoomLevelChanged(WebView::zoomFactorToZoomLevel(factor)); 1911 container()->zoomLevelChanged(WebView::zoomFactorToZoomLevel(factor));
1901 } 1912 }
1902 1913
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2201 screen_size_for_fullscreen_ = gfx::Size(); 2212 screen_size_for_fullscreen_ = gfx::Size();
2202 WebElement element = container_->element(); 2213 WebElement element = container_->element();
2203 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2214 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2204 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2215 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2205 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2216 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2206 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2217 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2207 } 2218 }
2208 2219
2209 } // namespace ppapi 2220 } // namespace ppapi
2210 } // namespace webkit 2221 } // namespace webkit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698