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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 2931443003: Add support for Android spellcheck menu in Chrome/WebViews (Closed)
Patch Set: Consolidate mContentView and mContainerView Created 3 years, 5 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
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 "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
36 #include "components/viz/common/gl_helper.h" 36 #include "components/viz/common/gl_helper.h"
37 #include "components/viz/service/frame_sinks/frame_sink_manager.h" 37 #include "components/viz/service/frame_sinks/frame_sink_manager.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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 : host_(widget_host), 448 : host_(widget_host),
448 begin_frame_source_(nullptr), 449 begin_frame_source_(nullptr),
449 outstanding_begin_frame_requests_(0), 450 outstanding_begin_frame_requests_(0),
450 is_showing_(!widget_host->is_hidden()), 451 is_showing_(!widget_host->is_hidden()),
451 is_window_visible_(true), 452 is_window_visible_(true),
452 is_window_activity_started_(true), 453 is_window_activity_started_(true),
453 is_in_vr_(false), 454 is_in_vr_(false),
454 content_view_core_(nullptr), 455 content_view_core_(nullptr),
455 ime_adapter_android_(nullptr), 456 ime_adapter_android_(nullptr),
456 selection_popup_controller_(nullptr), 457 selection_popup_controller_(nullptr),
458 text_suggestion_host_(nullptr),
457 background_color_(SK_ColorWHITE), 459 background_color_(SK_ColorWHITE),
458 cached_background_color_(SK_ColorWHITE), 460 cached_background_color_(SK_ColorWHITE),
459 view_(this), 461 view_(this),
460 gesture_provider_(ui::GetGestureProviderConfig( 462 gesture_provider_(ui::GetGestureProviderConfig(
461 ui::GestureProviderConfigType::CURRENT_PLATFORM), 463 ui::GestureProviderConfigType::CURRENT_PLATFORM),
462 this), 464 this),
463 stylus_text_selector_(this), 465 stylus_text_selector_(this),
464 using_browser_compositor_(CompositorImpl::IsInitialized()), 466 using_browser_compositor_(CompositorImpl::IsInitialized()),
465 synchronous_compositor_client_(nullptr), 467 synchronous_compositor_client_(nullptr),
466 frame_evictor_(new viz::FrameEvictor(this)), 468 frame_evictor_(new viz::FrameEvictor(this)),
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 return weak_ptr_factory_.GetWeakPtr(); 943 return weak_ptr_factory_.GetWeakPtr();
942 } 944 }
943 945
944 bool RenderWidgetHostViewAndroid::OnTouchEvent( 946 bool RenderWidgetHostViewAndroid::OnTouchEvent(
945 const ui::MotionEvent& event) { 947 const ui::MotionEvent& event) {
946 if (!host_ || !host_->delegate()) 948 if (!host_ || !host_->delegate())
947 return false; 949 return false;
948 950
949 ComputeEventLatencyOSTouchHistograms(event); 951 ComputeEventLatencyOSTouchHistograms(event);
950 952
953 // Receiving any other touch event before the double-tap timeout expires
954 // cancels opening the spellcheck menu.
955 if (text_suggestion_host_)
956 text_suggestion_host_->StopSpellCheckMenuTimer();
957
951 // If a browser-based widget consumes the touch event, it's critical that 958 // If a browser-based widget consumes the touch event, it's critical that
952 // touch event interception be disabled. This avoids issues with 959 // touch event interception be disabled. This avoids issues with
953 // double-handling for embedder-detected gestures like side swipe. 960 // double-handling for embedder-detected gestures like side swipe.
954 if (touch_selection_controller_ && 961 if (touch_selection_controller_ &&
955 touch_selection_controller_->WillHandleTouchEvent(event)) { 962 touch_selection_controller_->WillHandleTouchEvent(event)) {
956 RequestDisallowInterceptTouchEvent(); 963 RequestDisallowInterceptTouchEvent();
957 return true; 964 return true;
958 } 965 }
959 966
960 if (stylus_text_selector_.OnTouchEvent(event)) { 967 if (stylus_text_selector_.OnTouchEvent(event)) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 void RenderWidgetHostViewAndroid::SetMultiTouchZoomSupportEnabled( 1047 void RenderWidgetHostViewAndroid::SetMultiTouchZoomSupportEnabled(
1041 bool enabled) { 1048 bool enabled) {
1042 gesture_provider_.SetMultiTouchZoomSupportEnabled(enabled); 1049 gesture_provider_.SetMultiTouchZoomSupportEnabled(enabled);
1043 } 1050 }
1044 1051
1045 void RenderWidgetHostViewAndroid::FocusedNodeChanged( 1052 void RenderWidgetHostViewAndroid::FocusedNodeChanged(
1046 bool is_editable_node, 1053 bool is_editable_node,
1047 const gfx::Rect& node_bounds_in_screen) { 1054 const gfx::Rect& node_bounds_in_screen) {
1048 if (ime_adapter_android_) 1055 if (ime_adapter_android_)
1049 ime_adapter_android_->FocusedNodeChanged(is_editable_node); 1056 ime_adapter_android_->FocusedNodeChanged(is_editable_node);
1057 if (text_suggestion_host_)
1058 text_suggestion_host_->FocusedNodeChanged();
1050 } 1059 }
1051 1060
1052 void RenderWidgetHostViewAndroid::RenderProcessGone( 1061 void RenderWidgetHostViewAndroid::RenderProcessGone(
1053 base::TerminationStatus status, int error_code) { 1062 base::TerminationStatus status, int error_code) {
1054 Destroy(); 1063 Destroy();
1055 } 1064 }
1056 1065
1057 void RenderWidgetHostViewAndroid::Destroy() { 1066 void RenderWidgetHostViewAndroid::Destroy() {
1058 host_->ViewDestroyed(); 1067 host_->ViewDestroyed();
1059 SetContentViewCore(NULL); 1068 SetContentViewCore(NULL);
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 1802
1794 RenderWidgetHostImpl* target_host = host_; 1803 RenderWidgetHostImpl* target_host = host_;
1795 1804
1796 // If there are multiple widgets on the page (such as when there are 1805 // If there are multiple widgets on the page (such as when there are
1797 // out-of-process iframes), pick the one that should process this event. 1806 // out-of-process iframes), pick the one that should process this event.
1798 if (host_->delegate()) 1807 if (host_->delegate())
1799 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); 1808 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_);
1800 if (!target_host) 1809 if (!target_host)
1801 return; 1810 return;
1802 1811
1812 // Receiving a key event before the double-tap timeout expires cancels opening
1813 // the spellcheck menu. If the suggestion menu is open, we close the menu.
1814 if (text_suggestion_host_)
1815 text_suggestion_host_->OnKeyEvent();
1816
1803 ui::LatencyInfo latency_info; 1817 ui::LatencyInfo latency_info;
1804 if (event.GetType() == blink::WebInputEvent::kRawKeyDown || 1818 if (event.GetType() == blink::WebInputEvent::kRawKeyDown ||
1805 event.GetType() == blink::WebInputEvent::kChar) { 1819 event.GetType() == blink::WebInputEvent::kChar) {
1806 latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS); 1820 latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS);
1807 } 1821 }
1808 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 1822 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
1809 target_host->ForwardKeyboardEventWithLatencyInfo(event, latency_info); 1823 target_host->ForwardKeyboardEventWithLatencyInfo(event, latency_info);
1810 } 1824 }
1811 1825
1812 void RenderWidgetHostViewAndroid::SendMouseEvent( 1826 void RenderWidgetHostViewAndroid::SendMouseEvent(
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
2360 2374
2361 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); 2375 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor();
2362 if (!compositor) 2376 if (!compositor)
2363 return; 2377 return;
2364 2378
2365 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( 2379 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>(
2366 overscroll_refresh_handler, compositor, view_.GetDipScale()); 2380 overscroll_refresh_handler, compositor, view_.GetDipScale());
2367 } 2381 }
2368 2382
2369 } // namespace content 2383 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698