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

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

Issue 2528823002: Separate SwipeRefreshHandler and ContentViewCore (Closed)
Patch Set: Fix non-Android compile issue Created 4 years 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 #include "gpu/command_buffer/client/gles2_implementation.h" 70 #include "gpu/command_buffer/client/gles2_implementation.h"
71 #include "gpu/command_buffer/client/gles2_interface.h" 71 #include "gpu/command_buffer/client/gles2_interface.h"
72 #include "gpu/config/gpu_driver_bug_workaround_type.h" 72 #include "gpu/config/gpu_driver_bug_workaround_type.h"
73 #include "ipc/ipc_message_macros.h" 73 #include "ipc/ipc_message_macros.h"
74 #include "ipc/ipc_message_start.h" 74 #include "ipc/ipc_message_start.h"
75 #include "skia/ext/image_operations.h" 75 #include "skia/ext/image_operations.h"
76 #include "third_party/khronos/GLES2/gl2.h" 76 #include "third_party/khronos/GLES2/gl2.h"
77 #include "third_party/khronos/GLES2/gl2ext.h" 77 #include "third_party/khronos/GLES2/gl2ext.h"
78 #include "third_party/skia/include/core/SkCanvas.h" 78 #include "third_party/skia/include/core/SkCanvas.h"
79 #include "ui/android/delegated_frame_host_android.h" 79 #include "ui/android/delegated_frame_host_android.h"
80 #include "ui/android/overscroll_refresh_handler.h"
80 #include "ui/android/window_android.h" 81 #include "ui/android/window_android.h"
81 #include "ui/android/window_android_compositor.h" 82 #include "ui/android/window_android_compositor.h"
82 #include "ui/base/layout.h" 83 #include "ui/base/layout.h"
83 #include "ui/display/display.h" 84 #include "ui/display/display.h"
84 #include "ui/display/screen.h" 85 #include "ui/display/screen.h"
85 #include "ui/events/base_event_utils.h" 86 #include "ui/events/base_event_utils.h"
86 #include "ui/events/blink/blink_event_util.h" 87 #include "ui/events/blink/blink_event_util.h"
87 #include "ui/events/blink/did_overscroll_params.h" 88 #include "ui/events/blink/did_overscroll_params.h"
88 #include "ui/events/blink/web_input_event_traits.h" 89 #include "ui/events/blink/web_input_event_traits.h"
89 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" 90 #include "ui/events/gesture_detection/gesture_provider_config_helper.h"
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 config.enable_adaptive_handle_orientation = 331 config.enable_adaptive_handle_orientation =
331 base::CommandLine::ForCurrentProcess()->HasSwitch( 332 base::CommandLine::ForCurrentProcess()->HasSwitch(
332 switches::kEnableAdaptiveSelectionHandleOrientation); 333 switches::kEnableAdaptiveSelectionHandleOrientation);
333 config.enable_longpress_drag_selection = 334 config.enable_longpress_drag_selection =
334 base::CommandLine::ForCurrentProcess()->HasSwitch( 335 base::CommandLine::ForCurrentProcess()->HasSwitch(
335 switches::kEnableLongpressDragSelection); 336 switches::kEnableLongpressDragSelection);
336 return base::MakeUnique<ui::TouchSelectionController>(client, config); 337 return base::MakeUnique<ui::TouchSelectionController>(client, config);
337 } 338 }
338 339
339 std::unique_ptr<OverscrollControllerAndroid> CreateOverscrollController( 340 std::unique_ptr<OverscrollControllerAndroid> CreateOverscrollController(
341 ui::OverscrollRefreshHandler* overscroll_refresh_handler,
340 ContentViewCoreImpl* content_view_core, 342 ContentViewCoreImpl* content_view_core,
341 float dpi_scale) { 343 float dpi_scale) {
342 return base::MakeUnique<OverscrollControllerAndroid>(content_view_core, 344 return base::MakeUnique<OverscrollControllerAndroid>(
343 dpi_scale); 345 overscroll_refresh_handler,
346 content_view_core->GetWindowAndroid()->GetCompositor(), dpi_scale);
344 } 347 }
345 348
346 gfx::RectF GetSelectionRect(const ui::TouchSelectionController& controller) { 349 gfx::RectF GetSelectionRect(const ui::TouchSelectionController& controller) {
347 gfx::RectF rect = controller.GetRectBetweenBounds(); 350 gfx::RectF rect = controller.GetRectBetweenBounds();
348 if (rect.IsEmpty()) 351 if (rect.IsEmpty())
349 return rect; 352 return rect;
350 353
351 rect.Union(controller.GetStartHandleRect()); 354 rect.Union(controller.GetStartHandleRect());
352 rect.Union(controller.GetEndHandleRect()); 355 rect.Union(controller.GetEndHandleRect());
353 return rect; 356 return rect;
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1812 1815
1813 if (resize) 1816 if (resize)
1814 WasResized(); 1817 WasResized();
1815 1818
1816 if (!selection_controller_) 1819 if (!selection_controller_)
1817 selection_controller_ = CreateSelectionController(this, content_view_core_); 1820 selection_controller_ = CreateSelectionController(this, content_view_core_);
1818 1821
1819 if (!overscroll_controller_ && 1822 if (!overscroll_controller_ &&
1820 view_.GetWindowAndroid()->GetCompositor()) { 1823 view_.GetWindowAndroid()->GetCompositor()) {
1821 overscroll_controller_ = CreateOverscrollController( 1824 overscroll_controller_ = CreateOverscrollController(
1825 host_->delegate()->GetDelegateView()->GetOverscrollRefreshHandler(),
1822 content_view_core_, ui::GetScaleFactorForNativeView(GetNativeView())); 1826 content_view_core_, ui::GetScaleFactorForNativeView(GetNativeView()));
1823 } 1827 }
1824 } 1828 }
1825 1829
1826 void RenderWidgetHostViewAndroid::RunAckCallbacks() { 1830 void RenderWidgetHostViewAndroid::RunAckCallbacks() {
1827 while (!ack_callbacks_.empty()) { 1831 while (!ack_callbacks_.empty()) {
1828 ack_callbacks_.front().Run(); 1832 ack_callbacks_.front().Run();
1829 ack_callbacks_.pop(); 1833 ack_callbacks_.pop();
1830 } 1834 }
1831 } 1835 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1877 OnAttachCompositor(); 1881 OnAttachCompositor();
1878 } 1882 }
1879 1883
1880 void RenderWidgetHostViewAndroid::OnDetachedFromWindow() { 1884 void RenderWidgetHostViewAndroid::OnDetachedFromWindow() {
1881 StopObservingRootWindow(); 1885 StopObservingRootWindow();
1882 OnDetachCompositor(); 1886 OnDetachCompositor();
1883 } 1887 }
1884 1888
1885 void RenderWidgetHostViewAndroid::OnAttachCompositor() { 1889 void RenderWidgetHostViewAndroid::OnAttachCompositor() {
1886 DCHECK(content_view_core_); 1890 DCHECK(content_view_core_);
1887 if (!overscroll_controller_) 1891 if (!overscroll_controller_)
boliu 2016/12/03 01:05:28 style: need braces if the body is more than one li
rlanday 2016/12/05 19:53:56 Ok Personally I like the "orthodontist's rule" (y
1888 overscroll_controller_ = CreateOverscrollController( 1892 overscroll_controller_ = CreateOverscrollController(
1893 host_->delegate()->GetDelegateView()->GetOverscrollRefreshHandler(),
1889 content_view_core_, ui::GetScaleFactorForNativeView(GetNativeView())); 1894 content_view_core_, ui::GetScaleFactorForNativeView(GetNativeView()));
1890 ui::WindowAndroidCompositor* compositor = 1895 ui::WindowAndroidCompositor* compositor =
1891 view_.GetWindowAndroid()->GetCompositor(); 1896 view_.GetWindowAndroid()->GetCompositor();
1892 delegated_frame_host_->RegisterFrameSinkHierarchy( 1897 delegated_frame_host_->RegisterFrameSinkHierarchy(
1893 compositor->GetFrameSinkId()); 1898 compositor->GetFrameSinkId());
1894 } 1899 }
1895 1900
1896 void RenderWidgetHostViewAndroid::OnDetachCompositor() { 1901 void RenderWidgetHostViewAndroid::OnDetachCompositor() {
1897 DCHECK(content_view_core_); 1902 DCHECK(content_view_core_);
1898 DCHECK(using_browser_compositor_); 1903 DCHECK(using_browser_compositor_);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1994 case ui::MotionEvent::ACTION_UP: 1999 case ui::MotionEvent::ACTION_UP:
1995 case ui::MotionEvent::ACTION_POINTER_UP: 2000 case ui::MotionEvent::ACTION_POINTER_UP:
1996 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", 2001 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED",
1997 delta.InMicroseconds(), 1, 1000000, 50); 2002 delta.InMicroseconds(), 1, 1000000, 50);
1998 default: 2003 default:
1999 return; 2004 return;
2000 } 2005 }
2001 } 2006 }
2002 2007
2003 } // namespace content 2008 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698