Chromium Code Reviews| 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/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 #include "cc/trees/layer_tree_host.h" | 25 #include "cc/trees/layer_tree_host.h" |
| 26 #include "content/browser/accessibility/browser_accessibility_manager_android.h" | 26 #include "content/browser/accessibility/browser_accessibility_manager_android.h" |
| 27 #include "content/browser/android/content_view_core_impl.h" | 27 #include "content/browser/android/content_view_core_impl.h" |
| 28 #include "content/browser/android/in_process/synchronous_compositor_impl.h" | 28 #include "content/browser/android/in_process/synchronous_compositor_impl.h" |
| 29 #include "content/browser/android/overscroll_glow.h" | 29 #include "content/browser/android/overscroll_glow.h" |
| 30 #include "content/browser/gpu/gpu_surface_tracker.h" | 30 #include "content/browser/gpu/gpu_surface_tracker.h" |
| 31 #include "content/browser/renderer_host/compositor_impl_android.h" | 31 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 32 #include "content/browser/renderer_host/dip_util.h" | 32 #include "content/browser/renderer_host/dip_util.h" |
| 33 #include "content/browser/renderer_host/generic_touch_gesture_android.h" | 33 #include "content/browser/renderer_host/generic_touch_gesture_android.h" |
| 34 #include "content/browser/renderer_host/image_transport_factory_android.h" | 34 #include "content/browser/renderer_host/image_transport_factory_android.h" |
| 35 #include "content/browser/renderer_host/input/touch_scroll_smooth_gesture.h" | |
| 35 #include "content/browser/renderer_host/render_widget_host_impl.h" | 36 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 37 #include "content/browser/renderer_host/synthetic_touch_event_android.h" | |
| 36 #include "content/common/gpu/client/gl_helper.h" | 38 #include "content/common/gpu/client/gl_helper.h" |
| 37 #include "content/common/gpu/gpu_messages.h" | 39 #include "content/common/gpu/gpu_messages.h" |
| 40 #include "content/common/input/input_event.h" | |
| 38 #include "content/common/input_messages.h" | 41 #include "content/common/input_messages.h" |
| 39 #include "content/common/view_messages.h" | 42 #include "content/common/view_messages.h" |
| 40 #include "content/public/common/content_switches.h" | 43 #include "content/public/common/content_switches.h" |
| 41 #include "skia/ext/image_operations.h" | 44 #include "skia/ext/image_operations.h" |
| 45 #include "third_party/WebKit/public/web/WebInputEvent.h" | |
| 42 #include "third_party/khronos/GLES2/gl2.h" | 46 #include "third_party/khronos/GLES2/gl2.h" |
| 43 #include "third_party/khronos/GLES2/gl2ext.h" | 47 #include "third_party/khronos/GLES2/gl2ext.h" |
| 44 #include "ui/gfx/android/device_display_info.h" | 48 #include "ui/gfx/android/device_display_info.h" |
| 45 #include "ui/gfx/android/java_bitmap.h" | 49 #include "ui/gfx/android/java_bitmap.h" |
| 46 #include "ui/gfx/display.h" | 50 #include "ui/gfx/display.h" |
| 47 #include "ui/gfx/screen.h" | 51 #include "ui/gfx/screen.h" |
| 48 #include "ui/gfx/size_conversions.h" | 52 #include "ui/gfx/size_conversions.h" |
| 49 | 53 |
| 54 using WebKit::WebInputEvent; | |
| 55 using WebKit::WebTouchEvent; | |
| 56 | |
| 50 namespace content { | 57 namespace content { |
| 51 | 58 |
| 52 namespace { | 59 namespace { |
| 53 | 60 |
| 54 const int kUndefinedOutputSurfaceId = -1; | 61 const int kUndefinedOutputSurfaceId = -1; |
| 55 const int kMinimumPointerDistance = 50; | 62 const int kMinimumPointerDistance = 50; |
| 56 | 63 |
| 57 void InsertSyncPointAndAckForGpu( | 64 void InsertSyncPointAndAckForGpu( |
| 58 int gpu_host_id, int route_id, const std::string& return_mailbox) { | 65 int gpu_host_id, int route_id, const std::string& return_mailbox) { |
| 59 uint32 sync_point = | 66 uint32 sync_point = |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 601 } | 608 } |
| 602 | 609 |
| 603 void RenderWidgetHostViewAndroid::ShowDisambiguationPopup( | 610 void RenderWidgetHostViewAndroid::ShowDisambiguationPopup( |
| 604 const gfx::Rect& target_rect, const SkBitmap& zoomed_bitmap) { | 611 const gfx::Rect& target_rect, const SkBitmap& zoomed_bitmap) { |
| 605 if (!content_view_core_) | 612 if (!content_view_core_) |
| 606 return; | 613 return; |
| 607 | 614 |
| 608 content_view_core_->ShowDisambiguationPopup(target_rect, zoomed_bitmap); | 615 content_view_core_->ShowDisambiguationPopup(target_rect, zoomed_bitmap); |
| 609 } | 616 } |
| 610 | 617 |
| 618 // FIXME: move this to RenderWidgetHostBase | |
|
Dominik Grewe
2013/10/10 14:01:45
This method will actually be removed completely on
kouhei (in TOK)
2013/10/15 02:10:02
Ack. I'll remove this in commit CL.
| |
| 611 SyntheticGesture* RenderWidgetHostViewAndroid::CreateSmoothScrollGesture( | 619 SyntheticGesture* RenderWidgetHostViewAndroid::CreateSmoothScrollGesture( |
| 612 bool scroll_down, int pixels_to_scroll, int mouse_event_x, | 620 bool scroll_down, int pixels_to_scroll, int mouse_event_x, |
| 613 int mouse_event_y) { | 621 int mouse_event_y) { |
| 614 return new GenericTouchGestureAndroid( | 622 return new TouchSmoothScrollGesture( |
| 615 GetRenderWidgetHost(), | 623 scroll_down, pixels_to_scroll, mouse_event_x, mouse_event_y); |
| 616 content_view_core_->CreateOnePointTouchGesture( | |
| 617 mouse_event_x, mouse_event_y, | |
| 618 0, scroll_down ? -pixels_to_scroll : pixels_to_scroll)); | |
| 619 } | 624 } |
| 620 | 625 |
| 621 SyntheticGesture* RenderWidgetHostViewAndroid::CreatePinchGesture( | 626 SyntheticGesture* RenderWidgetHostViewAndroid::CreatePinchGesture( |
| 622 bool zoom_in, int pixels_to_move, int anchor_x, | 627 bool zoom_in, int pixels_to_move, int anchor_x, |
| 623 int anchor_y) { | 628 int anchor_y) { |
| 624 int distance_between_pointers = zoom_in ? | 629 int distance_between_pointers = zoom_in ? |
| 625 kMinimumPointerDistance : (kMinimumPointerDistance + pixels_to_move); | 630 kMinimumPointerDistance : (kMinimumPointerDistance + pixels_to_move); |
| 626 return new GenericTouchGestureAndroid( | 631 return new GenericTouchGestureAndroid( |
| 627 GetRenderWidgetHost(), | 632 GetRenderWidgetHost(), |
| 628 content_view_core_->CreateTwoPointTouchGesture( | 633 content_view_core_->CreateTwoPointTouchGesture( |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 923 gfx::GLSurfaceHandle RenderWidgetHostViewAndroid::GetCompositingSurface() { | 928 gfx::GLSurfaceHandle RenderWidgetHostViewAndroid::GetCompositingSurface() { |
| 924 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT); | 929 return gfx::GLSurfaceHandle(gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT); |
| 925 } | 930 } |
| 926 | 931 |
| 927 void RenderWidgetHostViewAndroid::ProcessAckedTouchEvent( | 932 void RenderWidgetHostViewAndroid::ProcessAckedTouchEvent( |
| 928 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { | 933 const TouchEventWithLatencyInfo& touch, InputEventAckState ack_result) { |
| 929 if (content_view_core_) | 934 if (content_view_core_) |
| 930 content_view_core_->ConfirmTouchEvent(ack_result); | 935 content_view_core_->ConfirmTouchEvent(ack_result); |
| 931 } | 936 } |
| 932 | 937 |
| 938 void RenderWidgetHostViewAndroid::QueueInputEventToPlatform( | |
| 939 const InputEvent& event) { | |
| 940 if (! synthetic_touch_event_) | |
| 941 synthetic_touch_event_.reset( | |
| 942 new SyntheticTouchEventAndroid(content_view_core_)); | |
| 943 | |
| 944 if (WebInputEvent::isTouchEventType(event.web_event->type)) { | |
| 945 const WebTouchEvent* web_touch = | |
| 946 static_cast<const WebTouchEvent*>(event.web_event.get()); | |
| 947 | |
| 948 synthetic_touch_event_->InjectWebTouchEvent(web_touch); | |
| 949 } else | |
| 950 NOTREACHED(); // FIXME: implement other types (MouseWheel?) | |
| 951 } | |
| 952 | |
| 933 void RenderWidgetHostViewAndroid::SetHasHorizontalScrollbar( | 953 void RenderWidgetHostViewAndroid::SetHasHorizontalScrollbar( |
| 934 bool has_horizontal_scrollbar) { | 954 bool has_horizontal_scrollbar) { |
| 935 // intentionally empty, like RenderWidgetHostViewViews | 955 // intentionally empty, like RenderWidgetHostViewViews |
| 936 } | 956 } |
| 937 | 957 |
| 938 void RenderWidgetHostViewAndroid::SetScrollOffsetPinning( | 958 void RenderWidgetHostViewAndroid::SetScrollOffsetPinning( |
| 939 bool is_pinned_to_left, bool is_pinned_to_right) { | 959 bool is_pinned_to_left, bool is_pinned_to_right) { |
| 940 // intentionally empty, like RenderWidgetHostViewViews | 960 // intentionally empty, like RenderWidgetHostViewViews |
| 941 } | 961 } |
| 942 | 962 |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1313 // RenderWidgetHostView, public: | 1333 // RenderWidgetHostView, public: |
| 1314 | 1334 |
| 1315 // static | 1335 // static |
| 1316 RenderWidgetHostView* | 1336 RenderWidgetHostView* |
| 1317 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 1337 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
| 1318 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 1338 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
| 1319 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 1339 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
| 1320 } | 1340 } |
| 1321 | 1341 |
| 1322 } // namespace content | 1342 } // namespace content |
| OLD | NEW |