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

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

Issue 2528823002: Separate SwipeRefreshHandler and ContentViewCore (Closed)
Patch Set: Move web_contents_view_android.h header in web_contents_android.h into cc file, modify CreateRefres… 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.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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(
340 ContentViewCoreImpl* content_view_core, 341 ContentViewCoreImpl* content_view_core,
342 ui::OverscrollRefreshHandler* overscroll_refresh_handler,
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(),
347 dpi_scale);
344 } 348 }
345 349
346 gfx::RectF GetSelectionRect(const ui::TouchSelectionController& controller) { 350 gfx::RectF GetSelectionRect(const ui::TouchSelectionController& controller) {
347 gfx::RectF rect = controller.GetRectBetweenBounds(); 351 gfx::RectF rect = controller.GetRectBetweenBounds();
348 if (rect.IsEmpty()) 352 if (rect.IsEmpty())
349 return rect; 353 return rect;
350 354
351 rect.Union(controller.GetStartHandleRect()); 355 rect.Union(controller.GetStartHandleRect());
352 rect.Union(controller.GetEndHandleRect()); 356 rect.Union(controller.GetEndHandleRect());
353 return rect; 357 return rect;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 while (RenderWidgetHost* widget = widgets->GetNextHost()) { 433 while (RenderWidgetHost* widget = widgets->GetNextHost()) {
430 if (widget->GetView()) { 434 if (widget->GetView()) {
431 static_cast<RenderWidgetHostViewAndroid*>(widget->GetView()) 435 static_cast<RenderWidgetHostViewAndroid*>(widget->GetView())
432 ->OnLostResources(); 436 ->OnLostResources();
433 } 437 }
434 } 438 }
435 } 439 }
436 440
437 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid( 441 RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid(
438 RenderWidgetHostImpl* widget_host, 442 RenderWidgetHostImpl* widget_host,
439 ContentViewCoreImpl* content_view_core) 443 ContentViewCoreImpl* content_view_core,
444 ui::OverscrollRefreshHandler* overscroll_refresh_handler)
440 : host_(widget_host), 445 : host_(widget_host),
441 outstanding_vsync_requests_(0), 446 outstanding_vsync_requests_(0),
442 is_showing_(!widget_host->is_hidden()), 447 is_showing_(!widget_host->is_hidden()),
443 is_window_visible_(true), 448 is_window_visible_(true),
444 is_window_activity_started_(true), 449 is_window_activity_started_(true),
445 content_view_core_(nullptr), 450 content_view_core_(nullptr),
451 overscroll_refresh_handler_(overscroll_refresh_handler),
446 ime_adapter_android_(this), 452 ime_adapter_android_(this),
447 cached_background_color_(SK_ColorWHITE), 453 cached_background_color_(SK_ColorWHITE),
448 last_compositor_frame_sink_id_(kUndefinedCompositorFrameSinkId), 454 last_compositor_frame_sink_id_(kUndefinedCompositorFrameSinkId),
449 gesture_provider_(ui::GetGestureProviderConfig( 455 gesture_provider_(ui::GetGestureProviderConfig(
450 ui::GestureProviderConfigType::CURRENT_PLATFORM), 456 ui::GestureProviderConfigType::CURRENT_PLATFORM),
451 this), 457 this),
452 stylus_text_selector_(this), 458 stylus_text_selector_(this),
453 using_browser_compositor_(CompositorImpl::IsInitialized()), 459 using_browser_compositor_(CompositorImpl::IsInitialized()),
454 synchronous_compositor_client_(nullptr), 460 synchronous_compositor_client_(nullptr),
455 frame_evictor_(new DelegatedFrameEvictor(this)), 461 frame_evictor_(new DelegatedFrameEvictor(this)),
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1795 1801
1796 if (resize) 1802 if (resize)
1797 WasResized(); 1803 WasResized();
1798 1804
1799 if (!selection_controller_) 1805 if (!selection_controller_)
1800 selection_controller_ = CreateSelectionController(this, content_view_core_); 1806 selection_controller_ = CreateSelectionController(this, content_view_core_);
1801 1807
1802 if (!overscroll_controller_ && 1808 if (!overscroll_controller_ &&
1803 view_.GetWindowAndroid()->GetCompositor()) { 1809 view_.GetWindowAndroid()->GetCompositor()) {
1804 overscroll_controller_ = CreateOverscrollController( 1810 overscroll_controller_ = CreateOverscrollController(
1805 content_view_core_, ui::GetScaleFactorForNativeView(GetNativeView())); 1811 content_view_core_, overscroll_refresh_handler_,
1812 ui::GetScaleFactorForNativeView(GetNativeView()));
1806 } 1813 }
1807 } 1814 }
1808 1815
1809 void RenderWidgetHostViewAndroid::RunAckCallbacks() { 1816 void RenderWidgetHostViewAndroid::RunAckCallbacks() {
1810 while (!ack_callbacks_.empty()) { 1817 while (!ack_callbacks_.empty()) {
1811 ack_callbacks_.front().Run(); 1818 ack_callbacks_.front().Run();
1812 ack_callbacks_.pop(); 1819 ack_callbacks_.pop();
1813 } 1820 }
1814 } 1821 }
1815 1822
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 1869
1863 void RenderWidgetHostViewAndroid::OnDetachedFromWindow() { 1870 void RenderWidgetHostViewAndroid::OnDetachedFromWindow() {
1864 StopObservingRootWindow(); 1871 StopObservingRootWindow();
1865 OnDetachCompositor(); 1872 OnDetachCompositor();
1866 } 1873 }
1867 1874
1868 void RenderWidgetHostViewAndroid::OnAttachCompositor() { 1875 void RenderWidgetHostViewAndroid::OnAttachCompositor() {
1869 DCHECK(content_view_core_); 1876 DCHECK(content_view_core_);
1870 if (!overscroll_controller_) 1877 if (!overscroll_controller_)
1871 overscroll_controller_ = CreateOverscrollController( 1878 overscroll_controller_ = CreateOverscrollController(
1872 content_view_core_, ui::GetScaleFactorForNativeView(GetNativeView())); 1879 content_view_core_, overscroll_refresh_handler_,
1880 ui::GetScaleFactorForNativeView(GetNativeView()));
1873 ui::WindowAndroidCompositor* compositor = 1881 ui::WindowAndroidCompositor* compositor =
1874 view_.GetWindowAndroid()->GetCompositor(); 1882 view_.GetWindowAndroid()->GetCompositor();
1875 delegated_frame_host_->RegisterFrameSinkHierarchy( 1883 delegated_frame_host_->RegisterFrameSinkHierarchy(
1876 compositor->GetFrameSinkId()); 1884 compositor->GetFrameSinkId());
1877 } 1885 }
1878 1886
1879 void RenderWidgetHostViewAndroid::OnDetachCompositor() { 1887 void RenderWidgetHostViewAndroid::OnDetachCompositor() {
1880 DCHECK(content_view_core_); 1888 DCHECK(content_view_core_);
1881 DCHECK(using_browser_compositor_); 1889 DCHECK(using_browser_compositor_);
1882 RunAckCallbacks(); 1890 RunAckCallbacks();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
1977 case ui::MotionEvent::ACTION_UP: 1985 case ui::MotionEvent::ACTION_UP:
1978 case ui::MotionEvent::ACTION_POINTER_UP: 1986 case ui::MotionEvent::ACTION_POINTER_UP:
1979 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", 1987 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED",
1980 delta.InMicroseconds(), 1, 1000000, 50); 1988 delta.InMicroseconds(), 1, 1000000, 50);
1981 default: 1989 default:
1982 return; 1990 return;
1983 } 1991 }
1984 } 1992 }
1985 1993
1986 } // namespace content 1994 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698