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 "content/renderer/pepper/pepper_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bit_cast.h" | 10 #include "base/bit_cast.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
172 using blink::WebScopedUserGesture; | 172 using blink::WebScopedUserGesture; |
173 using blink::WebString; | 173 using blink::WebString; |
174 using blink::WebURLError; | 174 using blink::WebURLError; |
175 using blink::WebURLLoader; | 175 using blink::WebURLLoader; |
176 using blink::WebURLLoaderClient; | 176 using blink::WebURLLoaderClient; |
177 using blink::WebURLRequest; | 177 using blink::WebURLRequest; |
178 using blink::WebURLResponse; | 178 using blink::WebURLResponse; |
179 using blink::WebUserGestureIndicator; | 179 using blink::WebUserGestureIndicator; |
180 using blink::WebUserGestureToken; | 180 using blink::WebUserGestureToken; |
181 using blink::WebView; | 181 using blink::WebView; |
182 using blink::WebWidget; | |
182 | 183 |
183 namespace content { | 184 namespace content { |
184 | 185 |
185 namespace { | 186 namespace { |
186 | 187 |
187 #define STATIC_ASSERT_ENUM(a, b) \ | 188 #define STATIC_ASSERT_ENUM(a, b) \ |
188 static_assert(static_cast<int>(a) == static_cast<int>(b), \ | 189 static_assert(static_cast<int>(a) == static_cast<int>(b), \ |
189 "mismatching enums: " #a) | 190 "mismatching enums: " #a) |
190 | 191 |
191 // Check PP_TextInput_Type and ui::TextInputType are kept in sync. | 192 // Check PP_TextInput_Type and ui::TextInputType are kept in sync. |
(...skipping 1991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2183 | 2184 |
2184 void PepperPluginInstanceImpl::HandleMouseLockedInputEvent( | 2185 void PepperPluginInstanceImpl::HandleMouseLockedInputEvent( |
2185 const blink::WebMouseEvent& event) { | 2186 const blink::WebMouseEvent& event) { |
2186 // |cursor_info| is ignored since it is hidden when the mouse is locked. | 2187 // |cursor_info| is ignored since it is hidden when the mouse is locked. |
2187 blink::WebCursorInfo cursor_info; | 2188 blink::WebCursorInfo cursor_info; |
2188 HandleInputEvent(event, &cursor_info); | 2189 HandleInputEvent(event, &cursor_info); |
2189 } | 2190 } |
2190 | 2191 |
2191 void PepperPluginInstanceImpl::SimulateInputEvent( | 2192 void PepperPluginInstanceImpl::SimulateInputEvent( |
2192 const InputEventData& input_event) { | 2193 const InputEventData& input_event) { |
2193 WebView* web_view = container()->document().frame()->view(); | 2194 WebWidget* widget = |
2194 if (!web_view) { | 2195 container()->document().frame()->localRoot()->frameWidget(); |
alexmos
2016/07/07 21:17:19
This function didn't work in OOPIF processes, sinc
| |
2196 if (!widget) { | |
2195 NOTREACHED(); | 2197 NOTREACHED(); |
2196 return; | 2198 return; |
2197 } | 2199 } |
2198 | 2200 |
2199 bool handled = SimulateIMEEvent(input_event); | 2201 bool handled = SimulateIMEEvent(input_event); |
2200 if (handled) | 2202 if (handled) |
2201 return; | 2203 return; |
2202 | 2204 |
2203 std::vector<std::unique_ptr<WebInputEvent>> events = | 2205 std::vector<std::unique_ptr<WebInputEvent>> events = |
2204 CreateSimulatedWebInputEvents( | 2206 CreateSimulatedWebInputEvents( |
2205 input_event, view_data_.rect.point.x + view_data_.rect.size.width / 2, | 2207 input_event, view_data_.rect.point.x + view_data_.rect.size.width / 2, |
2206 view_data_.rect.point.y + view_data_.rect.size.height / 2); | 2208 view_data_.rect.point.y + view_data_.rect.size.height / 2); |
2207 for (std::vector<std::unique_ptr<WebInputEvent>>::iterator it = | 2209 for (std::vector<std::unique_ptr<WebInputEvent>>::iterator it = |
2208 events.begin(); | 2210 events.begin(); |
2209 it != events.end(); ++it) { | 2211 it != events.end(); ++it) { |
2210 web_view->handleInputEvent(*it->get()); | 2212 widget->handleInputEvent(*it->get()); |
2211 } | 2213 } |
2212 } | 2214 } |
2213 | 2215 |
2214 bool PepperPluginInstanceImpl::SimulateIMEEvent( | 2216 bool PepperPluginInstanceImpl::SimulateIMEEvent( |
2215 const InputEventData& input_event) { | 2217 const InputEventData& input_event) { |
2216 switch (input_event.event_type) { | 2218 switch (input_event.event_type) { |
2217 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_START: | 2219 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_START: |
2218 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE: | 2220 case PP_INPUTEVENT_TYPE_IME_COMPOSITION_UPDATE: |
2219 SimulateImeSetCompositionEvent(input_event); | 2221 SimulateImeSetCompositionEvent(input_event); |
2220 break; | 2222 break; |
(...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3417 const cc::TextureMailbox& mailbox) const { | 3419 const cc::TextureMailbox& mailbox) const { |
3418 auto it = | 3420 auto it = |
3419 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), | 3421 std::find_if(texture_ref_counts_.begin(), texture_ref_counts_.end(), |
3420 [&mailbox](const TextureMailboxRefCount& ref_count) { | 3422 [&mailbox](const TextureMailboxRefCount& ref_count) { |
3421 return ref_count.first.mailbox() == mailbox.mailbox(); | 3423 return ref_count.first.mailbox() == mailbox.mailbox(); |
3422 }); | 3424 }); |
3423 return it != texture_ref_counts_.end(); | 3425 return it != texture_ref_counts_.end(); |
3424 } | 3426 } |
3425 | 3427 |
3426 } // namespace content | 3428 } // namespace content |
OLD | NEW |