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 15 matching lines...) Expand all Loading... |
26 #include "cc/trees/layer_tree_host.h" | 26 #include "cc/trees/layer_tree_host.h" |
27 #include "content/browser/accessibility/browser_accessibility_manager_android.h" | 27 #include "content/browser/accessibility/browser_accessibility_manager_android.h" |
28 #include "content/browser/android/content_view_core_impl.h" | 28 #include "content/browser/android/content_view_core_impl.h" |
29 #include "content/browser/android/in_process/synchronous_compositor_impl.h" | 29 #include "content/browser/android/in_process/synchronous_compositor_impl.h" |
30 #include "content/browser/android/overscroll_glow.h" | 30 #include "content/browser/android/overscroll_glow.h" |
31 #include "content/browser/gpu/gpu_data_manager_impl.h" | 31 #include "content/browser/gpu/gpu_data_manager_impl.h" |
32 #include "content/browser/gpu/gpu_process_host_ui_shim.h" | 32 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
33 #include "content/browser/gpu/gpu_surface_tracker.h" | 33 #include "content/browser/gpu/gpu_surface_tracker.h" |
34 #include "content/browser/renderer_host/compositor_impl_android.h" | 34 #include "content/browser/renderer_host/compositor_impl_android.h" |
35 #include "content/browser/renderer_host/dip_util.h" | 35 #include "content/browser/renderer_host/dip_util.h" |
| 36 #include "content/browser/renderer_host/generic_touch_gesture_android.h" |
36 #include "content/browser/renderer_host/image_transport_factory_android.h" | 37 #include "content/browser/renderer_host/image_transport_factory_android.h" |
37 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" | 38 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" |
38 #include "content/browser/renderer_host/render_widget_host_impl.h" | 39 #include "content/browser/renderer_host/render_widget_host_impl.h" |
39 #include "content/common/gpu/client/gl_helper.h" | 40 #include "content/common/gpu/client/gl_helper.h" |
40 #include "content/common/gpu/gpu_messages.h" | 41 #include "content/common/gpu/gpu_messages.h" |
41 #include "content/common/input_messages.h" | 42 #include "content/common/input_messages.h" |
42 #include "content/common/view_messages.h" | 43 #include "content/common/view_messages.h" |
43 #include "content/public/common/content_switches.h" | 44 #include "content/public/common/content_switches.h" |
44 #include "gpu/config/gpu_driver_bug_workaround_type.h" | 45 #include "gpu/config/gpu_driver_bug_workaround_type.h" |
45 #include "skia/ext/image_operations.h" | 46 #include "skia/ext/image_operations.h" |
46 #include "third_party/khronos/GLES2/gl2.h" | 47 #include "third_party/khronos/GLES2/gl2.h" |
47 #include "third_party/khronos/GLES2/gl2ext.h" | 48 #include "third_party/khronos/GLES2/gl2ext.h" |
48 #include "ui/gfx/android/device_display_info.h" | 49 #include "ui/gfx/android/device_display_info.h" |
49 #include "ui/gfx/android/java_bitmap.h" | 50 #include "ui/gfx/android/java_bitmap.h" |
50 #include "ui/gfx/display.h" | 51 #include "ui/gfx/display.h" |
51 #include "ui/gfx/screen.h" | 52 #include "ui/gfx/screen.h" |
52 #include "ui/gfx/size_conversions.h" | 53 #include "ui/gfx/size_conversions.h" |
53 | 54 |
54 namespace content { | 55 namespace content { |
55 | 56 |
56 namespace { | 57 namespace { |
57 | 58 |
58 const int kUndefinedOutputSurfaceId = -1; | 59 const int kUndefinedOutputSurfaceId = -1; |
| 60 const int kMinimumPointerDistance = 50; |
59 | 61 |
60 void InsertSyncPointAndAckForCompositor( | 62 void InsertSyncPointAndAckForCompositor( |
61 int renderer_host_id, | 63 int renderer_host_id, |
62 uint32 output_surface_id, | 64 uint32 output_surface_id, |
63 int route_id, | 65 int route_id, |
64 const gpu::Mailbox& return_mailbox, | 66 const gpu::Mailbox& return_mailbox, |
65 const gfx::Size return_size) { | 67 const gfx::Size return_size) { |
66 cc::CompositorFrameAck ack; | 68 cc::CompositorFrameAck ack; |
67 ack.gl_frame_data.reset(new cc::GLFrameData()); | 69 ack.gl_frame_data.reset(new cc::GLFrameData()); |
68 if (!return_mailbox.IsZero()) { | 70 if (!return_mailbox.IsZero()) { |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 | 616 |
615 content_view_core_->ShowDisambiguationPopup(target_rect, zoomed_bitmap); | 617 content_view_core_->ShowDisambiguationPopup(target_rect, zoomed_bitmap); |
616 } | 618 } |
617 | 619 |
618 scoped_ptr<SyntheticGestureTarget> | 620 scoped_ptr<SyntheticGestureTarget> |
619 RenderWidgetHostViewAndroid::CreateSyntheticGestureTarget() { | 621 RenderWidgetHostViewAndroid::CreateSyntheticGestureTarget() { |
620 return scoped_ptr<SyntheticGestureTarget>(new SyntheticGestureTargetAndroid( | 622 return scoped_ptr<SyntheticGestureTarget>(new SyntheticGestureTargetAndroid( |
621 host_, content_view_core_->CreateTouchEventSynthesizer())); | 623 host_, content_view_core_->CreateTouchEventSynthesizer())); |
622 } | 624 } |
623 | 625 |
| 626 SyntheticGesture* RenderWidgetHostViewAndroid::CreateSmoothScrollGesture( |
| 627 bool scroll_down, int pixels_to_scroll, int mouse_event_x, |
| 628 int mouse_event_y) { |
| 629 return new GenericTouchGestureAndroid( |
| 630 GetRenderWidgetHost(), |
| 631 content_view_core_->CreateOnePointTouchGesture( |
| 632 mouse_event_x, mouse_event_y, |
| 633 0, scroll_down ? -pixels_to_scroll : pixels_to_scroll)); |
| 634 } |
| 635 |
| 636 SyntheticGesture* RenderWidgetHostViewAndroid::CreatePinchGesture( |
| 637 bool zoom_in, int pixels_to_move, int anchor_x, |
| 638 int anchor_y) { |
| 639 int distance_between_pointers = zoom_in ? |
| 640 kMinimumPointerDistance : (kMinimumPointerDistance + pixels_to_move); |
| 641 return new GenericTouchGestureAndroid( |
| 642 GetRenderWidgetHost(), |
| 643 content_view_core_->CreateTwoPointTouchGesture( |
| 644 anchor_x, anchor_y - distance_between_pointers / 2, |
| 645 0, (zoom_in ? -pixels_to_move : pixels_to_move) / 2, |
| 646 anchor_x, anchor_y + distance_between_pointers / 2, |
| 647 0, (zoom_in ? pixels_to_move : -pixels_to_move) / 2)); |
| 648 } |
| 649 |
624 void RenderWidgetHostViewAndroid::OnAcceleratedCompositingStateChange() { | 650 void RenderWidgetHostViewAndroid::OnAcceleratedCompositingStateChange() { |
625 } | 651 } |
626 | 652 |
627 void RenderWidgetHostViewAndroid::SendDelegatedFrameAck( | 653 void RenderWidgetHostViewAndroid::SendDelegatedFrameAck( |
628 uint32 output_surface_id) { | 654 uint32 output_surface_id) { |
629 cc::CompositorFrameAck ack; | 655 cc::CompositorFrameAck ack; |
630 if (resource_collection_.get()) | 656 if (resource_collection_.get()) |
631 resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources); | 657 resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources); |
632 RenderWidgetHostImpl::SendSwapCompositorFrameAck(host_->GetRoutingID(), | 658 RenderWidgetHostImpl::SendSwapCompositorFrameAck(host_->GetRoutingID(), |
633 output_surface_id, | 659 output_surface_id, |
(...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1365 // RenderWidgetHostView, public: | 1391 // RenderWidgetHostView, public: |
1366 | 1392 |
1367 // static | 1393 // static |
1368 RenderWidgetHostView* | 1394 RenderWidgetHostView* |
1369 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 1395 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
1370 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 1396 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
1371 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 1397 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
1372 } | 1398 } |
1373 | 1399 |
1374 } // namespace content | 1400 } // namespace content |
OLD | NEW |