| 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 "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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2276 | 2285 |
| 2277 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2286 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
| 2278 if (!compositor) | 2287 if (!compositor) |
| 2279 return; | 2288 return; |
| 2280 | 2289 |
| 2281 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2290 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
| 2282 overscroll_refresh_handler, compositor, view_.GetDipScale()); | 2291 overscroll_refresh_handler, compositor, view_.GetDipScale()); |
| 2283 } | 2292 } |
| 2284 | 2293 |
| 2285 } // namespace content | 2294 } // namespace content |
| OLD | NEW |