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

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

Issue 2826303003: Let selection events bypass ContentViewCore (Closed)
Patch Set: call Initialize() Created 3 years, 8 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 <utility> 9 #include <utility>
10 10
(...skipping 24 matching lines...) Expand all
35 #include "cc/surfaces/surface.h" 35 #include "cc/surfaces/surface.h"
36 #include "cc/surfaces/surface_hittest.h" 36 #include "cc/surfaces/surface_hittest.h"
37 #include "cc/surfaces/surface_manager.h" 37 #include "cc/surfaces/surface_manager.h"
38 #include "cc/trees/layer_tree_host.h" 38 #include "cc/trees/layer_tree_host.h"
39 #include "components/display_compositor/gl_helper.h" 39 #include "components/display_compositor/gl_helper.h"
40 #include "content/browser/accessibility/browser_accessibility_manager_android.h" 40 #include "content/browser/accessibility/browser_accessibility_manager_android.h"
41 #include "content/browser/android/composited_touch_handle_drawable.h" 41 #include "content/browser/android/composited_touch_handle_drawable.h"
42 #include "content/browser/android/content_view_core_impl.h" 42 #include "content/browser/android/content_view_core_impl.h"
43 #include "content/browser/android/ime_adapter_android.h" 43 #include "content/browser/android/ime_adapter_android.h"
44 #include "content/browser/android/overscroll_controller_android.h" 44 #include "content/browser/android/overscroll_controller_android.h"
45 #include "content/browser/android/selection_popup_controller.h"
45 #include "content/browser/android/synchronous_compositor_host.h" 46 #include "content/browser/android/synchronous_compositor_host.h"
46 #include "content/browser/compositor/surface_utils.h" 47 #include "content/browser/compositor/surface_utils.h"
47 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 48 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
48 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 49 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
49 #include "content/browser/gpu/compositor_util.h" 50 #include "content/browser/gpu/compositor_util.h"
50 #include "content/browser/gpu/gpu_data_manager_impl.h" 51 #include "content/browser/gpu/gpu_data_manager_impl.h"
51 #include "content/browser/gpu/gpu_process_host.h" 52 #include "content/browser/gpu/gpu_process_host.h"
52 #include "content/browser/media/android/media_web_contents_observer_android.h" 53 #include "content/browser/media/android/media_web_contents_observer_android.h"
53 #include "content/browser/renderer_host/compositor_impl_android.h" 54 #include "content/browser/renderer_host/compositor_impl_android.h"
54 #include "content/browser/renderer_host/dip_util.h" 55 #include "content/browser/renderer_host/dip_util.h"
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 void RenderWidgetHostViewAndroid::OnTextSelectionChanged( 760 void RenderWidgetHostViewAndroid::OnTextSelectionChanged(
760 TextInputManager* text_input_manager, 761 TextInputManager* text_input_manager,
761 RenderWidgetHostViewBase* updated_view) { 762 RenderWidgetHostViewBase* updated_view) {
762 DCHECK_EQ(text_input_manager_, text_input_manager); 763 DCHECK_EQ(text_input_manager_, text_input_manager);
763 764
764 // TODO(asimjour): remove the flag and fix text selection popup for 765 // TODO(asimjour): remove the flag and fix text selection popup for
765 // virtual reality mode. 766 // virtual reality mode.
766 if (is_in_vr_) 767 if (is_in_vr_)
767 return; 768 return;
768 769
769 if (!content_view_core_) 770 if (!selection_popup_controller_)
770 return; 771 return;
771 772
772 RenderWidgetHostImpl* focused_widget = GetFocusedWidget(); 773 RenderWidgetHostImpl* focused_widget = GetFocusedWidget();
773 if (!focused_widget || !focused_widget->GetView()) 774 if (!focused_widget || !focused_widget->GetView())
774 return; 775 return;
775 776
776 const TextInputManager::TextSelection& selection = 777 const TextInputManager::TextSelection& selection =
777 *text_input_manager_->GetTextSelection(focused_widget->GetView()); 778 *text_input_manager_->GetTextSelection(focused_widget->GetView());
778 779
779 content_view_core_->OnSelectionChanged( 780 selection_popup_controller_->OnSelectionChanged(
780 base::UTF16ToUTF8(selection.selected_text())); 781 base::UTF16ToUTF8(selection.selected_text()));
781 } 782 }
782 783
783 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) { 784 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) {
784 if (cached_background_color_ == color) 785 if (cached_background_color_ == color)
785 return; 786 return;
786 787
787 cached_background_color_ = color; 788 cached_background_color_ = color;
788 789
789 view_.OnBackgroundColorChanged(color); 790 view_.OnBackgroundColorChanged(color);
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 1289
1289 void RenderWidgetHostViewAndroid::SelectBetweenCoordinates( 1290 void RenderWidgetHostViewAndroid::SelectBetweenCoordinates(
1290 const gfx::PointF& base, 1291 const gfx::PointF& base,
1291 const gfx::PointF& extent) { 1292 const gfx::PointF& extent) {
1292 DCHECK(content_view_core_); 1293 DCHECK(content_view_core_);
1293 content_view_core_->SelectBetweenCoordinates(base, extent); 1294 content_view_core_->SelectBetweenCoordinates(base, extent);
1294 } 1295 }
1295 1296
1296 void RenderWidgetHostViewAndroid::OnSelectionEvent( 1297 void RenderWidgetHostViewAndroid::OnSelectionEvent(
1297 ui::SelectionEventType event) { 1298 ui::SelectionEventType event) {
1298 DCHECK(content_view_core_); 1299 DCHECK(selection_popup_controller_);
1299 DCHECK(touch_selection_controller_); 1300 DCHECK(touch_selection_controller_);
1300 // If a selection drag has started, it has taken over the active touch 1301 // If a selection drag has started, it has taken over the active touch
1301 // sequence. Immediately cancel gesture detection and any downstream touch 1302 // sequence. Immediately cancel gesture detection and any downstream touch
1302 // listeners (e.g., web content) to communicate this transfer. 1303 // listeners (e.g., web content) to communicate this transfer.
1303 if (event == ui::SELECTION_HANDLES_SHOWN && 1304 if (event == ui::SELECTION_HANDLES_SHOWN &&
1304 gesture_provider_.GetCurrentDownEvent()) { 1305 gesture_provider_.GetCurrentDownEvent()) {
1305 ResetGestureDetection(); 1306 ResetGestureDetection();
1306 } 1307 }
1307 content_view_core_->OnSelectionEvent( 1308 selection_popup_controller_->OnSelectionEvent(
1308 event, touch_selection_controller_->GetStartPosition(), 1309 event, touch_selection_controller_->GetStartPosition(),
1309 GetSelectionRect(*touch_selection_controller_)); 1310 GetSelectionRect(*touch_selection_controller_));
1310 } 1311 }
1311 1312
1312 std::unique_ptr<ui::TouchHandleDrawable> 1313 std::unique_ptr<ui::TouchHandleDrawable>
1313 RenderWidgetHostViewAndroid::CreateDrawable() { 1314 RenderWidgetHostViewAndroid::CreateDrawable() {
1314 DCHECK(content_view_core_); 1315 DCHECK(content_view_core_);
1315 if (!using_browser_compositor_) { 1316 if (!using_browser_compositor_) {
1316 if (!sync_compositor_) 1317 if (!sync_compositor_)
1317 return nullptr; 1318 return nullptr;
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
2191 2192
2192 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); 2193 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor();
2193 if (!compositor) 2194 if (!compositor)
2194 return; 2195 return;
2195 2196
2196 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( 2197 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>(
2197 overscroll_refresh_handler, compositor, view_.GetDipScale()); 2198 overscroll_refresh_handler, compositor, view_.GetDipScale());
2198 } 2199 }
2199 2200
2200 } // namespace content 2201 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.h ('k') | content/public/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698