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