| 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 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1451 if (view_.GetLayer()) | 1451 if (view_.GetLayer()) |
| 1452 DestroyDelegatedContent(); | 1452 DestroyDelegatedContent(); |
| 1453 } | 1453 } |
| 1454 | 1454 |
| 1455 bool RenderWidgetHostViewAndroid::HasAcceleratedSurface( | 1455 bool RenderWidgetHostViewAndroid::HasAcceleratedSurface( |
| 1456 const gfx::Size& desired_size) { | 1456 const gfx::Size& desired_size) { |
| 1457 NOTREACHED(); | 1457 NOTREACHED(); |
| 1458 return false; | 1458 return false; |
| 1459 } | 1459 } |
| 1460 | 1460 |
| 1461 void RenderWidgetHostViewAndroid::GetScreenInfo(blink::WebScreenInfo* result) { | |
| 1462 // ScreenInfo isn't tied to the widget on Android. Always return the default. | |
| 1463 RenderWidgetHostViewBase::GetDefaultScreenInfo(result); | |
| 1464 } | |
| 1465 | |
| 1466 // TODO(jrg): Find out the implications and answer correctly here, | 1461 // TODO(jrg): Find out the implications and answer correctly here, |
| 1467 // as we are returning the WebView and not root window bounds. | 1462 // as we are returning the WebView and not root window bounds. |
| 1468 gfx::Rect RenderWidgetHostViewAndroid::GetBoundsInRootWindow() { | 1463 gfx::Rect RenderWidgetHostViewAndroid::GetBoundsInRootWindow() { |
| 1469 return GetViewBounds(); | 1464 return GetViewBounds(); |
| 1470 } | 1465 } |
| 1471 | 1466 |
| 1472 void RenderWidgetHostViewAndroid::ProcessAckedTouchEvent( | 1467 void RenderWidgetHostViewAndroid::ProcessAckedTouchEvent( |
| 1473 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { | 1468 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { |
| 1474 const bool event_consumed = ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; | 1469 const bool event_consumed = ack_result == INPUT_EVENT_ACK_STATE_CONSUMED; |
| 1475 gesture_provider_.OnTouchEventAck(touch.event.uniqueTouchEventId, | 1470 gesture_provider_.OnTouchEventAck(touch.event.uniqueTouchEventId, |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1951 float x, | 1946 float x, |
| 1952 float y) { | 1947 float y) { |
| 1953 // Treat the stylus tap as a long press, activating either a word selection or | 1948 // Treat the stylus tap as a long press, activating either a word selection or |
| 1954 // context menu depending on the targetted content. | 1949 // context menu depending on the targetted content. |
| 1955 blink::WebGestureEvent long_press = WebGestureEventBuilder::Build( | 1950 blink::WebGestureEvent long_press = WebGestureEventBuilder::Build( |
| 1956 blink::WebInputEvent::GestureLongPress, | 1951 blink::WebInputEvent::GestureLongPress, |
| 1957 (time - base::TimeTicks()).InSecondsF(), x, y); | 1952 (time - base::TimeTicks()).InSecondsF(), x, y); |
| 1958 SendGestureEvent(long_press); | 1953 SendGestureEvent(long_press); |
| 1959 } | 1954 } |
| 1960 | 1955 |
| 1961 // static | |
| 1962 void RenderWidgetHostViewBase::GetDefaultScreenInfo( | |
| 1963 blink::WebScreenInfo* results) { | |
| 1964 const display::Display& display = | |
| 1965 display::Screen::GetScreen()->GetPrimaryDisplay(); | |
| 1966 results->rect = display.bounds(); | |
| 1967 // TODO(husky): Remove any system controls from availableRect. | |
| 1968 results->availableRect = display.work_area(); | |
| 1969 results->deviceScaleFactor = display.device_scale_factor(); | |
| 1970 results->orientationAngle = display.RotationAsDegree(); | |
| 1971 results->orientationType = | |
| 1972 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | |
| 1973 gfx::DeviceDisplayInfo info; | |
| 1974 results->depth = display.color_depth(); | |
| 1975 results->depthPerComponent = display.depth_per_component(); | |
| 1976 results->isMonochrome = (results->depthPerComponent == 0); | |
| 1977 } | |
| 1978 | |
| 1979 void RenderWidgetHostViewAndroid::ComputeEventLatencyOSTouchHistograms( | 1956 void RenderWidgetHostViewAndroid::ComputeEventLatencyOSTouchHistograms( |
| 1980 const ui::MotionEvent& event) { | 1957 const ui::MotionEvent& event) { |
| 1981 base::TimeTicks event_time = event.GetEventTime(); | 1958 base::TimeTicks event_time = event.GetEventTime(); |
| 1982 base::TimeDelta delta = base::TimeTicks::Now() - event_time; | 1959 base::TimeDelta delta = base::TimeTicks::Now() - event_time; |
| 1983 switch (event.GetAction()) { | 1960 switch (event.GetAction()) { |
| 1984 case ui::MotionEvent::ACTION_DOWN: | 1961 case ui::MotionEvent::ACTION_DOWN: |
| 1985 case ui::MotionEvent::ACTION_POINTER_DOWN: | 1962 case ui::MotionEvent::ACTION_POINTER_DOWN: |
| 1986 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_PRESSED", | 1963 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_PRESSED", |
| 1987 delta.InMicroseconds(), 1, 1000000, 50); | 1964 delta.InMicroseconds(), 1, 1000000, 50); |
| 1988 return; | 1965 return; |
| 1989 case ui::MotionEvent::ACTION_MOVE: | 1966 case ui::MotionEvent::ACTION_MOVE: |
| 1990 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_MOVED", | 1967 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_MOVED", |
| 1991 delta.InMicroseconds(), 1, 1000000, 50); | 1968 delta.InMicroseconds(), 1, 1000000, 50); |
| 1992 return; | 1969 return; |
| 1993 case ui::MotionEvent::ACTION_UP: | 1970 case ui::MotionEvent::ACTION_UP: |
| 1994 case ui::MotionEvent::ACTION_POINTER_UP: | 1971 case ui::MotionEvent::ACTION_POINTER_UP: |
| 1995 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 1972 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
| 1996 delta.InMicroseconds(), 1, 1000000, 50); | 1973 delta.InMicroseconds(), 1, 1000000, 50); |
| 1997 default: | 1974 default: |
| 1998 return; | 1975 return; |
| 1999 } | 1976 } |
| 2000 } | 1977 } |
| 2001 | 1978 |
| 2002 } // namespace content | 1979 } // namespace content |
| OLD | NEW |