| 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" | |
| 37 #include "content/browser/renderer_host/image_transport_factory_android.h" | 36 #include "content/browser/renderer_host/image_transport_factory_android.h" |
| 38 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" | 37 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h
" |
| 39 #include "content/browser/renderer_host/render_widget_host_impl.h" | 38 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 40 #include "content/common/gpu/client/gl_helper.h" | 39 #include "content/common/gpu/client/gl_helper.h" |
| 41 #include "content/common/gpu/gpu_messages.h" | 40 #include "content/common/gpu/gpu_messages.h" |
| 42 #include "content/common/input_messages.h" | 41 #include "content/common/input_messages.h" |
| 43 #include "content/common/view_messages.h" | 42 #include "content/common/view_messages.h" |
| 44 #include "content/public/common/content_switches.h" | 43 #include "content/public/common/content_switches.h" |
| 45 #include "gpu/config/gpu_driver_bug_workaround_type.h" | 44 #include "gpu/config/gpu_driver_bug_workaround_type.h" |
| 46 #include "skia/ext/image_operations.h" | 45 #include "skia/ext/image_operations.h" |
| 47 #include "third_party/khronos/GLES2/gl2.h" | 46 #include "third_party/khronos/GLES2/gl2.h" |
| 48 #include "third_party/khronos/GLES2/gl2ext.h" | 47 #include "third_party/khronos/GLES2/gl2ext.h" |
| 49 #include "ui/gfx/android/device_display_info.h" | 48 #include "ui/gfx/android/device_display_info.h" |
| 50 #include "ui/gfx/android/java_bitmap.h" | 49 #include "ui/gfx/android/java_bitmap.h" |
| 51 #include "ui/gfx/display.h" | 50 #include "ui/gfx/display.h" |
| 52 #include "ui/gfx/screen.h" | 51 #include "ui/gfx/screen.h" |
| 53 #include "ui/gfx/size_conversions.h" | 52 #include "ui/gfx/size_conversions.h" |
| 54 | 53 |
| 55 namespace content { | 54 namespace content { |
| 56 | 55 |
| 57 namespace { | 56 namespace { |
| 58 | 57 |
| 59 const int kUndefinedOutputSurfaceId = -1; | 58 const int kUndefinedOutputSurfaceId = -1; |
| 60 const int kMinimumPointerDistance = 50; | |
| 61 | 59 |
| 62 void InsertSyncPointAndAckForCompositor( | 60 void InsertSyncPointAndAckForCompositor( |
| 63 int renderer_host_id, | 61 int renderer_host_id, |
| 64 uint32 output_surface_id, | 62 uint32 output_surface_id, |
| 65 int route_id, | 63 int route_id, |
| 66 const gpu::Mailbox& return_mailbox, | 64 const gpu::Mailbox& return_mailbox, |
| 67 const gfx::Size return_size) { | 65 const gfx::Size return_size) { |
| 68 cc::CompositorFrameAck ack; | 66 cc::CompositorFrameAck ack; |
| 69 ack.gl_frame_data.reset(new cc::GLFrameData()); | 67 ack.gl_frame_data.reset(new cc::GLFrameData()); |
| 70 if (!return_mailbox.IsZero()) { | 68 if (!return_mailbox.IsZero()) { |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 | 614 |
| 617 content_view_core_->ShowDisambiguationPopup(target_rect, zoomed_bitmap); | 615 content_view_core_->ShowDisambiguationPopup(target_rect, zoomed_bitmap); |
| 618 } | 616 } |
| 619 | 617 |
| 620 scoped_ptr<SyntheticGestureTarget> | 618 scoped_ptr<SyntheticGestureTarget> |
| 621 RenderWidgetHostViewAndroid::CreateSyntheticGestureTarget() { | 619 RenderWidgetHostViewAndroid::CreateSyntheticGestureTarget() { |
| 622 return scoped_ptr<SyntheticGestureTarget>(new SyntheticGestureTargetAndroid( | 620 return scoped_ptr<SyntheticGestureTarget>(new SyntheticGestureTargetAndroid( |
| 623 host_, content_view_core_->CreateTouchEventSynthesizer())); | 621 host_, content_view_core_->CreateTouchEventSynthesizer())); |
| 624 } | 622 } |
| 625 | 623 |
| 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 | |
| 650 void RenderWidgetHostViewAndroid::OnAcceleratedCompositingStateChange() { | 624 void RenderWidgetHostViewAndroid::OnAcceleratedCompositingStateChange() { |
| 651 } | 625 } |
| 652 | 626 |
| 653 void RenderWidgetHostViewAndroid::SendDelegatedFrameAck( | 627 void RenderWidgetHostViewAndroid::SendDelegatedFrameAck( |
| 654 uint32 output_surface_id) { | 628 uint32 output_surface_id) { |
| 655 cc::CompositorFrameAck ack; | 629 cc::CompositorFrameAck ack; |
| 656 if (resource_collection_.get()) | 630 if (resource_collection_.get()) |
| 657 resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources); | 631 resource_collection_->TakeUnusedResourcesForChildCompositor(&ack.resources); |
| 658 RenderWidgetHostImpl::SendSwapCompositorFrameAck(host_->GetRoutingID(), | 632 RenderWidgetHostImpl::SendSwapCompositorFrameAck(host_->GetRoutingID(), |
| 659 output_surface_id, | 633 output_surface_id, |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1391 // RenderWidgetHostView, public: | 1365 // RenderWidgetHostView, public: |
| 1392 | 1366 |
| 1393 // static | 1367 // static |
| 1394 RenderWidgetHostView* | 1368 RenderWidgetHostView* |
| 1395 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 1369 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
| 1396 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 1370 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
| 1397 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 1371 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
| 1398 } | 1372 } |
| 1399 | 1373 |
| 1400 } // namespace content | 1374 } // namespace content |
| OLD | NEW |