| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 scoped_ptr<ui::TouchSelectionController> CreateSelectionController( | 267 scoped_ptr<ui::TouchSelectionController> CreateSelectionController( |
| 268 ui::TouchSelectionControllerClient* client, | 268 ui::TouchSelectionControllerClient* client, |
| 269 ContentViewCore* content_view_core) { | 269 ContentViewCore* content_view_core) { |
| 270 DCHECK(client); | 270 DCHECK(client); |
| 271 DCHECK(content_view_core); | 271 DCHECK(content_view_core); |
| 272 ui::TouchSelectionController::Config config; | 272 ui::TouchSelectionController::Config config; |
| 273 config.tap_timeout = base::TimeDelta::FromMilliseconds( | 273 config.tap_timeout = base::TimeDelta::FromMilliseconds( |
| 274 gfx::ViewConfiguration::GetTapTimeoutInMs()); | 274 gfx::ViewConfiguration::GetTapTimeoutInMs()); |
| 275 config.tap_slop = gfx::ViewConfiguration::GetTouchSlopInDips(); | 275 config.tap_slop = gfx::ViewConfiguration::GetTouchSlopInDips(); |
| 276 config.show_on_tap_for_empty_editable = false; | 276 config.show_on_tap_for_empty_editable = false; |
| 277 config.enable_adaptive_handle_orientation = |
| 278 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 279 switches::kEnableAdaptiveHandleOrientation); |
| 277 config.enable_longpress_drag_selection = | 280 config.enable_longpress_drag_selection = |
| 278 base::CommandLine::ForCurrentProcess()->HasSwitch( | 281 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 279 switches::kEnableLongpressDragSelection); | 282 switches::kEnableLongpressDragSelection); |
| 280 return make_scoped_ptr(new ui::TouchSelectionController(client, config)); | 283 return make_scoped_ptr(new ui::TouchSelectionController(client, config)); |
| 281 } | 284 } |
| 282 | 285 |
| 283 scoped_ptr<OverscrollControllerAndroid> CreateOverscrollController( | 286 scoped_ptr<OverscrollControllerAndroid> CreateOverscrollController( |
| 284 ContentViewCoreImpl* content_view_core) { | 287 ContentViewCoreImpl* content_view_core) { |
| 285 return make_scoped_ptr(new OverscrollControllerAndroid(content_view_core)); | 288 return make_scoped_ptr(new OverscrollControllerAndroid(content_view_core)); |
| 286 } | 289 } |
| (...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); | 1335 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); |
| 1333 | 1336 |
| 1334 if (selection_controller_) { | 1337 if (selection_controller_) { |
| 1335 selection_controller_->OnSelectionEditable( | 1338 selection_controller_->OnSelectionEditable( |
| 1336 frame_metadata.selection.is_editable); | 1339 frame_metadata.selection.is_editable); |
| 1337 selection_controller_->OnSelectionEmpty( | 1340 selection_controller_->OnSelectionEmpty( |
| 1338 frame_metadata.selection.is_empty_text_form_control); | 1341 frame_metadata.selection.is_empty_text_form_control); |
| 1339 selection_controller_->OnSelectionBoundsChanged( | 1342 selection_controller_->OnSelectionBoundsChanged( |
| 1340 ConvertSelectionBound(frame_metadata.selection.start), | 1343 ConvertSelectionBound(frame_metadata.selection.start), |
| 1341 ConvertSelectionBound(frame_metadata.selection.end)); | 1344 ConvertSelectionBound(frame_metadata.selection.end)); |
| 1345 |
| 1346 // Set parameters for adaptive handle orientation. |
| 1347 gfx::SizeF viewport_size(frame_metadata.scrollable_viewport_size); |
| 1348 viewport_size.Scale(frame_metadata.page_scale_factor); |
| 1349 gfx::RectF viewport_rect( |
| 1350 frame_metadata.location_bar_content_translation.x(), |
| 1351 frame_metadata.location_bar_content_translation.y(), |
| 1352 viewport_size.width(), viewport_size.height()); |
| 1353 selection_controller_->OnViewportChanged(viewport_rect); |
| 1342 } | 1354 } |
| 1343 | 1355 |
| 1344 // All offsets and sizes are in CSS pixels. | 1356 // All offsets and sizes are in CSS pixels. |
| 1345 content_view_core_->UpdateFrameInfo( | 1357 content_view_core_->UpdateFrameInfo( |
| 1346 frame_metadata.root_scroll_offset, | 1358 frame_metadata.root_scroll_offset, |
| 1347 frame_metadata.page_scale_factor, | 1359 frame_metadata.page_scale_factor, |
| 1348 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1360 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
| 1349 frame_metadata.max_page_scale_factor), | 1361 frame_metadata.max_page_scale_factor), |
| 1350 frame_metadata.root_layer_size, | 1362 frame_metadata.root_layer_size, |
| 1351 frame_metadata.scrollable_viewport_size, | 1363 frame_metadata.scrollable_viewport_size, |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2031 results->orientationAngle = display.RotationAsDegree(); | 2043 results->orientationAngle = display.RotationAsDegree(); |
| 2032 results->orientationType = | 2044 results->orientationType = |
| 2033 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2045 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 2034 gfx::DeviceDisplayInfo info; | 2046 gfx::DeviceDisplayInfo info; |
| 2035 results->depth = info.GetBitsPerPixel(); | 2047 results->depth = info.GetBitsPerPixel(); |
| 2036 results->depthPerComponent = info.GetBitsPerComponent(); | 2048 results->depthPerComponent = info.GetBitsPerComponent(); |
| 2037 results->isMonochrome = (results->depthPerComponent == 0); | 2049 results->isMonochrome = (results->depthPerComponent == 0); |
| 2038 } | 2050 } |
| 2039 | 2051 |
| 2040 } // namespace content | 2052 } // namespace content |
| OLD | NEW |