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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 ui::TouchSelectionController::Config config; | 238 ui::TouchSelectionController::Config config; |
239 config.max_tap_duration = base::TimeDelta::FromMilliseconds( | 239 config.max_tap_duration = base::TimeDelta::FromMilliseconds( |
240 gfx::ViewConfiguration::GetLongPressTimeoutInMs()); | 240 gfx::ViewConfiguration::GetLongPressTimeoutInMs()); |
241 config.tap_slop = gfx::ViewConfiguration::GetTouchSlopInDips(); | 241 config.tap_slop = gfx::ViewConfiguration::GetTouchSlopInDips(); |
242 config.enable_adaptive_handle_orientation = | 242 config.enable_adaptive_handle_orientation = |
243 base::CommandLine::ForCurrentProcess()->HasSwitch( | 243 base::CommandLine::ForCurrentProcess()->HasSwitch( |
244 switches::kEnableAdaptiveSelectionHandleOrientation); | 244 switches::kEnableAdaptiveSelectionHandleOrientation); |
245 config.enable_longpress_drag_selection = | 245 config.enable_longpress_drag_selection = |
246 base::CommandLine::ForCurrentProcess()->HasSwitch( | 246 base::CommandLine::ForCurrentProcess()->HasSwitch( |
247 switches::kEnableLongpressDragSelection); | 247 switches::kEnableLongpressDragSelection); |
248 return base::WrapUnique(new ui::TouchSelectionController(client, config)); | 248 return base::MakeUnique<ui::TouchSelectionController>(client, config); |
249 } | 249 } |
250 | 250 |
251 std::unique_ptr<OverscrollControllerAndroid> CreateOverscrollController( | 251 std::unique_ptr<OverscrollControllerAndroid> CreateOverscrollController( |
252 ContentViewCoreImpl* content_view_core, | 252 ContentViewCoreImpl* content_view_core, |
253 float dpi_scale) { | 253 float dpi_scale) { |
254 return base::WrapUnique( | 254 return base::MakeUnique<OverscrollControllerAndroid>(content_view_core, |
255 new OverscrollControllerAndroid(content_view_core, dpi_scale)); | 255 dpi_scale); |
256 } | 256 } |
257 | 257 |
258 gfx::RectF GetSelectionRect(const ui::TouchSelectionController& controller) { | 258 gfx::RectF GetSelectionRect(const ui::TouchSelectionController& controller) { |
259 gfx::RectF rect = controller.GetRectBetweenBounds(); | 259 gfx::RectF rect = controller.GetRectBetweenBounds(); |
260 if (rect.IsEmpty()) | 260 if (rect.IsEmpty()) |
261 return rect; | 261 return rect; |
262 | 262 |
263 rect.Union(controller.GetStartHandleRect()); | 263 rect.Union(controller.GetStartHandleRect()); |
264 rect.Union(controller.GetEndHandleRect()); | 264 rect.Union(controller.GetEndHandleRect()); |
265 return rect; | 265 return rect; |
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 case ui::MotionEvent::ACTION_UP: | 1870 case ui::MotionEvent::ACTION_UP: |
1871 case ui::MotionEvent::ACTION_POINTER_UP: | 1871 case ui::MotionEvent::ACTION_POINTER_UP: |
1872 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 1872 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
1873 delta.InMicroseconds(), 1, 1000000, 50); | 1873 delta.InMicroseconds(), 1, 1000000, 50); |
1874 default: | 1874 default: |
1875 return; | 1875 return; |
1876 } | 1876 } |
1877 } | 1877 } |
1878 | 1878 |
1879 } // namespace content | 1879 } // namespace content |
OLD | NEW |