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 "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 base::TimeTicks::Now() - start_time); | 260 base::TimeTicks::Now() - start_time); |
261 ReadbackResponse response = result ? READBACK_SUCCESS : READBACK_FAILED; | 261 ReadbackResponse response = result ? READBACK_SUCCESS : READBACK_FAILED; |
262 callback.Run(*bitmap, response); | 262 callback.Run(*bitmap, response); |
263 } | 263 } |
264 | 264 |
265 scoped_ptr<ui::TouchSelectionController> CreateSelectionController( | 265 scoped_ptr<ui::TouchSelectionController> CreateSelectionController( |
266 ui::TouchSelectionControllerClient* client, | 266 ui::TouchSelectionControllerClient* client, |
267 ContentViewCore* content_view_core) { | 267 ContentViewCore* content_view_core) { |
268 DCHECK(client); | 268 DCHECK(client); |
269 DCHECK(content_view_core); | 269 DCHECK(content_view_core); |
270 int tap_timeout_ms = gfx::ViewConfiguration::GetTapTimeoutInMs(); | 270 ui::TouchSelectionController::Config config; |
271 int touch_slop_pixels = gfx::ViewConfiguration::GetTouchSlopInPixels(); | 271 config.tap_timeout = base::TimeDelta::FromMilliseconds( |
272 bool show_on_tap_for_empty_editable = false; | 272 gfx::ViewConfiguration::GetTapTimeoutInMs()); |
273 return make_scoped_ptr(new ui::TouchSelectionController( | 273 config.tap_slop = gfx::ViewConfiguration::GetTouchSlopInPixels() / |
274 client, | 274 content_view_core->GetDpiScale(); |
275 base::TimeDelta::FromMilliseconds(tap_timeout_ms), | 275 config.show_on_tap_for_empty_editable = false; |
276 touch_slop_pixels / content_view_core->GetDpiScale(), | 276 config.enable_longpress_drag_selection = |
277 show_on_tap_for_empty_editable)); | 277 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 278 switches::kEnableLongpressDragSelection); |
| 279 return make_scoped_ptr(new ui::TouchSelectionController(client, config)); |
278 } | 280 } |
279 | 281 |
280 scoped_ptr<OverscrollControllerAndroid> CreateOverscrollController( | 282 scoped_ptr<OverscrollControllerAndroid> CreateOverscrollController( |
281 ContentViewCoreImpl* content_view_core) { | 283 ContentViewCoreImpl* content_view_core) { |
282 return make_scoped_ptr(new OverscrollControllerAndroid(content_view_core)); | 284 return make_scoped_ptr(new OverscrollControllerAndroid(content_view_core)); |
283 } | 285 } |
284 | 286 |
285 ui::GestureProvider::Config CreateGestureProviderConfig() { | 287 ui::GestureProvider::Config CreateGestureProviderConfig() { |
286 ui::GestureProvider::Config config = ui::GetGestureProviderConfig( | 288 ui::GestureProvider::Config config = ui::GetGestureProviderConfig( |
287 ui::GestureProviderConfigType::CURRENT_PLATFORM); | 289 ui::GestureProviderConfigType::CURRENT_PLATFORM); |
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 if (content_view_core_) | 1604 if (content_view_core_) |
1603 content_view_core_->OnGestureEventAck(event, ack_result); | 1605 content_view_core_->OnGestureEventAck(event, ack_result); |
1604 } | 1606 } |
1605 | 1607 |
1606 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent( | 1608 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent( |
1607 const blink::WebInputEvent& input_event) { | 1609 const blink::WebInputEvent& input_event) { |
1608 if (selection_controller_ && | 1610 if (selection_controller_ && |
1609 blink::WebInputEvent::isGestureEventType(input_event.type)) { | 1611 blink::WebInputEvent::isGestureEventType(input_event.type)) { |
1610 const blink::WebGestureEvent& gesture_event = | 1612 const blink::WebGestureEvent& gesture_event = |
1611 static_cast<const blink::WebGestureEvent&>(input_event); | 1613 static_cast<const blink::WebGestureEvent&>(input_event); |
1612 gfx::PointF gesture_location(gesture_event.x, gesture_event.y); | 1614 switch (gesture_event.type) { |
1613 if (input_event.type == blink::WebInputEvent::GestureLongPress) { | 1615 case blink::WebInputEvent::GestureLongPress: |
1614 if (selection_controller_->WillHandleLongPressEvent(gesture_location)) | 1616 if (selection_controller_->WillHandleLongPressEvent( |
1615 return INPUT_EVENT_ACK_STATE_CONSUMED; | 1617 base::TimeTicks() + |
1616 } else if (input_event.type == blink::WebInputEvent::GestureTap) { | 1618 base::TimeDelta::FromSecondsD(input_event.timeStampSeconds), |
1617 if (selection_controller_->WillHandleTapEvent(gesture_location)) | 1619 gfx::PointF(gesture_event.x, gesture_event.y))) { |
1618 return INPUT_EVENT_ACK_STATE_CONSUMED; | 1620 return INPUT_EVENT_ACK_STATE_CONSUMED; |
| 1621 } |
| 1622 break; |
| 1623 |
| 1624 case blink::WebInputEvent::GestureTap: |
| 1625 if (selection_controller_->WillHandleTapEvent( |
| 1626 gfx::PointF(gesture_event.x, gesture_event.y))) { |
| 1627 return INPUT_EVENT_ACK_STATE_CONSUMED; |
| 1628 } |
| 1629 break; |
| 1630 |
| 1631 default: |
| 1632 break; |
1619 } | 1633 } |
1620 } | 1634 } |
1621 | 1635 |
1622 if (overscroll_controller_ && | 1636 if (overscroll_controller_ && |
1623 blink::WebInputEvent::isGestureEventType(input_event.type) && | 1637 blink::WebInputEvent::isGestureEventType(input_event.type) && |
1624 overscroll_controller_->WillHandleGestureEvent( | 1638 overscroll_controller_->WillHandleGestureEvent( |
1625 static_cast<const blink::WebGestureEvent&>(input_event))) { | 1639 static_cast<const blink::WebGestureEvent&>(input_event))) { |
1626 return INPUT_EVENT_ACK_STATE_CONSUMED; | 1640 return INPUT_EVENT_ACK_STATE_CONSUMED; |
1627 } | 1641 } |
1628 | 1642 |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2039 results->orientationAngle = display.RotationAsDegree(); | 2053 results->orientationAngle = display.RotationAsDegree(); |
2040 results->orientationType = | 2054 results->orientationType = |
2041 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2055 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
2042 gfx::DeviceDisplayInfo info; | 2056 gfx::DeviceDisplayInfo info; |
2043 results->depth = info.GetBitsPerPixel(); | 2057 results->depth = info.GetBitsPerPixel(); |
2044 results->depthPerComponent = info.GetBitsPerComponent(); | 2058 results->depthPerComponent = info.GetBitsPerComponent(); |
2045 results->isMonochrome = (results->depthPerComponent == 0); | 2059 results->isMonochrome = (results->depthPerComponent == 0); |
2046 } | 2060 } |
2047 | 2061 |
2048 } // namespace content | 2062 } // namespace content |
OLD | NEW |