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

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

Issue 516573003: Use platform slop/timeout values for selection handle tap detection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build Created 6 years, 3 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
« no previous file with comments | « content/browser/renderer_host/input/touch_selection_controller_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/android/build_info.h" 9 #include "base/android/build_info.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 #include "skia/ext/image_operations.h" 65 #include "skia/ext/image_operations.h"
66 #include "third_party/khronos/GLES2/gl2.h" 66 #include "third_party/khronos/GLES2/gl2.h"
67 #include "third_party/khronos/GLES2/gl2ext.h" 67 #include "third_party/khronos/GLES2/gl2ext.h"
68 #include "third_party/skia/include/core/SkCanvas.h" 68 #include "third_party/skia/include/core/SkCanvas.h"
69 #include "ui/base/android/window_android.h" 69 #include "ui/base/android/window_android.h"
70 #include "ui/base/android/window_android_compositor.h" 70 #include "ui/base/android/window_android_compositor.h"
71 #include "ui/events/gesture_detection/gesture_config_helper.h" 71 #include "ui/events/gesture_detection/gesture_config_helper.h"
72 #include "ui/events/gesture_detection/motion_event.h" 72 #include "ui/events/gesture_detection/motion_event.h"
73 #include "ui/gfx/android/device_display_info.h" 73 #include "ui/gfx/android/device_display_info.h"
74 #include "ui/gfx/android/java_bitmap.h" 74 #include "ui/gfx/android/java_bitmap.h"
75 #include "ui/gfx/android/view_configuration.h"
75 #include "ui/gfx/display.h" 76 #include "ui/gfx/display.h"
76 #include "ui/gfx/screen.h" 77 #include "ui/gfx/screen.h"
77 #include "ui/gfx/size_conversions.h" 78 #include "ui/gfx/size_conversions.h"
78 79
79 namespace content { 80 namespace content {
80 81
81 namespace { 82 namespace {
82 83
83 const int kUndefinedOutputSurfaceId = -1; 84 const int kUndefinedOutputSurfaceId = -1;
84 85
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 EdgeEffectL::PreloadResources(system_resource_manager); 189 EdgeEffectL::PreloadResources(system_resource_manager);
189 else 190 else
190 EdgeEffect::PreloadResources(system_resource_manager); 191 EdgeEffect::PreloadResources(system_resource_manager);
191 192
192 return make_scoped_ptr( 193 return make_scoped_ptr(
193 new OverscrollGlow(base::Bind(&CreateEdgeEffect, 194 new OverscrollGlow(base::Bind(&CreateEdgeEffect,
194 system_resource_manager, 195 system_resource_manager,
195 content_view_core->GetDpiScale()))); 196 content_view_core->GetDpiScale())));
196 } 197 }
197 198
199 scoped_ptr<TouchSelectionController> CreateSelectionController(
200 TouchSelectionControllerClient* client,
201 ContentViewCore* content_view_core) {
202 DCHECK(client);
203 DCHECK(content_view_core);
204 int tap_timeout_ms = gfx::ViewConfiguration::GetTapTimeoutInMs();
205 int touch_slop_pixels = gfx::ViewConfiguration::GetTouchSlopInPixels();
206 return make_scoped_ptr(new TouchSelectionController(
207 client,
208 base::TimeDelta::FromMilliseconds(tap_timeout_ms),
209 touch_slop_pixels / content_view_core->GetDpiScale()));
210 }
211
198 ui::GestureProvider::Config CreateGestureProviderConfig() { 212 ui::GestureProvider::Config CreateGestureProviderConfig() {
199 ui::GestureProvider::Config config = ui::DefaultGestureProviderConfig(); 213 ui::GestureProvider::Config config = ui::DefaultGestureProviderConfig();
200 config.disable_click_delay = 214 config.disable_click_delay =
201 base::CommandLine::ForCurrentProcess()->HasSwitch( 215 base::CommandLine::ForCurrentProcess()->HasSwitch(
202 switches::kDisableClickDelay); 216 switches::kDisableClickDelay);
203 return config; 217 return config;
204 } 218 }
205 219
206 bool HasFixedPageScale(const cc::CompositorFrameMetadata& frame_metadata) { 220 bool HasFixedPageScale(const cc::CompositorFrameMetadata& frame_metadata) {
207 return frame_metadata.min_page_scale_factor == 221 return frame_metadata.min_page_scale_factor ==
(...skipping 1415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1623 1637
1624 if (!content_view_core_) 1638 if (!content_view_core_)
1625 return; 1639 return;
1626 1640
1627 StartObservingRootWindow(); 1641 StartObservingRootWindow();
1628 1642
1629 if (resize) 1643 if (resize)
1630 WasResized(); 1644 WasResized();
1631 1645
1632 if (!selection_controller_) 1646 if (!selection_controller_)
1633 selection_controller_.reset(new TouchSelectionController(this)); 1647 selection_controller_ = CreateSelectionController(this, content_view_core_);
1634 1648
1635 if (overscroll_effect_enabled_ && !overscroll_effect_ && 1649 if (overscroll_effect_enabled_ && !overscroll_effect_ &&
1636 content_view_core_->GetWindowAndroid()->GetCompositor()) 1650 content_view_core_->GetWindowAndroid()->GetCompositor())
1637 overscroll_effect_ = CreateOverscrollEffect(content_view_core_); 1651 overscroll_effect_ = CreateOverscrollEffect(content_view_core_);
1638 } 1652 }
1639 1653
1640 void RenderWidgetHostViewAndroid::RunAckCallbacks() { 1654 void RenderWidgetHostViewAndroid::RunAckCallbacks() {
1641 while (!ack_callbacks_.empty()) { 1655 while (!ack_callbacks_.empty()) {
1642 ack_callbacks_.front().Run(); 1656 ack_callbacks_.front().Run();
1643 ack_callbacks_.pop(); 1657 ack_callbacks_.pop();
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1837 results->orientationAngle = display.RotationAsDegree(); 1851 results->orientationAngle = display.RotationAsDegree();
1838 results->orientationType = 1852 results->orientationType =
1839 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 1853 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
1840 gfx::DeviceDisplayInfo info; 1854 gfx::DeviceDisplayInfo info;
1841 results->depth = info.GetBitsPerPixel(); 1855 results->depth = info.GetBitsPerPixel();
1842 results->depthPerComponent = info.GetBitsPerComponent(); 1856 results->depthPerComponent = info.GetBitsPerComponent();
1843 results->isMonochrome = (results->depthPerComponent == 0); 1857 results->isMonochrome = (results->depthPerComponent == 0);
1844 } 1858 }
1845 1859
1846 } // namespace content 1860 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/touch_selection_controller_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698