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 1659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1670 } | 1670 } |
1671 | 1671 |
1672 void RenderWidgetHostViewAndroid::UnlockMouse() { | 1672 void RenderWidgetHostViewAndroid::UnlockMouse() { |
1673 NOTIMPLEMENTED(); | 1673 NOTIMPLEMENTED(); |
1674 } | 1674 } |
1675 | 1675 |
1676 // Methods called from the host to the render | 1676 // Methods called from the host to the render |
1677 | 1677 |
1678 void RenderWidgetHostViewAndroid::SendKeyEvent( | 1678 void RenderWidgetHostViewAndroid::SendKeyEvent( |
1679 const NativeWebKeyboardEvent& event) { | 1679 const NativeWebKeyboardEvent& event) { |
1680 if (host_) | 1680 if (!host_) |
1681 host_->ForwardKeyboardEvent(event); | 1681 return; |
| 1682 |
| 1683 RenderWidgetHostImpl* target_host = host_; |
| 1684 |
| 1685 // If there are multiple widgets on the page (such as when there are |
| 1686 // out-of-process iframes), pick the one that should process this event. |
| 1687 if (host_->delegate()) { |
| 1688 RenderWidgetHostImpl* focused_host = |
| 1689 host_->delegate()->GetFocusedRenderWidgetHost(); |
| 1690 if (focused_host) |
| 1691 target_host = focused_host; |
| 1692 } |
| 1693 |
| 1694 target_host->ForwardKeyboardEvent(event); |
1682 } | 1695 } |
1683 | 1696 |
1684 void RenderWidgetHostViewAndroid::SendMouseEvent( | 1697 void RenderWidgetHostViewAndroid::SendMouseEvent( |
1685 const blink::WebMouseEvent& event) { | 1698 const blink::WebMouseEvent& event) { |
1686 if (host_) | 1699 if (host_) |
1687 host_->ForwardMouseEvent(event); | 1700 host_->ForwardMouseEvent(event); |
1688 } | 1701 } |
1689 | 1702 |
1690 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( | 1703 void RenderWidgetHostViewAndroid::SendMouseWheelEvent( |
1691 const blink::WebMouseWheelEvent& event) { | 1704 const blink::WebMouseWheelEvent& event) { |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2045 results->orientationAngle = display.RotationAsDegree(); | 2058 results->orientationAngle = display.RotationAsDegree(); |
2046 results->orientationType = | 2059 results->orientationType = |
2047 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2060 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
2048 gfx::DeviceDisplayInfo info; | 2061 gfx::DeviceDisplayInfo info; |
2049 results->depth = info.GetBitsPerPixel(); | 2062 results->depth = info.GetBitsPerPixel(); |
2050 results->depthPerComponent = info.GetBitsPerComponent(); | 2063 results->depthPerComponent = info.GetBitsPerComponent(); |
2051 results->isMonochrome = (results->depthPerComponent == 0); | 2064 results->isMonochrome = (results->depthPerComponent == 0); |
2052 } | 2065 } |
2053 | 2066 |
2054 } // namespace content | 2067 } // namespace content |
OLD | NEW |