| 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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 : host_(widget_host), | 440 : host_(widget_host), |
| 441 begin_frame_source_(nullptr), | 441 begin_frame_source_(nullptr), |
| 442 outstanding_begin_frame_requests_(0), | 442 outstanding_begin_frame_requests_(0), |
| 443 is_showing_(!widget_host->is_hidden()), | 443 is_showing_(!widget_host->is_hidden()), |
| 444 is_window_visible_(true), | 444 is_window_visible_(true), |
| 445 is_window_activity_started_(true), | 445 is_window_activity_started_(true), |
| 446 is_showing_overscroll_glow_(true), | 446 is_showing_overscroll_glow_(true), |
| 447 content_view_core_(nullptr), | 447 content_view_core_(nullptr), |
| 448 ime_adapter_android_(this), | 448 ime_adapter_android_(this), |
| 449 cached_background_color_(SK_ColorWHITE), | 449 cached_background_color_(SK_ColorWHITE), |
| 450 view_(this), |
| 450 last_compositor_frame_sink_id_(kUndefinedCompositorFrameSinkId), | 451 last_compositor_frame_sink_id_(kUndefinedCompositorFrameSinkId), |
| 451 gesture_provider_(ui::GetGestureProviderConfig( | 452 gesture_provider_(ui::GetGestureProviderConfig( |
| 452 ui::GestureProviderConfigType::CURRENT_PLATFORM), | 453 ui::GestureProviderConfigType::CURRENT_PLATFORM), |
| 453 this), | 454 this), |
| 454 stylus_text_selector_(this), | 455 stylus_text_selector_(this), |
| 455 using_browser_compositor_(CompositorImpl::IsInitialized()), | 456 using_browser_compositor_(CompositorImpl::IsInitialized()), |
| 456 synchronous_compositor_client_(nullptr), | 457 synchronous_compositor_client_(nullptr), |
| 457 frame_evictor_(new DelegatedFrameEvictor(this)), | 458 frame_evictor_(new DelegatedFrameEvictor(this)), |
| 458 locks_on_frame_count_(0), | 459 locks_on_frame_count_(0), |
| 459 observing_root_window_(false), | 460 observing_root_window_(false), |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 817 | 818 |
| 818 void RenderWidgetHostViewAndroid::SetNeedsBeginFrames(bool needs_begin_frames) { | 819 void RenderWidgetHostViewAndroid::SetNeedsBeginFrames(bool needs_begin_frames) { |
| 819 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SetNeedsBeginFrames", | 820 TRACE_EVENT1("cc", "RenderWidgetHostViewAndroid::SetNeedsBeginFrames", |
| 820 "needs_begin_frames", needs_begin_frames); | 821 "needs_begin_frames", needs_begin_frames); |
| 821 if (needs_begin_frames) | 822 if (needs_begin_frames) |
| 822 AddBeginFrameRequest(PERSISTENT_BEGIN_FRAME); | 823 AddBeginFrameRequest(PERSISTENT_BEGIN_FRAME); |
| 823 else | 824 else |
| 824 ClearBeginFrameRequest(PERSISTENT_BEGIN_FRAME); | 825 ClearBeginFrameRequest(PERSISTENT_BEGIN_FRAME); |
| 825 } | 826 } |
| 826 | 827 |
| 828 bool RenderWidgetHostViewAndroid::OnTouchEvent( |
| 829 const ui::MotionEventAndroid& event, |
| 830 bool is_touch_handle_event) { |
| 831 return is_touch_handle_event ? ProcessTouchHandleEvent(event) |
| 832 : ProcessTouchEvent(event); |
| 833 } |
| 834 |
| 827 void RenderWidgetHostViewAndroid::OnStartContentIntent( | 835 void RenderWidgetHostViewAndroid::OnStartContentIntent( |
| 828 const GURL& content_url, bool is_main_frame) { | 836 const GURL& content_url, bool is_main_frame) { |
| 829 if (content_view_core_) | 837 if (content_view_core_) |
| 830 content_view_core_->StartContentIntent(content_url, is_main_frame); | 838 content_view_core_->StartContentIntent(content_url, is_main_frame); |
| 831 } | 839 } |
| 832 | 840 |
| 833 void RenderWidgetHostViewAndroid::OnSmartClipDataExtracted( | 841 void RenderWidgetHostViewAndroid::OnSmartClipDataExtracted( |
| 834 const base::string16& text, | 842 const base::string16& text, |
| 835 const base::string16& html, | 843 const base::string16& html, |
| 836 const gfx::Rect rect) { | 844 const gfx::Rect rect) { |
| 837 if (content_view_core_) | 845 if (content_view_core_) |
| 838 content_view_core_->OnSmartClipDataExtracted(text, html, rect); | 846 content_view_core_->OnSmartClipDataExtracted(text, html, rect); |
| 839 } | 847 } |
| 840 | 848 |
| 841 bool RenderWidgetHostViewAndroid::OnTouchEvent( | 849 bool RenderWidgetHostViewAndroid::ProcessTouchEvent( |
| 842 const ui::MotionEvent& event) { | 850 const ui::MotionEvent& event) { |
| 843 if (!host_) | 851 if (!host_) |
| 844 return false; | 852 return false; |
| 845 | 853 |
| 846 ComputeEventLatencyOSTouchHistograms(event); | 854 ComputeEventLatencyOSTouchHistograms(event); |
| 847 | 855 |
| 848 // If a browser-based widget consumes the touch event, it's critical that | 856 // If a browser-based widget consumes the touch event, it's critical that |
| 849 // touch event interception be disabled. This avoids issues with | 857 // touch event interception be disabled. This avoids issues with |
| 850 // double-handling for embedder-detected gestures like side swipe. | 858 // double-handling for embedder-detected gestures like side swipe. |
| 851 if (selection_controller_ && | 859 if (selection_controller_ && |
| (...skipping 21 matching lines...) Expand all Loading... |
| 873 // Send a proactive BeginFrame for this vsync to reduce scroll latency for | 881 // Send a proactive BeginFrame for this vsync to reduce scroll latency for |
| 874 // scroll-inducing touch events. Note that Android's Choreographer ensures | 882 // scroll-inducing touch events. Note that Android's Choreographer ensures |
| 875 // that BeginFrame requests made during ACTION_MOVE dispatch will be honored | 883 // that BeginFrame requests made during ACTION_MOVE dispatch will be honored |
| 876 // in the same vsync phase. | 884 // in the same vsync phase. |
| 877 if (observing_root_window_ && result.moved_beyond_slop_region) | 885 if (observing_root_window_ && result.moved_beyond_slop_region) |
| 878 AddBeginFrameRequest(BEGIN_FRAME); | 886 AddBeginFrameRequest(BEGIN_FRAME); |
| 879 | 887 |
| 880 return true; | 888 return true; |
| 881 } | 889 } |
| 882 | 890 |
| 883 bool RenderWidgetHostViewAndroid::OnTouchHandleEvent( | 891 bool RenderWidgetHostViewAndroid::ProcessTouchHandleEvent( |
| 884 const ui::MotionEvent& event) { | 892 const ui::MotionEvent& event) { |
| 885 return selection_controller_ && | 893 return selection_controller_ && |
| 886 selection_controller_->WillHandleTouchEvent(event); | 894 selection_controller_->WillHandleTouchEvent(event); |
| 887 } | 895 } |
| 888 | 896 |
| 889 void RenderWidgetHostViewAndroid::ResetGestureDetection() { | 897 void RenderWidgetHostViewAndroid::ResetGestureDetection() { |
| 890 const ui::MotionEvent* current_down_event = | 898 const ui::MotionEvent* current_down_event = |
| 891 gesture_provider_.GetCurrentDownEvent(); | 899 gesture_provider_.GetCurrentDownEvent(); |
| 892 if (!current_down_event) { | 900 if (!current_down_event) { |
| 893 // A hard reset ensures prevention of any timer-based events that might fire | 901 // A hard reset ensures prevention of any timer-based events that might fire |
| (...skipping 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2083 if (!compositor) | 2091 if (!compositor) |
| 2084 return; | 2092 return; |
| 2085 | 2093 |
| 2086 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2094 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
| 2087 overscroll_refresh_handler, compositor, | 2095 overscroll_refresh_handler, compositor, |
| 2088 ui::GetScaleFactorForNativeView(GetNativeView())); | 2096 ui::GetScaleFactorForNativeView(GetNativeView())); |
| 2089 is_showing_overscroll_glow_ = true; | 2097 is_showing_overscroll_glow_ = true; |
| 2090 } | 2098 } |
| 2091 | 2099 |
| 2092 } // namespace content | 2100 } // namespace content |
| OLD | NEW |