| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 #include "ui/events/blink/blink_event_util.h" | 80 #include "ui/events/blink/blink_event_util.h" |
| 81 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" | 81 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" |
| 82 #include "ui/events/gesture_detection/motion_event.h" | 82 #include "ui/events/gesture_detection/motion_event.h" |
| 83 #include "ui/gfx/android/device_display_info.h" | 83 #include "ui/gfx/android/device_display_info.h" |
| 84 #include "ui/gfx/android/java_bitmap.h" | 84 #include "ui/gfx/android/java_bitmap.h" |
| 85 #include "ui/gfx/android/view_configuration.h" | 85 #include "ui/gfx/android/view_configuration.h" |
| 86 #include "ui/gfx/display.h" | 86 #include "ui/gfx/display.h" |
| 87 #include "ui/gfx/geometry/dip_util.h" | 87 #include "ui/gfx/geometry/dip_util.h" |
| 88 #include "ui/gfx/geometry/size_conversions.h" | 88 #include "ui/gfx/geometry/size_conversions.h" |
| 89 #include "ui/gfx/screen.h" | 89 #include "ui/gfx/screen.h" |
| 90 #include "ui/touch_selection/touch_selection_controller.h" | |
| 91 | 90 |
| 92 namespace content { | 91 namespace content { |
| 93 | 92 |
| 94 namespace { | 93 namespace { |
| 95 | 94 |
| 96 void SatisfyCallback(cc::SurfaceManager* manager, | 95 void SatisfyCallback(cc::SurfaceManager* manager, |
| 97 cc::SurfaceSequence sequence) { | 96 cc::SurfaceSequence sequence) { |
| 98 std::vector<uint32_t> sequences; | 97 std::vector<uint32_t> sequences; |
| 99 sequences.push_back(sequence.sequence); | 98 sequences.push_back(sequence.sequence); |
| 100 manager->DidSatisfySequences(sequence.id_namespace, &sequences); | 99 manager->DidSatisfySequences(sequence.id_namespace, &sequences); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 latency_info.AddLatencyNumberWithTimestamp( | 269 latency_info.AddLatencyNumberWithTimestamp( |
| 271 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, | 270 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, |
| 272 0, | 271 0, |
| 273 0, | 272 0, |
| 274 base::TimeTicks() + base::TimeDelta::FromMicroseconds(time_micros), | 273 base::TimeTicks() + base::TimeDelta::FromMicroseconds(time_micros), |
| 275 1); | 274 1); |
| 276 } | 275 } |
| 277 return latency_info; | 276 return latency_info; |
| 278 } | 277 } |
| 279 | 278 |
| 280 scoped_ptr<ui::TouchSelectionController> CreateSelectionController( | 279 scoped_ptr<ui::TouchSelectionControllerAndroid> CreateSelectionController( |
| 281 ui::TouchSelectionControllerClient* client, | 280 ui::TouchSelectionControllerAndroidClient* client, |
| 282 ContentViewCore* content_view_core) { | 281 ContentViewCore* content_view_core) { |
| 283 DCHECK(client); | 282 DCHECK(client); |
| 284 DCHECK(content_view_core); | 283 DCHECK(content_view_core); |
| 285 int tap_timeout_ms = gfx::ViewConfiguration::GetTapTimeoutInMs(); | 284 int tap_timeout_ms = gfx::ViewConfiguration::GetTapTimeoutInMs(); |
| 286 int touch_slop_pixels = gfx::ViewConfiguration::GetTouchSlopInPixels(); | 285 int touch_slop_pixels = gfx::ViewConfiguration::GetTouchSlopInPixels(); |
| 287 bool show_on_tap_for_empty_editable = false; | 286 return make_scoped_ptr(new ui::TouchSelectionControllerAndroid( |
| 288 return make_scoped_ptr(new ui::TouchSelectionController( | |
| 289 client, | 287 client, |
| 290 base::TimeDelta::FromMilliseconds(tap_timeout_ms), | 288 base::TimeDelta::FromMilliseconds(tap_timeout_ms), |
| 291 touch_slop_pixels / content_view_core->GetDpiScale(), | 289 touch_slop_pixels / content_view_core->GetDpiScale())); |
| 292 show_on_tap_for_empty_editable)); | |
| 293 } | 290 } |
| 294 | 291 |
| 295 scoped_ptr<OverscrollControllerAndroid> CreateOverscrollController( | 292 scoped_ptr<OverscrollControllerAndroid> CreateOverscrollController( |
| 296 ContentViewCore* content_view_core) { | 293 ContentViewCore* content_view_core) { |
| 297 DCHECK(content_view_core); | 294 DCHECK(content_view_core); |
| 298 ui::WindowAndroid* window = content_view_core->GetWindowAndroid(); | 295 ui::WindowAndroid* window = content_view_core->GetWindowAndroid(); |
| 299 DCHECK(window); | 296 DCHECK(window); |
| 300 ui::WindowAndroidCompositor* compositor = window->GetCompositor(); | 297 ui::WindowAndroidCompositor* compositor = window->GetCompositor(); |
| 301 DCHECK(compositor); | 298 DCHECK(compositor); |
| 302 return make_scoped_ptr(new OverscrollControllerAndroid( | 299 return make_scoped_ptr(new OverscrollControllerAndroid( |
| (...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1414 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata); | 1411 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata); |
| 1415 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); | 1412 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); |
| 1416 | 1413 |
| 1417 if (!content_view_core_) | 1414 if (!content_view_core_) |
| 1418 return; | 1415 return; |
| 1419 | 1416 |
| 1420 if (overscroll_controller_) | 1417 if (overscroll_controller_) |
| 1421 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); | 1418 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); |
| 1422 | 1419 |
| 1423 if (selection_controller_) { | 1420 if (selection_controller_) { |
| 1424 selection_controller_->OnSelectionBoundsChanged( | 1421 selection_controller_->OnSelectionBoundsUpdated( |
| 1425 ConvertSelectionBound(frame_metadata.selection_start), | 1422 ConvertSelectionBound(frame_metadata.selection_start), |
| 1426 ConvertSelectionBound(frame_metadata.selection_end)); | 1423 ConvertSelectionBound(frame_metadata.selection_end)); |
| 1427 } | 1424 } |
| 1428 | 1425 |
| 1429 // All offsets and sizes are in CSS pixels. | 1426 // All offsets and sizes are in CSS pixels. |
| 1430 content_view_core_->UpdateFrameInfo( | 1427 content_view_core_->UpdateFrameInfo( |
| 1431 frame_metadata.root_scroll_offset, | 1428 frame_metadata.root_scroll_offset, |
| 1432 frame_metadata.page_scale_factor, | 1429 frame_metadata.page_scale_factor, |
| 1433 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1430 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
| 1434 frame_metadata.max_page_scale_factor), | 1431 frame_metadata.max_page_scale_factor), |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1804 // of the region have been updated, explicitly set the properties now. | 1801 // of the region have been updated, explicitly set the properties now. |
| 1805 // TODO(jdduke): Remove this workaround when auxiliary paste popup | 1802 // TODO(jdduke): Remove this workaround when auxiliary paste popup |
| 1806 // notifications are no longer required, crbug.com/398170. | 1803 // notifications are no longer required, crbug.com/398170. |
| 1807 ui::SelectionBound insertion_bound; | 1804 ui::SelectionBound insertion_bound; |
| 1808 insertion_bound.set_type(ui::SelectionBound::CENTER); | 1805 insertion_bound.set_type(ui::SelectionBound::CENTER); |
| 1809 insertion_bound.set_visible(true); | 1806 insertion_bound.set_visible(true); |
| 1810 insertion_bound.SetEdge(point, point); | 1807 insertion_bound.SetEdge(point, point); |
| 1811 selection_controller_->HideAndDisallowShowingAutomatically(); | 1808 selection_controller_->HideAndDisallowShowingAutomatically(); |
| 1812 selection_controller_->OnSelectionEditable(true); | 1809 selection_controller_->OnSelectionEditable(true); |
| 1813 selection_controller_->OnSelectionEmpty(true); | 1810 selection_controller_->OnSelectionEmpty(true); |
| 1814 selection_controller_->OnSelectionBoundsChanged(insertion_bound, | 1811 selection_controller_->OnSelectionBoundsUpdated(insertion_bound, |
| 1815 insertion_bound); | 1812 insertion_bound); |
| 1816 selection_controller_->AllowShowingFromCurrentSelection(); | 1813 selection_controller_->AllowShowingFromCurrentSelection(); |
| 1817 } | 1814 } |
| 1818 | 1815 |
| 1819 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { | 1816 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { |
| 1820 return cached_background_color_; | 1817 return cached_background_color_; |
| 1821 } | 1818 } |
| 1822 | 1819 |
| 1823 void RenderWidgetHostViewAndroid::DidOverscroll( | 1820 void RenderWidgetHostViewAndroid::DidOverscroll( |
| 1824 const DidOverscrollParams& params) { | 1821 const DidOverscrollParams& params) { |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2113 results->orientationAngle = display.RotationAsDegree(); | 2110 results->orientationAngle = display.RotationAsDegree(); |
| 2114 results->orientationType = | 2111 results->orientationType = |
| 2115 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2112 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 2116 gfx::DeviceDisplayInfo info; | 2113 gfx::DeviceDisplayInfo info; |
| 2117 results->depth = info.GetBitsPerPixel(); | 2114 results->depth = info.GetBitsPerPixel(); |
| 2118 results->depthPerComponent = info.GetBitsPerComponent(); | 2115 results->depthPerComponent = info.GetBitsPerComponent(); |
| 2119 results->isMonochrome = (results->depthPerComponent == 0); | 2116 results->isMonochrome = (results->depthPerComponent == 0); |
| 2120 } | 2117 } |
| 2121 | 2118 |
| 2122 } // namespace content | 2119 } // namespace content |
| OLD | NEW |