| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 scoped_ptr<ui::TouchSelectionController> CreateSelectionController( | 261 scoped_ptr<ui::TouchSelectionController> CreateSelectionController( |
| 262 ui::TouchSelectionControllerClient* client, | 262 ui::TouchSelectionControllerClient* client, |
| 263 ContentViewCore* content_view_core) { | 263 ContentViewCore* content_view_core) { |
| 264 DCHECK(client); | 264 DCHECK(client); |
| 265 DCHECK(content_view_core); | 265 DCHECK(content_view_core); |
| 266 int tap_timeout_ms = gfx::ViewConfiguration::GetTapTimeoutInMs(); | 266 int tap_timeout_ms = gfx::ViewConfiguration::GetTapTimeoutInMs(); |
| 267 int touch_slop_pixels = gfx::ViewConfiguration::GetTouchSlopInPixels(); | 267 int touch_slop_pixels = gfx::ViewConfiguration::GetTouchSlopInPixels(); |
| 268 return make_scoped_ptr(new ui::TouchSelectionController( | 268 return make_scoped_ptr(new ui::TouchSelectionController( |
| 269 client, | 269 client, |
| 270 base::TimeDelta::FromMilliseconds(tap_timeout_ms), | 270 base::TimeDelta::FromMilliseconds(tap_timeout_ms), |
| 271 touch_slop_pixels / content_view_core->GetDpiScale())); | 271 touch_slop_pixels / content_view_core->GetDpiScale(), |
| 272 false)); |
| 272 } | 273 } |
| 273 | 274 |
| 274 scoped_ptr<OverscrollControllerAndroid> CreateOverscrollController( | 275 scoped_ptr<OverscrollControllerAndroid> CreateOverscrollController( |
| 275 ContentViewCore* content_view_core) { | 276 ContentViewCore* content_view_core) { |
| 276 DCHECK(content_view_core); | 277 DCHECK(content_view_core); |
| 277 ui::WindowAndroid* window = content_view_core->GetWindowAndroid(); | 278 ui::WindowAndroid* window = content_view_core->GetWindowAndroid(); |
| 278 DCHECK(window); | 279 DCHECK(window); |
| 279 ui::WindowAndroidCompositor* compositor = window->GetCompositor(); | 280 ui::WindowAndroidCompositor* compositor = window->GetCompositor(); |
| 280 DCHECK(compositor); | 281 DCHECK(compositor); |
| 281 return make_scoped_ptr(new OverscrollControllerAndroid( | 282 return make_scoped_ptr(new OverscrollControllerAndroid( |
| (...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 gesture_provider_.SetDoubleTapSupportForPageEnabled( | 1343 gesture_provider_.SetDoubleTapSupportForPageEnabled( |
| 1343 !has_fixed_page_scale && !has_mobile_viewport); | 1344 !has_fixed_page_scale && !has_mobile_viewport); |
| 1344 | 1345 |
| 1345 if (!content_view_core_) | 1346 if (!content_view_core_) |
| 1346 return; | 1347 return; |
| 1347 | 1348 |
| 1348 if (overscroll_controller_) | 1349 if (overscroll_controller_) |
| 1349 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); | 1350 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); |
| 1350 | 1351 |
| 1351 if (selection_controller_) { | 1352 if (selection_controller_) { |
| 1352 selection_controller_->OnSelectionBoundsChanged( | 1353 selection_controller_->OnSelectionBoundsUpdated( |
| 1353 ui::SelectionBound(frame_metadata.selection_start), | 1354 ui::SelectionBound(frame_metadata.selection_start), |
| 1354 ui::SelectionBound(frame_metadata.selection_end)); | 1355 ui::SelectionBound(frame_metadata.selection_end)); |
| 1355 } | 1356 } |
| 1356 | 1357 |
| 1357 // All offsets and sizes are in CSS pixels. | 1358 // All offsets and sizes are in CSS pixels. |
| 1358 content_view_core_->UpdateFrameInfo( | 1359 content_view_core_->UpdateFrameInfo( |
| 1359 frame_metadata.root_scroll_offset, | 1360 frame_metadata.root_scroll_offset, |
| 1360 frame_metadata.page_scale_factor, | 1361 frame_metadata.page_scale_factor, |
| 1361 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1362 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
| 1362 frame_metadata.max_page_scale_factor), | 1363 frame_metadata.max_page_scale_factor), |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1661 // of the region have been updated, explicitly set the properties now. | 1662 // of the region have been updated, explicitly set the properties now. |
| 1662 // TODO(jdduke): Remove this workaround when auxiliary paste popup | 1663 // TODO(jdduke): Remove this workaround when auxiliary paste popup |
| 1663 // notifications are no longer required, crbug.com/398170. | 1664 // notifications are no longer required, crbug.com/398170. |
| 1664 ui::SelectionBound insertion_bound; | 1665 ui::SelectionBound insertion_bound; |
| 1665 insertion_bound.set_type(ui::SelectionBound::CENTER); | 1666 insertion_bound.set_type(ui::SelectionBound::CENTER); |
| 1666 insertion_bound.set_visible(true); | 1667 insertion_bound.set_visible(true); |
| 1667 insertion_bound.SetEdge(point, point); | 1668 insertion_bound.SetEdge(point, point); |
| 1668 selection_controller_->HideAndDisallowShowingAutomatically(); | 1669 selection_controller_->HideAndDisallowShowingAutomatically(); |
| 1669 selection_controller_->OnSelectionEditable(true); | 1670 selection_controller_->OnSelectionEditable(true); |
| 1670 selection_controller_->OnSelectionEmpty(true); | 1671 selection_controller_->OnSelectionEmpty(true); |
| 1671 selection_controller_->OnSelectionBoundsChanged(insertion_bound, | 1672 selection_controller_->OnSelectionBoundsUpdated(insertion_bound, |
| 1672 insertion_bound); | 1673 insertion_bound); |
| 1673 selection_controller_->AllowShowingFromCurrentSelection(); | 1674 selection_controller_->AllowShowingFromCurrentSelection(); |
| 1674 } | 1675 } |
| 1675 | 1676 |
| 1676 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { | 1677 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { |
| 1677 return cached_background_color_; | 1678 return cached_background_color_; |
| 1678 } | 1679 } |
| 1679 | 1680 |
| 1680 void RenderWidgetHostViewAndroid::DidOverscroll( | 1681 void RenderWidgetHostViewAndroid::DidOverscroll( |
| 1681 const DidOverscrollParams& params) { | 1682 const DidOverscrollParams& params) { |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1940 results->orientationAngle = display.RotationAsDegree(); | 1941 results->orientationAngle = display.RotationAsDegree(); |
| 1941 results->orientationType = | 1942 results->orientationType = |
| 1942 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1943 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 1943 gfx::DeviceDisplayInfo info; | 1944 gfx::DeviceDisplayInfo info; |
| 1944 results->depth = info.GetBitsPerPixel(); | 1945 results->depth = info.GetBitsPerPixel(); |
| 1945 results->depthPerComponent = info.GetBitsPerComponent(); | 1946 results->depthPerComponent = info.GetBitsPerComponent(); |
| 1946 results->isMonochrome = (results->depthPerComponent == 0); | 1947 results->isMonochrome = (results->depthPerComponent == 0); |
| 1947 } | 1948 } |
| 1948 | 1949 |
| 1949 } // namespace content | 1950 } // namespace content |
| OLD | NEW |