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

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

Issue 698253004: Reland: Implement Aura side of unified touch text selection for contents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup - ready for review Created 5 years, 10 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "content/browser/media/media_web_contents_observer.h" 44 #include "content/browser/media/media_web_contents_observer.h"
45 #include "content/browser/renderer_host/compositor_impl_android.h" 45 #include "content/browser/renderer_host/compositor_impl_android.h"
46 #include "content/browser/renderer_host/dip_util.h" 46 #include "content/browser/renderer_host/dip_util.h"
47 #include "content/browser/renderer_host/frame_metadata_util.h" 47 #include "content/browser/renderer_host/frame_metadata_util.h"
48 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h " 48 #include "content/browser/renderer_host/input/synthetic_gesture_target_android.h "
49 #include "content/browser/renderer_host/input/web_input_event_builders_android.h " 49 #include "content/browser/renderer_host/input/web_input_event_builders_android.h "
50 #include "content/browser/renderer_host/input/web_input_event_util.h" 50 #include "content/browser/renderer_host/input/web_input_event_util.h"
51 #include "content/browser/renderer_host/render_process_host_impl.h" 51 #include "content/browser/renderer_host/render_process_host_impl.h"
52 #include "content/browser/renderer_host/render_view_host_impl.h" 52 #include "content/browser/renderer_host/render_view_host_impl.h"
53 #include "content/browser/renderer_host/render_widget_host_impl.h" 53 #include "content/browser/renderer_host/render_widget_host_impl.h"
54 #include "content/browser/renderer_host/ui_touch_selection_helper.h"
54 #include "content/common/gpu/client/gl_helper.h" 55 #include "content/common/gpu/client/gl_helper.h"
55 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 56 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
56 #include "content/common/gpu/gpu_messages.h" 57 #include "content/common/gpu/gpu_messages.h"
57 #include "content/common/gpu/gpu_process_launch_causes.h" 58 #include "content/common/gpu/gpu_process_launch_causes.h"
58 #include "content/common/input/did_overscroll_params.h" 59 #include "content/common/input/did_overscroll_params.h"
59 #include "content/common/input_messages.h" 60 #include "content/common/input_messages.h"
60 #include "content/common/view_messages.h" 61 #include "content/common/view_messages.h"
61 #include "content/public/browser/browser_thread.h" 62 #include "content/public/browser/browser_thread.h"
62 #include "content/public/browser/devtools_agent_host.h" 63 #include "content/public/browser/devtools_agent_host.h"
63 #include "content/public/browser/render_view_host.h" 64 #include "content/public/browser/render_view_host.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 284
284 ui::GestureProvider::Config CreateGestureProviderConfig() { 285 ui::GestureProvider::Config CreateGestureProviderConfig() {
285 ui::GestureProvider::Config config = ui::GetGestureProviderConfig( 286 ui::GestureProvider::Config config = ui::GetGestureProviderConfig(
286 ui::GestureProviderConfigType::CURRENT_PLATFORM); 287 ui::GestureProviderConfigType::CURRENT_PLATFORM);
287 config.disable_click_delay = 288 config.disable_click_delay =
288 base::CommandLine::ForCurrentProcess()->HasSwitch( 289 base::CommandLine::ForCurrentProcess()->HasSwitch(
289 switches::kDisableClickDelay); 290 switches::kDisableClickDelay);
290 return config; 291 return config;
291 } 292 }
292 293
293 ui::SelectionBound::Type ConvertSelectionBoundType(
294 cc::SelectionBoundType type) {
295 switch (type) {
296 case cc::SELECTION_BOUND_LEFT:
297 return ui::SelectionBound::LEFT;
298 case cc::SELECTION_BOUND_RIGHT:
299 return ui::SelectionBound::RIGHT;
300 case cc::SELECTION_BOUND_CENTER:
301 return ui::SelectionBound::CENTER;
302 case cc::SELECTION_BOUND_EMPTY:
303 return ui::SelectionBound::EMPTY;
304 }
305 NOTREACHED() << "Unknown selection bound type";
306 return ui::SelectionBound::EMPTY;
307 }
308
309 ui::SelectionBound ConvertSelectionBound(
310 const cc::ViewportSelectionBound& bound) {
311 ui::SelectionBound ui_bound;
312 ui_bound.set_type(ConvertSelectionBoundType(bound.type));
313 ui_bound.set_visible(bound.visible);
314 if (ui_bound.type() != ui::SelectionBound::EMPTY)
315 ui_bound.SetEdge(bound.edge_top, bound.edge_bottom);
316 return ui_bound;
317 }
318
319 } // anonymous namespace 294 } // anonymous namespace
320 295
321 ReadbackRequest::ReadbackRequest(float scale, 296 ReadbackRequest::ReadbackRequest(float scale,
322 SkColorType color_type, 297 SkColorType color_type,
323 gfx::Rect src_subrect, 298 gfx::Rect src_subrect,
324 ReadbackRequestCallback& result_callback) 299 ReadbackRequestCallback& result_callback)
325 : scale_(scale), 300 : scale_(scale),
326 color_type_(color_type), 301 color_type_(color_type),
327 src_subrect_(src_subrect), 302 src_subrect_(src_subrect),
328 result_callback_(result_callback) { 303 result_callback_(result_callback) {
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
1345 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata); 1320 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata);
1346 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); 1321 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized);
1347 1322
1348 if (!content_view_core_) 1323 if (!content_view_core_)
1349 return; 1324 return;
1350 1325
1351 if (overscroll_controller_) 1326 if (overscroll_controller_)
1352 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); 1327 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata);
1353 1328
1354 if (selection_controller_) { 1329 if (selection_controller_) {
1355 selection_controller_->OnSelectionBoundsChanged( 1330 selection_controller_->OnSelectionBoundsUpdated(
1356 ConvertSelectionBound(frame_metadata.selection_start), 1331 ConvertSelectionBound(frame_metadata.selection_start),
1357 ConvertSelectionBound(frame_metadata.selection_end)); 1332 ConvertSelectionBound(frame_metadata.selection_end));
1358 } 1333 }
1359 1334
1360 // All offsets and sizes are in CSS pixels. 1335 // All offsets and sizes are in CSS pixels.
1361 content_view_core_->UpdateFrameInfo( 1336 content_view_core_->UpdateFrameInfo(
1362 frame_metadata.root_scroll_offset, 1337 frame_metadata.root_scroll_offset,
1363 frame_metadata.page_scale_factor, 1338 frame_metadata.page_scale_factor,
1364 gfx::Vector2dF(frame_metadata.min_page_scale_factor, 1339 gfx::Vector2dF(frame_metadata.min_page_scale_factor,
1365 frame_metadata.max_page_scale_factor), 1340 frame_metadata.max_page_scale_factor),
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 // of the region have been updated, explicitly set the properties now. 1640 // of the region have been updated, explicitly set the properties now.
1666 // TODO(jdduke): Remove this workaround when auxiliary paste popup 1641 // TODO(jdduke): Remove this workaround when auxiliary paste popup
1667 // notifications are no longer required, crbug.com/398170. 1642 // notifications are no longer required, crbug.com/398170.
1668 ui::SelectionBound insertion_bound; 1643 ui::SelectionBound insertion_bound;
1669 insertion_bound.set_type(ui::SelectionBound::CENTER); 1644 insertion_bound.set_type(ui::SelectionBound::CENTER);
1670 insertion_bound.set_visible(true); 1645 insertion_bound.set_visible(true);
1671 insertion_bound.SetEdge(point, point); 1646 insertion_bound.SetEdge(point, point);
1672 selection_controller_->HideAndDisallowShowingAutomatically(); 1647 selection_controller_->HideAndDisallowShowingAutomatically();
1673 selection_controller_->OnSelectionEditable(true); 1648 selection_controller_->OnSelectionEditable(true);
1674 selection_controller_->OnSelectionEmpty(true); 1649 selection_controller_->OnSelectionEmpty(true);
1675 selection_controller_->OnSelectionBoundsChanged(insertion_bound, 1650 selection_controller_->OnSelectionBoundsUpdated(insertion_bound,
1676 insertion_bound); 1651 insertion_bound);
1677 selection_controller_->AllowShowingFromCurrentSelection(); 1652 selection_controller_->AllowShowingFromCurrentSelection();
1678 } 1653 }
1679 1654
1680 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { 1655 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const {
1681 return cached_background_color_; 1656 return cached_background_color_;
1682 } 1657 }
1683 1658
1684 void RenderWidgetHostViewAndroid::DidOverscroll( 1659 void RenderWidgetHostViewAndroid::DidOverscroll(
1685 const DidOverscrollParams& params) { 1660 const DidOverscrollParams& params) {
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1944 results->orientationAngle = display.RotationAsDegree(); 1919 results->orientationAngle = display.RotationAsDegree();
1945 results->orientationType = 1920 results->orientationType =
1946 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); 1921 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display);
1947 gfx::DeviceDisplayInfo info; 1922 gfx::DeviceDisplayInfo info;
1948 results->depth = info.GetBitsPerPixel(); 1923 results->depth = info.GetBitsPerPixel();
1949 results->depthPerComponent = info.GetBitsPerComponent(); 1924 results->depthPerComponent = info.GetBitsPerComponent();
1950 results->isMonochrome = (results->depthPerComponent == 0); 1925 results->isMonochrome = (results->depthPerComponent == 0);
1951 } 1926 }
1952 1927
1953 } // namespace content 1928 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698