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

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: Actually split off LayoutTheme changes Created 3 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
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 "cc/trees/layer_tree_host.h" 36 #include "cc/trees/layer_tree_host.h"
37 #include "components/viz/service/display_compositor/gl_helper.h" 37 #include "components/viz/service/display_compositor/gl_helper.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_impl.h" 41 #include "content/browser/android/content_view_core_impl.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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 latest_confirmed_begin_frame_sequence_number_( 446 latest_confirmed_begin_frame_sequence_number_(
446 cc::BeginFrameArgs::kInvalidFrameNumber), 447 cc::BeginFrameArgs::kInvalidFrameNumber),
447 outstanding_begin_frame_requests_(0), 448 outstanding_begin_frame_requests_(0),
448 is_showing_(!widget_host->is_hidden()), 449 is_showing_(!widget_host->is_hidden()),
449 is_window_visible_(true), 450 is_window_visible_(true),
450 is_window_activity_started_(true), 451 is_window_activity_started_(true),
451 is_in_vr_(false), 452 is_in_vr_(false),
452 content_view_core_(nullptr), 453 content_view_core_(nullptr),
453 ime_adapter_android_(nullptr), 454 ime_adapter_android_(nullptr),
454 selection_popup_controller_(nullptr), 455 selection_popup_controller_(nullptr),
456 text_suggestion_host_(nullptr),
455 background_color_(SK_ColorWHITE), 457 background_color_(SK_ColorWHITE),
456 cached_background_color_(SK_ColorWHITE), 458 cached_background_color_(SK_ColorWHITE),
457 view_(this), 459 view_(this),
458 gesture_provider_(ui::GetGestureProviderConfig( 460 gesture_provider_(ui::GetGestureProviderConfig(
459 ui::GestureProviderConfigType::CURRENT_PLATFORM), 461 ui::GestureProviderConfigType::CURRENT_PLATFORM),
460 this), 462 this),
461 stylus_text_selector_(this), 463 stylus_text_selector_(this),
462 using_browser_compositor_(CompositorImpl::IsInitialized()), 464 using_browser_compositor_(CompositorImpl::IsInitialized()),
463 synchronous_compositor_client_(nullptr), 465 synchronous_compositor_client_(nullptr),
464 frame_evictor_(new viz::FrameEvictor(this)), 466 frame_evictor_(new viz::FrameEvictor(this)),
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 return weak_ptr_factory_.GetWeakPtr(); 937 return weak_ptr_factory_.GetWeakPtr();
936 } 938 }
937 939
938 bool RenderWidgetHostViewAndroid::OnTouchEvent( 940 bool RenderWidgetHostViewAndroid::OnTouchEvent(
939 const ui::MotionEvent& event) { 941 const ui::MotionEvent& event) {
940 if (!host_ || !host_->delegate()) 942 if (!host_ || !host_->delegate())
941 return false; 943 return false;
942 944
943 ComputeEventLatencyOSTouchHistograms(event); 945 ComputeEventLatencyOSTouchHistograms(event);
944 946
947 // Receiving any other touch event before the double-tap timeout expires
948 // cancels opening the spellcheck menu.
949 if (text_suggestion_host_)
950 text_suggestion_host_->StopSpellCheckMenuTimer();
951
945 // If a browser-based widget consumes the touch event, it's critical that 952 // If a browser-based widget consumes the touch event, it's critical that
946 // touch event interception be disabled. This avoids issues with 953 // touch event interception be disabled. This avoids issues with
947 // double-handling for embedder-detected gestures like side swipe. 954 // double-handling for embedder-detected gestures like side swipe.
948 if (touch_selection_controller_ && 955 if (touch_selection_controller_ &&
949 touch_selection_controller_->WillHandleTouchEvent(event)) { 956 touch_selection_controller_->WillHandleTouchEvent(event)) {
950 RequestDisallowInterceptTouchEvent(); 957 RequestDisallowInterceptTouchEvent();
951 return true; 958 return true;
952 } 959 }
953 960
954 if (stylus_text_selector_.OnTouchEvent(event)) { 961 if (stylus_text_selector_.OnTouchEvent(event)) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 void RenderWidgetHostViewAndroid::SetMultiTouchZoomSupportEnabled( 1035 void RenderWidgetHostViewAndroid::SetMultiTouchZoomSupportEnabled(
1029 bool enabled) { 1036 bool enabled) {
1030 gesture_provider_.SetMultiTouchZoomSupportEnabled(enabled); 1037 gesture_provider_.SetMultiTouchZoomSupportEnabled(enabled);
1031 } 1038 }
1032 1039
1033 void RenderWidgetHostViewAndroid::FocusedNodeChanged( 1040 void RenderWidgetHostViewAndroid::FocusedNodeChanged(
1034 bool is_editable_node, 1041 bool is_editable_node,
1035 const gfx::Rect& node_bounds_in_screen) { 1042 const gfx::Rect& node_bounds_in_screen) {
1036 if (ime_adapter_android_) 1043 if (ime_adapter_android_)
1037 ime_adapter_android_->FocusedNodeChanged(is_editable_node); 1044 ime_adapter_android_->FocusedNodeChanged(is_editable_node);
1045 if (text_suggestion_host_)
1046 text_suggestion_host_->FocusedNodeChanged();
1038 } 1047 }
1039 1048
1040 void RenderWidgetHostViewAndroid::RenderProcessGone( 1049 void RenderWidgetHostViewAndroid::RenderProcessGone(
1041 base::TerminationStatus status, int error_code) { 1050 base::TerminationStatus status, int error_code) {
1042 Destroy(); 1051 Destroy();
1043 } 1052 }
1044 1053
1045 void RenderWidgetHostViewAndroid::Destroy() { 1054 void RenderWidgetHostViewAndroid::Destroy() {
1046 host_->ViewDestroyed(); 1055 host_->ViewDestroyed();
1047 SetContentViewCore(NULL); 1056 SetContentViewCore(NULL);
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1779 1788
1780 RenderWidgetHostImpl* target_host = host_; 1789 RenderWidgetHostImpl* target_host = host_;
1781 1790
1782 // If there are multiple widgets on the page (such as when there are 1791 // If there are multiple widgets on the page (such as when there are
1783 // out-of-process iframes), pick the one that should process this event. 1792 // out-of-process iframes), pick the one that should process this event.
1784 if (host_->delegate()) 1793 if (host_->delegate())
1785 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_); 1794 target_host = host_->delegate()->GetFocusedRenderWidgetHost(host_);
1786 if (!target_host) 1795 if (!target_host)
1787 return; 1796 return;
1788 1797
1798 // Receiving a key event before the double-tap timeout expires cancels opening
1799 // the spellcheck menu.
1800 if (text_suggestion_host_)
1801 text_suggestion_host_->StopSpellCheckMenuTimer();
1802
1789 ui::LatencyInfo latency_info; 1803 ui::LatencyInfo latency_info;
1790 if (event.GetType() == blink::WebInputEvent::kRawKeyDown || 1804 if (event.GetType() == blink::WebInputEvent::kRawKeyDown ||
1791 event.GetType() == blink::WebInputEvent::kChar) { 1805 event.GetType() == blink::WebInputEvent::kChar) {
1792 latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS); 1806 latency_info.set_source_event_type(ui::SourceEventType::KEY_PRESS);
1793 } 1807 }
1794 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 1808 latency_info.AddLatencyNumber(ui::INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
1795 target_host->ForwardKeyboardEventWithLatencyInfo(event, latency_info); 1809 target_host->ForwardKeyboardEventWithLatencyInfo(event, latency_info);
1796 } 1810 }
1797 1811
1798 void RenderWidgetHostViewAndroid::SendMouseEvent( 1812 void RenderWidgetHostViewAndroid::SendMouseEvent(
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
2276 2290
2277 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); 2291 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor();
2278 if (!compositor) 2292 if (!compositor)
2279 return; 2293 return;
2280 2294
2281 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( 2295 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>(
2282 overscroll_refresh_handler, compositor, view_.GetDipScale()); 2296 overscroll_refresh_handler, compositor, view_.GetDipScale());
2283 } 2297 }
2284 2298
2285 } // namespace content 2299 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698