| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 #include "ui/android/window_android_compositor.h" | 79 #include "ui/android/window_android_compositor.h" |
| 80 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" | 80 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" |
| 81 #include "ui/events/gesture_detection/motion_event.h" | 81 #include "ui/events/gesture_detection/motion_event.h" |
| 82 #include "ui/gfx/android/device_display_info.h" | 82 #include "ui/gfx/android/device_display_info.h" |
| 83 #include "ui/gfx/android/java_bitmap.h" | 83 #include "ui/gfx/android/java_bitmap.h" |
| 84 #include "ui/gfx/android/view_configuration.h" | 84 #include "ui/gfx/android/view_configuration.h" |
| 85 #include "ui/gfx/display.h" | 85 #include "ui/gfx/display.h" |
| 86 #include "ui/gfx/geometry/dip_util.h" | 86 #include "ui/gfx/geometry/dip_util.h" |
| 87 #include "ui/gfx/geometry/size_conversions.h" | 87 #include "ui/gfx/geometry/size_conversions.h" |
| 88 #include "ui/gfx/screen.h" | 88 #include "ui/gfx/screen.h" |
| 89 #include "ui/touch_selection/touch_selection_controller.h" | |
| 90 | 89 |
| 91 namespace content { | 90 namespace content { |
| 92 | 91 |
| 93 namespace { | 92 namespace { |
| 94 | 93 |
| 95 void SatisfyCallback(cc::SurfaceManager* manager, | 94 void SatisfyCallback(cc::SurfaceManager* manager, |
| 96 cc::SurfaceSequence sequence) { | 95 cc::SurfaceSequence sequence) { |
| 97 std::vector<uint32_t> sequences; | 96 std::vector<uint32_t> sequences; |
| 98 sequences.push_back(sequence.sequence); | 97 sequences.push_back(sequence.sequence); |
| 99 manager->DidSatisfySequences(sequence.id_namespace, &sequences); | 98 manager->DidSatisfySequences(sequence.id_namespace, &sequences); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 latency_info.AddLatencyNumberWithTimestamp( | 268 latency_info.AddLatencyNumberWithTimestamp( |
| 270 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, | 269 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, |
| 271 0, | 270 0, |
| 272 0, | 271 0, |
| 273 base::TimeTicks() + base::TimeDelta::FromMicroseconds(time_micros), | 272 base::TimeTicks() + base::TimeDelta::FromMicroseconds(time_micros), |
| 274 1); | 273 1); |
| 275 } | 274 } |
| 276 return latency_info; | 275 return latency_info; |
| 277 } | 276 } |
| 278 | 277 |
| 279 scoped_ptr<ui::TouchSelectionController> CreateSelectionController( | 278 scoped_ptr<ui::TouchSelectionControllerAndroid> CreateSelectionController( |
| 280 ui::TouchSelectionControllerClient* client, | 279 ui::TouchSelectionControllerAndroidClient* client, |
| 281 ContentViewCore* content_view_core) { | 280 ContentViewCore* content_view_core) { |
| 282 DCHECK(client); | 281 DCHECK(client); |
| 283 DCHECK(content_view_core); | 282 DCHECK(content_view_core); |
| 284 int tap_timeout_ms = gfx::ViewConfiguration::GetTapTimeoutInMs(); | 283 int tap_timeout_ms = gfx::ViewConfiguration::GetTapTimeoutInMs(); |
| 285 int touch_slop_pixels = gfx::ViewConfiguration::GetTouchSlopInPixels(); | 284 int touch_slop_pixels = gfx::ViewConfiguration::GetTouchSlopInPixels(); |
| 286 bool show_on_tap_for_empty_editable = false; | 285 return make_scoped_ptr(new ui::TouchSelectionControllerAndroid( |
| 287 return make_scoped_ptr(new ui::TouchSelectionController( | |
| 288 client, | 286 client, |
| 289 base::TimeDelta::FromMilliseconds(tap_timeout_ms), | 287 base::TimeDelta::FromMilliseconds(tap_timeout_ms), |
| 290 touch_slop_pixels / content_view_core->GetDpiScale(), | 288 touch_slop_pixels / content_view_core->GetDpiScale())); |
| 291 show_on_tap_for_empty_editable)); | |
| 292 } | 289 } |
| 293 | 290 |
| 294 scoped_ptr<OverscrollControllerAndroid> CreateOverscrollController( | 291 scoped_ptr<OverscrollControllerAndroid> CreateOverscrollController( |
| 295 ContentViewCore* content_view_core) { | 292 ContentViewCore* content_view_core) { |
| 296 DCHECK(content_view_core); | 293 DCHECK(content_view_core); |
| 297 ui::WindowAndroid* window = content_view_core->GetWindowAndroid(); | 294 ui::WindowAndroid* window = content_view_core->GetWindowAndroid(); |
| 298 DCHECK(window); | 295 DCHECK(window); |
| 299 ui::WindowAndroidCompositor* compositor = window->GetCompositor(); | 296 ui::WindowAndroidCompositor* compositor = window->GetCompositor(); |
| 300 DCHECK(compositor); | 297 DCHECK(compositor); |
| 301 return make_scoped_ptr(new OverscrollControllerAndroid( | 298 return make_scoped_ptr(new OverscrollControllerAndroid( |
| (...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata); | 1444 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata); |
| 1448 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); | 1445 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); |
| 1449 | 1446 |
| 1450 if (!content_view_core_) | 1447 if (!content_view_core_) |
| 1451 return; | 1448 return; |
| 1452 | 1449 |
| 1453 if (overscroll_controller_) | 1450 if (overscroll_controller_) |
| 1454 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); | 1451 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); |
| 1455 | 1452 |
| 1456 if (selection_controller_) { | 1453 if (selection_controller_) { |
| 1457 selection_controller_->OnSelectionBoundsChanged( | 1454 selection_controller_->OnSelectionBoundsUpdated( |
| 1458 ConvertSelectionBound(frame_metadata.selection_start), | 1455 ConvertSelectionBound(frame_metadata.selection_start), |
| 1459 ConvertSelectionBound(frame_metadata.selection_end)); | 1456 ConvertSelectionBound(frame_metadata.selection_end)); |
| 1460 } | 1457 } |
| 1461 | 1458 |
| 1462 // All offsets and sizes are in CSS pixels. | 1459 // All offsets and sizes are in CSS pixels. |
| 1463 content_view_core_->UpdateFrameInfo( | 1460 content_view_core_->UpdateFrameInfo( |
| 1464 frame_metadata.root_scroll_offset, | 1461 frame_metadata.root_scroll_offset, |
| 1465 frame_metadata.page_scale_factor, | 1462 frame_metadata.page_scale_factor, |
| 1466 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1463 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
| 1467 frame_metadata.max_page_scale_factor), | 1464 frame_metadata.max_page_scale_factor), |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 // of the region have been updated, explicitly set the properties now. | 1764 // of the region have been updated, explicitly set the properties now. |
| 1768 // TODO(jdduke): Remove this workaround when auxiliary paste popup | 1765 // TODO(jdduke): Remove this workaround when auxiliary paste popup |
| 1769 // notifications are no longer required, crbug.com/398170. | 1766 // notifications are no longer required, crbug.com/398170. |
| 1770 ui::SelectionBound insertion_bound; | 1767 ui::SelectionBound insertion_bound; |
| 1771 insertion_bound.set_type(ui::SelectionBound::CENTER); | 1768 insertion_bound.set_type(ui::SelectionBound::CENTER); |
| 1772 insertion_bound.set_visible(true); | 1769 insertion_bound.set_visible(true); |
| 1773 insertion_bound.SetEdge(point, point); | 1770 insertion_bound.SetEdge(point, point); |
| 1774 selection_controller_->HideAndDisallowShowingAutomatically(); | 1771 selection_controller_->HideAndDisallowShowingAutomatically(); |
| 1775 selection_controller_->OnSelectionEditable(true); | 1772 selection_controller_->OnSelectionEditable(true); |
| 1776 selection_controller_->OnSelectionEmpty(true); | 1773 selection_controller_->OnSelectionEmpty(true); |
| 1777 selection_controller_->OnSelectionBoundsChanged(insertion_bound, | 1774 selection_controller_->OnSelectionBoundsUpdated(insertion_bound, |
| 1778 insertion_bound); | 1775 insertion_bound); |
| 1779 selection_controller_->AllowShowingFromCurrentSelection(); | 1776 selection_controller_->AllowShowingFromCurrentSelection(); |
| 1780 } | 1777 } |
| 1781 | 1778 |
| 1782 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { | 1779 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { |
| 1783 return cached_background_color_; | 1780 return cached_background_color_; |
| 1784 } | 1781 } |
| 1785 | 1782 |
| 1786 void RenderWidgetHostViewAndroid::DidOverscroll( | 1783 void RenderWidgetHostViewAndroid::DidOverscroll( |
| 1787 const DidOverscrollParams& params) { | 1784 const DidOverscrollParams& params) { |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2047 results->orientationAngle = display.RotationAsDegree(); | 2044 results->orientationAngle = display.RotationAsDegree(); |
| 2048 results->orientationType = | 2045 results->orientationType = |
| 2049 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2046 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 2050 gfx::DeviceDisplayInfo info; | 2047 gfx::DeviceDisplayInfo info; |
| 2051 results->depth = info.GetBitsPerPixel(); | 2048 results->depth = info.GetBitsPerPixel(); |
| 2052 results->depthPerComponent = info.GetBitsPerComponent(); | 2049 results->depthPerComponent = info.GetBitsPerComponent(); |
| 2053 results->isMonochrome = (results->depthPerComponent == 0); | 2050 results->isMonochrome = (results->depthPerComponent == 0); |
| 2054 } | 2051 } |
| 2055 | 2052 |
| 2056 } // namespace content | 2053 } // namespace content |
| OLD | NEW |