| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 scoped_ptr<ui::TouchSelectionController> CreateSelectionController( | 262 scoped_ptr<ui::TouchSelectionController> CreateSelectionController( |
| 263 ui::TouchSelectionControllerClient* client, | 263 ui::TouchSelectionControllerClient* client, |
| 264 ContentViewCore* content_view_core) { | 264 ContentViewCore* content_view_core) { |
| 265 DCHECK(client); | 265 DCHECK(client); |
| 266 DCHECK(content_view_core); | 266 DCHECK(content_view_core); |
| 267 ui::TouchSelectionController::Config config; | 267 ui::TouchSelectionController::Config config; |
| 268 config.max_tap_duration = base::TimeDelta::FromMilliseconds( | 268 config.max_tap_duration = base::TimeDelta::FromMilliseconds( |
| 269 gfx::ViewConfiguration::GetLongPressTimeoutInMs()); | 269 gfx::ViewConfiguration::GetLongPressTimeoutInMs()); |
| 270 config.tap_slop = gfx::ViewConfiguration::GetTouchSlopInDips(); | 270 config.tap_slop = gfx::ViewConfiguration::GetTouchSlopInDips(); |
| 271 config.show_on_tap_for_empty_editable = false; | 271 config.show_on_tap_for_empty_editable = false; |
| 272 config.enable_adaptive_handle_orientation = |
| 273 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 274 switches::kEnableAdaptiveHandleOrientation); |
| 272 config.enable_longpress_drag_selection = | 275 config.enable_longpress_drag_selection = |
| 273 base::CommandLine::ForCurrentProcess()->HasSwitch( | 276 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 274 switches::kEnableLongpressDragSelection); | 277 switches::kEnableLongpressDragSelection); |
| 275 return make_scoped_ptr(new ui::TouchSelectionController(client, config)); | 278 return make_scoped_ptr(new ui::TouchSelectionController(client, config)); |
| 276 } | 279 } |
| 277 | 280 |
| 278 scoped_ptr<OverscrollControllerAndroid> CreateOverscrollController( | 281 scoped_ptr<OverscrollControllerAndroid> CreateOverscrollController( |
| 279 ContentViewCoreImpl* content_view_core) { | 282 ContentViewCoreImpl* content_view_core) { |
| 280 return make_scoped_ptr(new OverscrollControllerAndroid(content_view_core)); | 283 return make_scoped_ptr(new OverscrollControllerAndroid(content_view_core)); |
| 281 } | 284 } |
| (...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); | 1314 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); |
| 1312 | 1315 |
| 1313 if (selection_controller_) { | 1316 if (selection_controller_) { |
| 1314 selection_controller_->OnSelectionEditable( | 1317 selection_controller_->OnSelectionEditable( |
| 1315 frame_metadata.selection.is_editable); | 1318 frame_metadata.selection.is_editable); |
| 1316 selection_controller_->OnSelectionEmpty( | 1319 selection_controller_->OnSelectionEmpty( |
| 1317 frame_metadata.selection.is_empty_text_form_control); | 1320 frame_metadata.selection.is_empty_text_form_control); |
| 1318 selection_controller_->OnSelectionBoundsChanged( | 1321 selection_controller_->OnSelectionBoundsChanged( |
| 1319 ConvertSelectionBound(frame_metadata.selection.start), | 1322 ConvertSelectionBound(frame_metadata.selection.start), |
| 1320 ConvertSelectionBound(frame_metadata.selection.end)); | 1323 ConvertSelectionBound(frame_metadata.selection.end)); |
| 1324 |
| 1325 // Set parameters for adaptive handle orientation. |
| 1326 gfx::SizeF viewport_size(frame_metadata.scrollable_viewport_size); |
| 1327 viewport_size.Scale(frame_metadata.page_scale_factor); |
| 1328 gfx::RectF viewport_rect( |
| 1329 frame_metadata.location_bar_content_translation.x(), |
| 1330 frame_metadata.location_bar_content_translation.y(), |
| 1331 viewport_size.width(), viewport_size.height()); |
| 1332 selection_controller_->OnViewportChanged(viewport_rect); |
| 1321 } | 1333 } |
| 1322 | 1334 |
| 1323 // All offsets and sizes are in CSS pixels. | 1335 // All offsets and sizes are in CSS pixels. |
| 1324 content_view_core_->UpdateFrameInfo( | 1336 content_view_core_->UpdateFrameInfo( |
| 1325 frame_metadata.root_scroll_offset, | 1337 frame_metadata.root_scroll_offset, |
| 1326 frame_metadata.page_scale_factor, | 1338 frame_metadata.page_scale_factor, |
| 1327 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1339 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
| 1328 frame_metadata.max_page_scale_factor), | 1340 frame_metadata.max_page_scale_factor), |
| 1329 frame_metadata.root_layer_size, | 1341 frame_metadata.root_layer_size, |
| 1330 frame_metadata.scrollable_viewport_size, | 1342 frame_metadata.scrollable_viewport_size, |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 results->orientationAngle = display.RotationAsDegree(); | 2026 results->orientationAngle = display.RotationAsDegree(); |
| 2015 results->orientationType = | 2027 results->orientationType = |
| 2016 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 2028 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
| 2017 gfx::DeviceDisplayInfo info; | 2029 gfx::DeviceDisplayInfo info; |
| 2018 results->depth = info.GetBitsPerPixel(); | 2030 results->depth = info.GetBitsPerPixel(); |
| 2019 results->depthPerComponent = info.GetBitsPerComponent(); | 2031 results->depthPerComponent = info.GetBitsPerComponent(); |
| 2020 results->isMonochrome = (results->depthPerComponent == 0); | 2032 results->isMonochrome = (results->depthPerComponent == 0); |
| 2021 } | 2033 } |
| 2022 | 2034 |
| 2023 } // namespace content | 2035 } // namespace content |
| OLD | NEW |