OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/plugins/renderer/webview_plugin.h" | 5 #include "components/plugins/renderer/webview_plugin.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
10 #include "content/public/common/web_preferences.h" | 10 #include "content/public/common/web_preferences.h" |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 if (delegate_) | 193 if (delegate_) |
194 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); | 194 delegate_->OnUnobscuredRectUpdate(gfx::Rect(unobscured_rect)); |
195 } | 195 } |
196 | 196 |
197 void WebViewPlugin::updateFocus(bool focused, blink::WebFocusType focus_type) { | 197 void WebViewPlugin::updateFocus(bool focused, blink::WebFocusType focus_type) { |
198 focused_ = focused; | 198 focused_ = focused; |
199 } | 199 } |
200 | 200 |
201 bool WebViewPlugin::acceptsInputEvents() { return true; } | 201 bool WebViewPlugin::acceptsInputEvents() { return true; } |
202 | 202 |
203 bool WebViewPlugin::handleInputEvent(const WebInputEvent& event, | 203 blink::WebInputEventResult WebViewPlugin::handleInputEvent( |
204 WebCursorInfo& cursor) { | 204 const WebInputEvent& event, |
| 205 WebCursorInfo& cursor) { |
205 // For tap events, don't handle them. They will be converted to | 206 // For tap events, don't handle them. They will be converted to |
206 // mouse events later and passed to here. | 207 // mouse events later and passed to here. |
207 if (event.type == WebInputEvent::GestureTap) | 208 if (event.type == WebInputEvent::GestureTap) |
208 return false; | 209 return blink::WebInputEventResult::NotHandled; |
209 | 210 |
210 // For LongPress events we return false, since otherwise the context menu will | 211 // For LongPress events we return false, since otherwise the context menu will |
211 // be suppressed. https://crbug.com/482842 | 212 // be suppressed. https://crbug.com/482842 |
212 if (event.type == WebInputEvent::GestureLongPress) | 213 if (event.type == WebInputEvent::GestureLongPress) |
213 return false; | 214 return blink::WebInputEventResult::NotHandled; |
214 | 215 |
215 if (event.type == WebInputEvent::ContextMenu) { | 216 if (event.type == WebInputEvent::ContextMenu) { |
216 if (delegate_) { | 217 if (delegate_) { |
217 const WebMouseEvent& mouse_event = | 218 const WebMouseEvent& mouse_event = |
218 reinterpret_cast<const WebMouseEvent&>(event); | 219 reinterpret_cast<const WebMouseEvent&>(event); |
219 delegate_->ShowContextMenu(mouse_event); | 220 delegate_->ShowContextMenu(mouse_event); |
220 } | 221 } |
221 return true; | 222 return blink::WebInputEventResult::HandledSuppressed; |
222 } | 223 } |
223 current_cursor_ = cursor; | 224 current_cursor_ = cursor; |
224 bool handled = web_view_->handleInputEvent(event); | 225 blink::WebInputEventResult handled = web_view_->handleInputEvent(event); |
225 cursor = current_cursor_; | 226 cursor = current_cursor_; |
226 | 227 |
227 return handled; | 228 return handled; |
228 } | 229 } |
229 | 230 |
230 void WebViewPlugin::didReceiveResponse(const WebURLResponse& response) { | 231 void WebViewPlugin::didReceiveResponse(const WebURLResponse& response) { |
231 DCHECK(response_.isNull()); | 232 DCHECK(response_.isNull()); |
232 response_ = response; | 233 response_ = response; |
233 } | 234 } |
234 | 235 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 // By default RenderViewObservers are destroyed along with the RenderView. | 313 // By default RenderViewObservers are destroyed along with the RenderView. |
313 // WebViewPlugin has a custom destruction mechanism, so we disable this. | 314 // WebViewPlugin has a custom destruction mechanism, so we disable this. |
314 } | 315 } |
315 | 316 |
316 void WebViewPlugin::OnZoomLevelChanged() { | 317 void WebViewPlugin::OnZoomLevelChanged() { |
317 if (container_) { | 318 if (container_) { |
318 web_view_->setZoomLevel( | 319 web_view_->setZoomLevel( |
319 blink::WebView::zoomFactorToZoomLevel(container_->pageZoomFactor())); | 320 blink::WebView::zoomFactorToZoomLevel(container_->pageZoomFactor())); |
320 } | 321 } |
321 } | 322 } |
OLD | NEW |