| 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 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1341 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); | 1344 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); |
| 1342 | 1345 |
| 1343 if (selection_controller_) { | 1346 if (selection_controller_) { |
| 1344 selection_controller_->OnSelectionEditable( | 1347 selection_controller_->OnSelectionEditable( |
| 1345 frame_metadata.selection.is_editable); | 1348 frame_metadata.selection.is_editable); |
| 1346 selection_controller_->OnSelectionEmpty( | 1349 selection_controller_->OnSelectionEmpty( |
| 1347 frame_metadata.selection.is_empty_text_form_control); | 1350 frame_metadata.selection.is_empty_text_form_control); |
| 1348 selection_controller_->OnSelectionBoundsChanged( | 1351 selection_controller_->OnSelectionBoundsChanged( |
| 1349 ConvertSelectionBound(frame_metadata.selection.start), | 1352 ConvertSelectionBound(frame_metadata.selection.start), |
| 1350 ConvertSelectionBound(frame_metadata.selection.end)); | 1353 ConvertSelectionBound(frame_metadata.selection.end)); |
| 1354 |
| 1355 // Set parameters for adaptive handle orientation |
| 1356 gfx::SizeF viewport_size(frame_metadata.scrollable_viewport_size); |
| 1357 viewport_size.Scale(frame_metadata.page_scale_factor); |
| 1358 gfx::RectF viewport_rect( |
| 1359 frame_metadata.location_bar_content_translation.x(), |
| 1360 frame_metadata.location_bar_content_translation.y(), |
| 1361 viewport_size.width(), viewport_size.height()); |
| 1362 selection_controller_->OnViewportChanged(viewport_rect); |
| 1351 } | 1363 } |
| 1352 | 1364 |
| 1353 // All offsets and sizes are in CSS pixels. | 1365 // All offsets and sizes are in CSS pixels. |
| 1354 content_view_core_->UpdateFrameInfo( | 1366 content_view_core_->UpdateFrameInfo( |
| 1355 frame_metadata.root_scroll_offset, | 1367 frame_metadata.root_scroll_offset, |
| 1356 frame_metadata.page_scale_factor, | 1368 frame_metadata.page_scale_factor, |
| 1357 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1369 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
| 1358 frame_metadata.max_page_scale_factor), | 1370 frame_metadata.max_page_scale_factor), |
| 1359 frame_metadata.root_layer_size, | 1371 frame_metadata.root_layer_size, |
| 1360 frame_metadata.scrollable_viewport_size, | 1372 frame_metadata.scrollable_viewport_size, |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2040 results->orientationAngle = display.RotationAsDegree(); | 2052 results->orientationAngle = display.RotationAsDegree(); |
| 2041 results->orientationType = | 2053 results->orientationType = |
| 2042 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2054 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 2043 gfx::DeviceDisplayInfo info; | 2055 gfx::DeviceDisplayInfo info; |
| 2044 results->depth = info.GetBitsPerPixel(); | 2056 results->depth = info.GetBitsPerPixel(); |
| 2045 results->depthPerComponent = info.GetBitsPerComponent(); | 2057 results->depthPerComponent = info.GetBitsPerComponent(); |
| 2046 results->isMonochrome = (results->depthPerComponent == 0); | 2058 results->isMonochrome = (results->depthPerComponent == 0); |
| 2047 } | 2059 } |
| 2048 | 2060 |
| 2049 } // namespace content | 2061 } // namespace content |
| OLD | NEW |