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/browser/renderer_host/render_widget_host_view_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "components/viz/service/surfaces/surface.h" | 36 #include "components/viz/service/surfaces/surface.h" |
37 #include "components/viz/service/surfaces/surface_hittest.h" | 37 #include "components/viz/service/surfaces/surface_hittest.h" |
38 #include "content/browser/accessibility/browser_accessibility_manager_android.h" | 38 #include "content/browser/accessibility/browser_accessibility_manager_android.h" |
39 #include "content/browser/accessibility/web_contents_accessibility_android.h" | 39 #include "content/browser/accessibility/web_contents_accessibility_android.h" |
40 #include "content/browser/android/composited_touch_handle_drawable.h" | 40 #include "content/browser/android/composited_touch_handle_drawable.h" |
41 #include "content/browser/android/content_view_core.h" | 41 #include "content/browser/android/content_view_core.h" |
42 #include "content/browser/android/ime_adapter_android.h" | 42 #include "content/browser/android/ime_adapter_android.h" |
43 #include "content/browser/android/overscroll_controller_android.h" | 43 #include "content/browser/android/overscroll_controller_android.h" |
44 #include "content/browser/android/selection_popup_controller.h" | 44 #include "content/browser/android/selection_popup_controller.h" |
45 #include "content/browser/android/synchronous_compositor_host.h" | 45 #include "content/browser/android/synchronous_compositor_host.h" |
| 46 #include "content/browser/android/text_suggestion_host_android.h" |
46 #include "content/browser/compositor/surface_utils.h" | 47 #include "content/browser/compositor/surface_utils.h" |
47 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 48 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
48 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 49 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
49 #include "content/browser/gpu/compositor_util.h" | 50 #include "content/browser/gpu/compositor_util.h" |
50 #include "content/browser/gpu/gpu_data_manager_impl.h" | 51 #include "content/browser/gpu/gpu_data_manager_impl.h" |
51 #include "content/browser/gpu/gpu_process_host.h" | 52 #include "content/browser/gpu/gpu_process_host.h" |
52 #include "content/browser/media/android/media_web_contents_observer_android.h" | 53 #include "content/browser/media/android/media_web_contents_observer_android.h" |
53 #include "content/browser/renderer_host/compositor_impl_android.h" | 54 #include "content/browser/renderer_host/compositor_impl_android.h" |
54 #include "content/browser/renderer_host/dip_util.h" | 55 #include "content/browser/renderer_host/dip_util.h" |
55 #include "content/browser/renderer_host/frame_metadata_util.h" | 56 #include "content/browser/renderer_host/frame_metadata_util.h" |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 : host_(widget_host), | 449 : host_(widget_host), |
449 begin_frame_source_(nullptr), | 450 begin_frame_source_(nullptr), |
450 outstanding_begin_frame_requests_(0), | 451 outstanding_begin_frame_requests_(0), |
451 is_showing_(!widget_host->is_hidden()), | 452 is_showing_(!widget_host->is_hidden()), |
452 is_window_visible_(true), | 453 is_window_visible_(true), |
453 is_window_activity_started_(true), | 454 is_window_activity_started_(true), |
454 is_in_vr_(false), | 455 is_in_vr_(false), |
455 content_view_core_(nullptr), | 456 content_view_core_(nullptr), |
456 ime_adapter_android_(nullptr), | 457 ime_adapter_android_(nullptr), |
457 selection_popup_controller_(nullptr), | 458 selection_popup_controller_(nullptr), |
| 459 text_suggestion_host_(nullptr), |
458 background_color_(SK_ColorWHITE), | 460 background_color_(SK_ColorWHITE), |
459 cached_background_color_(SK_ColorWHITE), | 461 cached_background_color_(SK_ColorWHITE), |
460 view_(this), | 462 view_(this), |
461 gesture_provider_(ui::GetGestureProviderConfig( | 463 gesture_provider_(ui::GetGestureProviderConfig( |
462 ui::GestureProviderConfigType::CURRENT_PLATFORM), | 464 ui::GestureProviderConfigType::CURRENT_PLATFORM), |
463 this), | 465 this), |
464 stylus_text_selector_(this), | 466 stylus_text_selector_(this), |
465 using_browser_compositor_(CompositorImpl::IsInitialized()), | 467 using_browser_compositor_(CompositorImpl::IsInitialized()), |
466 synchronous_compositor_client_(nullptr), | 468 synchronous_compositor_client_(nullptr), |
467 frame_evictor_(new viz::FrameEvictor(this)), | 469 frame_evictor_(new viz::FrameEvictor(this)), |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
958 return weak_ptr_factory_.GetWeakPtr(); | 960 return weak_ptr_factory_.GetWeakPtr(); |
959 } | 961 } |
960 | 962 |
961 bool RenderWidgetHostViewAndroid::OnTouchEvent( | 963 bool RenderWidgetHostViewAndroid::OnTouchEvent( |
962 const ui::MotionEvent& event) { | 964 const ui::MotionEvent& event) { |
963 if (!host_ || !host_->delegate()) | 965 if (!host_ || !host_->delegate()) |
964 return false; | 966 return false; |
965 | 967 |
966 ComputeEventLatencyOSTouchHistograms(event); | 968 ComputeEventLatencyOSTouchHistograms(event); |
967 | 969 |
| 970 // Receiving any other touch event before the double-tap timeout expires |
| 971 // cancels opening the spellcheck menu. |
| 972 if (text_suggestion_host_) |
| 973 text_suggestion_host_->StopSpellCheckMenuTimer(); |
| 974 |
968 // If a browser-based widget consumes the touch event, it's critical that | 975 // If a browser-based widget consumes the touch event, it's critical that |
969 // touch event interception be disabled. This avoids issues with | 976 // touch event interception be disabled. This avoids issues with |
970 // double-handling for embedder-detected gestures like side swipe. | 977 // double-handling for embedder-detected gestures like side swipe. |
971 if (touch_selection_controller_ && | 978 if (touch_selection_controller_ && |
972 touch_selection_controller_->WillHandleTouchEvent(event)) { | 979 touch_selection_controller_->WillHandleTouchEvent(event)) { |
973 RequestDisallowInterceptTouchEvent(); | 980 RequestDisallowInterceptTouchEvent(); |
974 return true; | 981 return true; |
975 } | 982 } |
976 | 983 |
977 if (stylus_text_selector_.OnTouchEvent(event)) { | 984 if (stylus_text_selector_.OnTouchEvent(event)) { |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 | 1826 |
1820 RenderWidgetHostImpl* target_host = host_; | 1827 RenderWidgetHostImpl* target_host = host_; |
1821 | 1828 |
1822 // If there are multiple widgets on the page (such as when there are | 1829 // If there are multiple widgets on the page (such as when there are |
1823 // out-of-process iframes), pick the one that should process this event. | 1830 // out-of-process iframes), pick the one that should process this event. |
1824 if (host_->delegate()) | 1831 if (host_->delegate()) |
1825 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); | 1832 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); |
1826 if (!target_host) | 1833 if (!target_host) |
1827 return; | 1834 return; |
1828 | 1835 |
| 1836 // Receiving a key event before the double-tap timeout expires cancels opening |
| 1837 // the spellcheck menu. If the suggestion menu is open, we close the menu. |
| 1838 if (text_suggestion_host_) |
| 1839 text_suggestion_host_->OnKeyEvent(); |
| 1840 |
1829 ui::LatencyInfo latency_info; | 1841 ui::LatencyInfo latency_info; |
1830 if (event.GetType() == blink::WebInputEvent::kRawKeyDown || | 1842 if (event.GetType() == blink::WebInputEvent::kRawKeyDown || |
1831 event.GetType() == blink::WebInputEvent::kChar) { | 1843 event.GetType() == blink::WebInputEvent::kChar) { |
1832 latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS); | 1844 latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS); |
1833 } | 1845 } |
1834 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); | 1846 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); |
1835 target_host->ForwardKeyboardEventWithLatencyInfo(event, latency_info); | 1847 target_host->ForwardKeyboardEventWithLatencyInfo(event, latency_info); |
1836 } | 1848 } |
1837 | 1849 |
1838 void RenderWidgetHostViewAndroid::SendMouseEvent( | 1850 void RenderWidgetHostViewAndroid::SendMouseEvent( |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2400 | 2412 |
2401 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2413 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
2402 if (!compositor) | 2414 if (!compositor) |
2403 return; | 2415 return; |
2404 | 2416 |
2405 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2417 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
2406 overscroll_refresh_handler, compositor, view_.GetDipScale()); | 2418 overscroll_refresh_handler, compositor, view_.GetDipScale()); |
2407 } | 2419 } |
2408 | 2420 |
2409 } // namespace content | 2421 } // namespace content |
OLD | NEW |