Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_android.cc

Issue 481683003: Support for Adaptive Handle Orientation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 scoped_ptr<ui::TouchSelectionController> CreateSelectionController( 263 scoped_ptr<ui::TouchSelectionController> CreateSelectionController(
264 ui::TouchSelectionControllerClient* client, 264 ui::TouchSelectionControllerClient* client,
265 ContentViewCore* content_view_core) { 265 ContentViewCore* content_view_core) {
266 DCHECK(client); 266 DCHECK(client);
267 DCHECK(content_view_core); 267 DCHECK(content_view_core);
268 ui::TouchSelectionController::Config config; 268 ui::TouchSelectionController::Config config;
269 config.max_tap_duration = base::TimeDelta::FromMilliseconds( 269 config.max_tap_duration = base::TimeDelta::FromMilliseconds(
270 gfx::ViewConfiguration::GetLongPressTimeoutInMs()); 270 gfx::ViewConfiguration::GetLongPressTimeoutInMs());
271 config.tap_slop = gfx::ViewConfiguration::GetTouchSlopInDips(); 271 config.tap_slop = gfx::ViewConfiguration::GetTouchSlopInDips();
272 config.show_on_tap_for_empty_editable = false; 272 config.show_on_tap_for_empty_editable = false;
273 config.enable_adaptive_handle_orientation =
274 base::CommandLine::ForCurrentProcess()->HasSwitch(
275 switches::kEnableAdaptiveHandleOrientation);
273 config.enable_longpress_drag_selection = 276 config.enable_longpress_drag_selection =
274 base::CommandLine::ForCurrentProcess()->HasSwitch( 277 base::CommandLine::ForCurrentProcess()->HasSwitch(
275 switches::kEnableLongpressDragSelection); 278 switches::kEnableLongpressDragSelection);
276 return make_scoped_ptr(new ui::TouchSelectionController(client, config)); 279 return make_scoped_ptr(new ui::TouchSelectionController(client, config));
277 } 280 }
278 281
279 scoped_ptr<OverscrollControllerAndroid> CreateOverscrollController( 282 scoped_ptr<OverscrollControllerAndroid> CreateOverscrollController(
280 ContentViewCoreImpl* content_view_core) { 283 ContentViewCoreImpl* content_view_core) {
281 return make_scoped_ptr(new OverscrollControllerAndroid(content_view_core)); 284 return make_scoped_ptr(new OverscrollControllerAndroid(content_view_core));
282 } 285 }
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); 1315 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata);
1313 1316
1314 if (selection_controller_) { 1317 if (selection_controller_) {
1315 selection_controller_->OnSelectionEditable( 1318 selection_controller_->OnSelectionEditable(
1316 frame_metadata.selection.is_editable); 1319 frame_metadata.selection.is_editable);
1317 selection_controller_->OnSelectionEmpty( 1320 selection_controller_->OnSelectionEmpty(
1318 frame_metadata.selection.is_empty_text_form_control); 1321 frame_metadata.selection.is_empty_text_form_control);
1319 selection_controller_->OnSelectionBoundsChanged( 1322 selection_controller_->OnSelectionBoundsChanged(
1320 ConvertSelectionBound(frame_metadata.selection.start), 1323 ConvertSelectionBound(frame_metadata.selection.start),
1321 ConvertSelectionBound(frame_metadata.selection.end)); 1324 ConvertSelectionBound(frame_metadata.selection.end));
1325
1326 // Set parameters for adaptive handle orientation.
1327 gfx::SizeF viewport_size(frame_metadata.scrollable_viewport_size);
1328 viewport_size.Scale(frame_metadata.page_scale_factor);
1329 gfx::RectF viewport_rect(
1330 frame_metadata.location_bar_content_translation.x(),
1331 frame_metadata.location_bar_content_translation.y(),
1332 viewport_size.width(), viewport_size.height());
1333 selection_controller_->OnViewportChanged(viewport_rect);
1322 } 1334 }
1323 1335
1324 UpdateBackgroundColor(frame_metadata.root_background_color); 1336 UpdateBackgroundColor(frame_metadata.root_background_color);
1325 1337
1326 // All offsets and sizes are in CSS pixels. 1338 // All offsets and sizes are in CSS pixels.
1327 content_view_core_->UpdateFrameInfo( 1339 content_view_core_->UpdateFrameInfo(
1328 frame_metadata.root_scroll_offset, 1340 frame_metadata.root_scroll_offset,
1329 frame_metadata.page_scale_factor, 1341 frame_metadata.page_scale_factor,
1330 gfx::Vector2dF(frame_metadata.min_page_scale_factor, 1342 gfx::Vector2dF(frame_metadata.min_page_scale_factor,
1331 frame_metadata.max_page_scale_factor), 1343 frame_metadata.max_page_scale_factor),
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 results->orientationAngle = display.RotationAsDegree(); 2023 results->orientationAngle = display.RotationAsDegree();
2012 results->orientationType = 2024 results->orientationType =
2013 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 2025 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
2014 gfx::DeviceDisplayInfo info; 2026 gfx::DeviceDisplayInfo info;
2015 results->depth = info.GetBitsPerPixel(); 2027 results->depth = info.GetBitsPerPixel();
2016 results->depthPerComponent = info.GetBitsPerComponent(); 2028 results->depthPerComponent = info.GetBitsPerComponent();
2017 results->isMonochrome = (results->depthPerComponent == 0); 2029 results->isMonochrome = (results->depthPerComponent == 0);
2018 } 2030 }
2019 2031
2020 } // namespace content 2032 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698