| 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 <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 #include "cc/surfaces/surface_factory.h" | 36 #include "cc/surfaces/surface_factory.h" |
| 37 #include "cc/surfaces/surface_hittest.h" | 37 #include "cc/surfaces/surface_hittest.h" |
| 38 #include "cc/surfaces/surface_manager.h" | 38 #include "cc/surfaces/surface_manager.h" |
| 39 #include "cc/trees/layer_tree_host.h" | 39 #include "cc/trees/layer_tree_host.h" |
| 40 #include "components/display_compositor/gl_helper.h" | 40 #include "components/display_compositor/gl_helper.h" |
| 41 #include "content/browser/accessibility/browser_accessibility_manager_android.h" | 41 #include "content/browser/accessibility/browser_accessibility_manager_android.h" |
| 42 #include "content/browser/android/composited_touch_handle_drawable.h" | 42 #include "content/browser/android/composited_touch_handle_drawable.h" |
| 43 #include "content/browser/android/content_view_core_impl.h" | 43 #include "content/browser/android/content_view_core_impl.h" |
| 44 #include "content/browser/android/ime_adapter_android.h" | 44 #include "content/browser/android/ime_adapter_android.h" |
| 45 #include "content/browser/android/overscroll_controller_android.h" | 45 #include "content/browser/android/overscroll_controller_android.h" |
| 46 #include "content/browser/android/selection_popup_controller.h" |
| 46 #include "content/browser/android/synchronous_compositor_host.h" | 47 #include "content/browser/android/synchronous_compositor_host.h" |
| 47 #include "content/browser/compositor/surface_utils.h" | 48 #include "content/browser/compositor/surface_utils.h" |
| 48 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 49 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
| 49 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" | 50 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" |
| 50 #include "content/browser/gpu/compositor_util.h" | 51 #include "content/browser/gpu/compositor_util.h" |
| 51 #include "content/browser/gpu/gpu_data_manager_impl.h" | 52 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 52 #include "content/browser/gpu/gpu_process_host.h" | 53 #include "content/browser/gpu/gpu_process_host.h" |
| 53 #include "content/browser/media/android/media_web_contents_observer_android.h" | 54 #include "content/browser/media/android/media_web_contents_observer_android.h" |
| 54 #include "content/browser/renderer_host/compositor_impl_android.h" | 55 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 55 #include "content/browser/renderer_host/dip_util.h" | 56 #include "content/browser/renderer_host/dip_util.h" |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 752 void RenderWidgetHostViewAndroid::OnTextSelectionChanged( | 753 void RenderWidgetHostViewAndroid::OnTextSelectionChanged( |
| 753 TextInputManager* text_input_manager, | 754 TextInputManager* text_input_manager, |
| 754 RenderWidgetHostViewBase* updated_view) { | 755 RenderWidgetHostViewBase* updated_view) { |
| 755 DCHECK_EQ(text_input_manager_, text_input_manager); | 756 DCHECK_EQ(text_input_manager_, text_input_manager); |
| 756 | 757 |
| 757 // TODO(asimjour): remove the flag and fix text selection popup for | 758 // TODO(asimjour): remove the flag and fix text selection popup for |
| 758 // virtual reality mode. | 759 // virtual reality mode. |
| 759 if (is_in_vr_) | 760 if (is_in_vr_) |
| 760 return; | 761 return; |
| 761 | 762 |
| 762 if (!content_view_core_) | 763 if (!selection_popup_controller_) |
| 763 return; | 764 return; |
| 764 | 765 |
| 765 RenderWidgetHostImpl* focused_widget = GetFocusedWidget(); | 766 RenderWidgetHostImpl* focused_widget = GetFocusedWidget(); |
| 766 if (!focused_widget || !focused_widget->GetView()) | 767 if (!focused_widget || !focused_widget->GetView()) |
| 767 return; | 768 return; |
| 768 | 769 |
| 769 const TextInputManager::TextSelection& selection = | 770 const TextInputManager::TextSelection& selection = |
| 770 *text_input_manager_->GetTextSelection(focused_widget->GetView()); | 771 *text_input_manager_->GetTextSelection(focused_widget->GetView()); |
| 771 | 772 |
| 772 content_view_core_->OnSelectionChanged( | 773 selection_popup_controller_->OnSelectionChanged( |
| 773 base::UTF16ToUTF8(selection.selected_text())); | 774 base::UTF16ToUTF8(selection.selected_text())); |
| 774 } | 775 } |
| 775 | 776 |
| 776 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) { | 777 void RenderWidgetHostViewAndroid::UpdateBackgroundColor(SkColor color) { |
| 777 if (cached_background_color_ == color) | 778 if (cached_background_color_ == color) |
| 778 return; | 779 return; |
| 779 | 780 |
| 780 cached_background_color_ = color; | 781 cached_background_color_ = color; |
| 781 | 782 |
| 782 view_.OnBackgroundColorChanged(color); | 783 view_.OnBackgroundColorChanged(color); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 911 bool RenderWidgetHostViewAndroid::OnTouchEvent( | 912 bool RenderWidgetHostViewAndroid::OnTouchEvent( |
| 912 const ui::MotionEvent& event) { | 913 const ui::MotionEvent& event) { |
| 913 if (!host_ || !host_->delegate()) | 914 if (!host_ || !host_->delegate()) |
| 914 return false; | 915 return false; |
| 915 | 916 |
| 916 ComputeEventLatencyOSTouchHistograms(event); | 917 ComputeEventLatencyOSTouchHistograms(event); |
| 917 | 918 |
| 918 // If a browser-based widget consumes the touch event, it's critical that | 919 // If a browser-based widget consumes the touch event, it's critical that |
| 919 // touch event interception be disabled. This avoids issues with | 920 // touch event interception be disabled. This avoids issues with |
| 920 // double-handling for embedder-detected gestures like side swipe. | 921 // double-handling for embedder-detected gestures like side swipe. |
| 921 if (selection_controller_ && | 922 if (touch_selection_controller_ && |
| 922 selection_controller_->WillHandleTouchEvent(event)) { | 923 touch_selection_controller_->WillHandleTouchEvent(event)) { |
| 923 RequestDisallowInterceptTouchEvent(); | 924 RequestDisallowInterceptTouchEvent(); |
| 924 return true; | 925 return true; |
| 925 } | 926 } |
| 926 | 927 |
| 927 if (stylus_text_selector_.OnTouchEvent(event)) { | 928 if (stylus_text_selector_.OnTouchEvent(event)) { |
| 928 RequestDisallowInterceptTouchEvent(); | 929 RequestDisallowInterceptTouchEvent(); |
| 929 return true; | 930 return true; |
| 930 } | 931 } |
| 931 | 932 |
| 932 ui::FilteredGestureProvider::TouchHandlingResult result = | 933 ui::FilteredGestureProvider::TouchHandlingResult result = |
| (...skipping 18 matching lines...) Expand all Loading... |
| 951 // that BeginFrame requests made during ACTION_MOVE dispatch will be honored | 952 // that BeginFrame requests made during ACTION_MOVE dispatch will be honored |
| 952 // in the same vsync phase. | 953 // in the same vsync phase. |
| 953 if (observing_root_window_ && result.moved_beyond_slop_region) | 954 if (observing_root_window_ && result.moved_beyond_slop_region) |
| 954 AddBeginFrameRequest(BEGIN_FRAME); | 955 AddBeginFrameRequest(BEGIN_FRAME); |
| 955 | 956 |
| 956 return true; | 957 return true; |
| 957 } | 958 } |
| 958 | 959 |
| 959 bool RenderWidgetHostViewAndroid::OnTouchHandleEvent( | 960 bool RenderWidgetHostViewAndroid::OnTouchHandleEvent( |
| 960 const ui::MotionEvent& event) { | 961 const ui::MotionEvent& event) { |
| 961 return selection_controller_ && | 962 return touch_selection_controller_ && |
| 962 selection_controller_->WillHandleTouchEvent(event); | 963 touch_selection_controller_->WillHandleTouchEvent(event); |
| 963 } | 964 } |
| 964 | 965 |
| 965 void RenderWidgetHostViewAndroid::ResetGestureDetection() { | 966 void RenderWidgetHostViewAndroid::ResetGestureDetection() { |
| 966 const ui::MotionEvent* current_down_event = | 967 const ui::MotionEvent* current_down_event = |
| 967 gesture_provider_.GetCurrentDownEvent(); | 968 gesture_provider_.GetCurrentDownEvent(); |
| 968 if (!current_down_event) { | 969 if (!current_down_event) { |
| 969 // A hard reset ensures prevention of any timer-based events that might fire | 970 // A hard reset ensures prevention of any timer-based events that might fire |
| 970 // after a touch sequence has ended. | 971 // after a touch sequence has ended. |
| 971 gesture_provider_.ResetDetection(); | 972 gesture_provider_.ResetDetection(); |
| 972 return; | 973 return; |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1263 | 1264 |
| 1264 void RenderWidgetHostViewAndroid::SelectBetweenCoordinates( | 1265 void RenderWidgetHostViewAndroid::SelectBetweenCoordinates( |
| 1265 const gfx::PointF& base, | 1266 const gfx::PointF& base, |
| 1266 const gfx::PointF& extent) { | 1267 const gfx::PointF& extent) { |
| 1267 DCHECK(content_view_core_); | 1268 DCHECK(content_view_core_); |
| 1268 content_view_core_->SelectBetweenCoordinates(base, extent); | 1269 content_view_core_->SelectBetweenCoordinates(base, extent); |
| 1269 } | 1270 } |
| 1270 | 1271 |
| 1271 void RenderWidgetHostViewAndroid::OnSelectionEvent( | 1272 void RenderWidgetHostViewAndroid::OnSelectionEvent( |
| 1272 ui::SelectionEventType event) { | 1273 ui::SelectionEventType event) { |
| 1273 DCHECK(content_view_core_); | 1274 DCHECK(touch_selection_controller_); |
| 1274 DCHECK(selection_controller_); | 1275 if (!selection_popup_controller_) |
| 1276 return; |
| 1275 // If a selection drag has started, it has taken over the active touch | 1277 // If a selection drag has started, it has taken over the active touch |
| 1276 // sequence. Immediately cancel gesture detection and any downstream touch | 1278 // sequence. Immediately cancel gesture detection and any downstream touch |
| 1277 // listeners (e.g., web content) to communicate this transfer. | 1279 // listeners (e.g., web content) to communicate this transfer. |
| 1278 if (event == ui::SELECTION_HANDLES_SHOWN && | 1280 if (event == ui::SELECTION_HANDLES_SHOWN && |
| 1279 gesture_provider_.GetCurrentDownEvent()) { | 1281 gesture_provider_.GetCurrentDownEvent()) { |
| 1280 ResetGestureDetection(); | 1282 ResetGestureDetection(); |
| 1281 } | 1283 } |
| 1282 content_view_core_->OnSelectionEvent( | 1284 selection_popup_controller_->OnSelectionEvent( |
| 1283 event, selection_controller_->GetStartPosition(), | 1285 event, touch_selection_controller_->GetStartPosition(), |
| 1284 GetSelectionRect(*selection_controller_)); | 1286 GetSelectionRect(*touch_selection_controller_)); |
| 1285 } | 1287 } |
| 1286 | 1288 |
| 1287 std::unique_ptr<ui::TouchHandleDrawable> | 1289 std::unique_ptr<ui::TouchHandleDrawable> |
| 1288 RenderWidgetHostViewAndroid::CreateDrawable() { | 1290 RenderWidgetHostViewAndroid::CreateDrawable() { |
| 1289 DCHECK(content_view_core_); | 1291 DCHECK(content_view_core_); |
| 1290 if (!using_browser_compositor_) { | 1292 if (!using_browser_compositor_) { |
| 1291 if (!sync_compositor_) | 1293 if (!sync_compositor_) |
| 1292 return nullptr; | 1294 return nullptr; |
| 1293 return std::unique_ptr<ui::TouchHandleDrawable>( | 1295 return std::unique_ptr<ui::TouchHandleDrawable>( |
| 1294 sync_compositor_->client()->CreateDrawable()); | 1296 sync_compositor_->client()->CreateDrawable()); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1345 bool is_transparent) { | 1347 bool is_transparent) { |
| 1346 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata); | 1348 bool is_mobile_optimized = IsMobileOptimizedFrame(frame_metadata); |
| 1347 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); | 1349 gesture_provider_.SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); |
| 1348 | 1350 |
| 1349 if (!content_view_core_) | 1351 if (!content_view_core_) |
| 1350 return; | 1352 return; |
| 1351 | 1353 |
| 1352 if (overscroll_controller_) | 1354 if (overscroll_controller_) |
| 1353 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); | 1355 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); |
| 1354 | 1356 |
| 1355 if (selection_controller_) { | 1357 if (touch_selection_controller_) { |
| 1356 selection_controller_->OnSelectionBoundsChanged( | 1358 touch_selection_controller_->OnSelectionBoundsChanged( |
| 1357 frame_metadata.selection.start, frame_metadata.selection.end); | 1359 frame_metadata.selection.start, frame_metadata.selection.end); |
| 1358 | 1360 |
| 1359 // Set parameters for adaptive handle orientation. | 1361 // Set parameters for adaptive handle orientation. |
| 1360 gfx::SizeF viewport_size(frame_metadata.scrollable_viewport_size); | 1362 gfx::SizeF viewport_size(frame_metadata.scrollable_viewport_size); |
| 1361 viewport_size.Scale(frame_metadata.page_scale_factor); | 1363 viewport_size.Scale(frame_metadata.page_scale_factor); |
| 1362 gfx::RectF viewport_rect(0.0f, frame_metadata.top_controls_height * | 1364 gfx::RectF viewport_rect(0.0f, frame_metadata.top_controls_height * |
| 1363 frame_metadata.top_controls_shown_ratio, | 1365 frame_metadata.top_controls_shown_ratio, |
| 1364 viewport_size.width(), viewport_size.height()); | 1366 viewport_size.width(), viewport_size.height()); |
| 1365 selection_controller_->OnViewportChanged(viewport_rect); | 1367 touch_selection_controller_->OnViewportChanged(viewport_rect); |
| 1366 } | 1368 } |
| 1367 | 1369 |
| 1368 UpdateBackgroundColor(is_transparent ? SK_ColorTRANSPARENT | 1370 UpdateBackgroundColor(is_transparent ? SK_ColorTRANSPARENT |
| 1369 : frame_metadata.root_background_color); | 1371 : frame_metadata.root_background_color); |
| 1370 | 1372 |
| 1371 view_.set_content_offset(gfx::Vector2dF(0.0f, | 1373 view_.set_content_offset(gfx::Vector2dF(0.0f, |
| 1372 frame_metadata.top_controls_height * | 1374 frame_metadata.top_controls_height * |
| 1373 frame_metadata.top_controls_shown_ratio)); | 1375 frame_metadata.top_controls_shown_ratio)); |
| 1374 | 1376 |
| 1375 float dip_scale = view_.GetDipScale(); | 1377 float dip_scale = view_.GetDipScale(); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 if (sync_compositor_) | 1566 if (sync_compositor_) |
| 1565 sync_compositor_->DidSendBeginFrame(view_.GetWindowAndroid()); | 1567 sync_compositor_->DidSendBeginFrame(view_.GetWindowAndroid()); |
| 1566 } | 1568 } |
| 1567 | 1569 |
| 1568 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) { | 1570 bool RenderWidgetHostViewAndroid::Animate(base::TimeTicks frame_time) { |
| 1569 bool needs_animate = false; | 1571 bool needs_animate = false; |
| 1570 if (overscroll_controller_ && !is_in_vr_) { | 1572 if (overscroll_controller_ && !is_in_vr_) { |
| 1571 needs_animate |= overscroll_controller_->Animate( | 1573 needs_animate |= overscroll_controller_->Animate( |
| 1572 frame_time, content_view_core_->GetViewAndroid()->GetLayer()); | 1574 frame_time, content_view_core_->GetViewAndroid()->GetLayer()); |
| 1573 } | 1575 } |
| 1574 if (selection_controller_) | 1576 if (touch_selection_controller_) |
| 1575 needs_animate |= selection_controller_->Animate(frame_time); | 1577 needs_animate |= touch_selection_controller_->Animate(frame_time); |
| 1576 return needs_animate; | 1578 return needs_animate; |
| 1577 } | 1579 } |
| 1578 | 1580 |
| 1579 void RenderWidgetHostViewAndroid::RequestDisallowInterceptTouchEvent() { | 1581 void RenderWidgetHostViewAndroid::RequestDisallowInterceptTouchEvent() { |
| 1580 if (content_view_core_) | 1582 if (content_view_core_) |
| 1581 content_view_core_->RequestDisallowInterceptTouchEvent(); | 1583 content_view_core_->RequestDisallowInterceptTouchEvent(); |
| 1582 } | 1584 } |
| 1583 | 1585 |
| 1584 void RenderWidgetHostViewAndroid::EvictDelegatedFrame() { | 1586 void RenderWidgetHostViewAndroid::EvictDelegatedFrame() { |
| 1585 DestroyDelegatedContent(); | 1587 DestroyDelegatedContent(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1609 InputEventAckState ack_result) { | 1611 InputEventAckState ack_result) { |
| 1610 if (overscroll_controller_) | 1612 if (overscroll_controller_) |
| 1611 overscroll_controller_->OnGestureEventAck(event, ack_result); | 1613 overscroll_controller_->OnGestureEventAck(event, ack_result); |
| 1612 | 1614 |
| 1613 if (content_view_core_) | 1615 if (content_view_core_) |
| 1614 content_view_core_->OnGestureEventAck(event, ack_result); | 1616 content_view_core_->OnGestureEventAck(event, ack_result); |
| 1615 } | 1617 } |
| 1616 | 1618 |
| 1617 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent( | 1619 InputEventAckState RenderWidgetHostViewAndroid::FilterInputEvent( |
| 1618 const blink::WebInputEvent& input_event) { | 1620 const blink::WebInputEvent& input_event) { |
| 1619 if (selection_controller_ && | 1621 if (touch_selection_controller_ && |
| 1620 blink::WebInputEvent::isGestureEventType(input_event.type())) { | 1622 blink::WebInputEvent::isGestureEventType(input_event.type())) { |
| 1621 const blink::WebGestureEvent& gesture_event = | 1623 const blink::WebGestureEvent& gesture_event = |
| 1622 static_cast<const blink::WebGestureEvent&>(input_event); | 1624 static_cast<const blink::WebGestureEvent&>(input_event); |
| 1623 switch (gesture_event.type()) { | 1625 switch (gesture_event.type()) { |
| 1624 case blink::WebInputEvent::GestureLongPress: | 1626 case blink::WebInputEvent::GestureLongPress: |
| 1625 selection_controller_->HandleLongPressEvent( | 1627 touch_selection_controller_->HandleLongPressEvent( |
| 1626 base::TimeTicks() + | 1628 base::TimeTicks() + |
| 1627 base::TimeDelta::FromSecondsD(input_event.timeStampSeconds()), | 1629 base::TimeDelta::FromSecondsD(input_event.timeStampSeconds()), |
| 1628 gfx::PointF(gesture_event.x, gesture_event.y)); | 1630 gfx::PointF(gesture_event.x, gesture_event.y)); |
| 1629 break; | 1631 break; |
| 1630 | 1632 |
| 1631 case blink::WebInputEvent::GestureTap: | 1633 case blink::WebInputEvent::GestureTap: |
| 1632 selection_controller_->HandleTapEvent( | 1634 touch_selection_controller_->HandleTapEvent( |
| 1633 gfx::PointF(gesture_event.x, gesture_event.y), | 1635 gfx::PointF(gesture_event.x, gesture_event.y), |
| 1634 gesture_event.data.tap.tapCount); | 1636 gesture_event.data.tap.tapCount); |
| 1635 break; | 1637 break; |
| 1636 | 1638 |
| 1637 case blink::WebInputEvent::GestureScrollBegin: | 1639 case blink::WebInputEvent::GestureScrollBegin: |
| 1638 selection_controller_->OnScrollBeginEvent(); | 1640 touch_selection_controller_->OnScrollBeginEvent(); |
| 1639 break; | 1641 break; |
| 1640 | 1642 |
| 1641 default: | 1643 default: |
| 1642 break; | 1644 break; |
| 1643 } | 1645 } |
| 1644 } | 1646 } |
| 1645 | 1647 |
| 1646 if (overscroll_controller_ && | 1648 if (overscroll_controller_ && |
| 1647 blink::WebInputEvent::isGestureEventType(input_event.type()) && | 1649 blink::WebInputEvent::isGestureEventType(input_event.type()) && |
| 1648 overscroll_controller_->WillHandleGestureEvent( | 1650 overscroll_controller_->WillHandleGestureEvent( |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1795 host_->MoveCaret(point); | 1797 host_->MoveCaret(point); |
| 1796 } | 1798 } |
| 1797 | 1799 |
| 1798 void RenderWidgetHostViewAndroid::ShowContextMenuAtPoint( | 1800 void RenderWidgetHostViewAndroid::ShowContextMenuAtPoint( |
| 1799 const gfx::Point& point) { | 1801 const gfx::Point& point) { |
| 1800 if (host_) | 1802 if (host_) |
| 1801 host_->ShowContextMenuAtPoint(point); | 1803 host_->ShowContextMenuAtPoint(point); |
| 1802 } | 1804 } |
| 1803 | 1805 |
| 1804 void RenderWidgetHostViewAndroid::DismissTextHandles() { | 1806 void RenderWidgetHostViewAndroid::DismissTextHandles() { |
| 1805 if (selection_controller_) | 1807 if (touch_selection_controller_) |
| 1806 selection_controller_->HideAndDisallowShowingAutomatically(); | 1808 touch_selection_controller_->HideAndDisallowShowingAutomatically(); |
| 1807 } | 1809 } |
| 1808 | 1810 |
| 1809 void RenderWidgetHostViewAndroid::SetTextHandlesTemporarilyHidden(bool hidden) { | 1811 void RenderWidgetHostViewAndroid::SetTextHandlesTemporarilyHidden(bool hidden) { |
| 1810 if (selection_controller_) | 1812 if (touch_selection_controller_) |
| 1811 selection_controller_->SetTemporarilyHidden(hidden); | 1813 touch_selection_controller_->SetTemporarilyHidden(hidden); |
| 1812 } | 1814 } |
| 1813 | 1815 |
| 1814 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { | 1816 SkColor RenderWidgetHostViewAndroid::GetCachedBackgroundColor() const { |
| 1815 return cached_background_color_; | 1817 return cached_background_color_; |
| 1816 } | 1818 } |
| 1817 | 1819 |
| 1818 void RenderWidgetHostViewAndroid::SetIsInVR(bool is_in_vr) { | 1820 void RenderWidgetHostViewAndroid::SetIsInVR(bool is_in_vr) { |
| 1819 is_in_vr_ = is_in_vr; | 1821 is_in_vr_ = is_in_vr; |
| 1820 } | 1822 } |
| 1821 | 1823 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1848 } | 1850 } |
| 1849 | 1851 |
| 1850 void RenderWidgetHostViewAndroid::SetContentViewCore( | 1852 void RenderWidgetHostViewAndroid::SetContentViewCore( |
| 1851 ContentViewCoreImpl* content_view_core) { | 1853 ContentViewCoreImpl* content_view_core) { |
| 1852 DCHECK(!content_view_core || !content_view_core_ || | 1854 DCHECK(!content_view_core || !content_view_core_ || |
| 1853 (content_view_core_ == content_view_core)); | 1855 (content_view_core_ == content_view_core)); |
| 1854 StopObservingRootWindow(); | 1856 StopObservingRootWindow(); |
| 1855 | 1857 |
| 1856 bool resize = false; | 1858 bool resize = false; |
| 1857 if (content_view_core != content_view_core_) { | 1859 if (content_view_core != content_view_core_) { |
| 1858 selection_controller_.reset(); | 1860 touch_selection_controller_.reset(); |
| 1859 RunAckCallbacks(); | 1861 RunAckCallbacks(); |
| 1860 // TODO(yusufo) : Get rid of the below conditions and have a better handling | 1862 // TODO(yusufo) : Get rid of the below conditions and have a better handling |
| 1861 // for resizing after crbug.com/628302 is handled. | 1863 // for resizing after crbug.com/628302 is handled. |
| 1862 bool is_size_initialized = !content_view_core | 1864 bool is_size_initialized = !content_view_core |
| 1863 || content_view_core->GetViewportSizeDip().width() != 0 | 1865 || content_view_core->GetViewportSizeDip().width() != 0 |
| 1864 || content_view_core->GetViewportSizeDip().height() != 0; | 1866 || content_view_core->GetViewportSizeDip().height() != 0; |
| 1865 if (content_view_core_ || is_size_initialized) | 1867 if (content_view_core_ || is_size_initialized) |
| 1866 resize = true; | 1868 resize = true; |
| 1867 if (content_view_core_) { | 1869 if (content_view_core_) { |
| 1868 content_view_core_->RemoveObserver(this); | 1870 content_view_core_->RemoveObserver(this); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1892 sync_compositor_.reset(); | 1894 sync_compositor_.reset(); |
| 1893 return; | 1895 return; |
| 1894 } | 1896 } |
| 1895 | 1897 |
| 1896 if (is_showing_ && view_.GetWindowAndroid()) | 1898 if (is_showing_ && view_.GetWindowAndroid()) |
| 1897 StartObservingRootWindow(); | 1899 StartObservingRootWindow(); |
| 1898 | 1900 |
| 1899 if (resize) | 1901 if (resize) |
| 1900 WasResized(); | 1902 WasResized(); |
| 1901 | 1903 |
| 1902 if (!selection_controller_) | 1904 if (!touch_selection_controller_) |
| 1903 selection_controller_ = CreateSelectionController(this, content_view_core_); | 1905 touch_selection_controller_ = |
| 1906 CreateSelectionController(this, content_view_core_); |
| 1904 | 1907 |
| 1905 if (content_view_core_) | 1908 if (content_view_core_) |
| 1906 CreateOverscrollControllerIfPossible(); | 1909 CreateOverscrollControllerIfPossible(); |
| 1907 } | 1910 } |
| 1908 | 1911 |
| 1909 void RenderWidgetHostViewAndroid::RunAckCallbacks() { | 1912 void RenderWidgetHostViewAndroid::RunAckCallbacks() { |
| 1910 while (!ack_callbacks_.empty()) { | 1913 while (!ack_callbacks_.empty()) { |
| 1911 ack_callbacks_.front().Run(); | 1914 ack_callbacks_.front().Run(); |
| 1912 ack_callbacks_.pop(); | 1915 ack_callbacks_.pop(); |
| 1913 } | 1916 } |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2165 | 2168 |
| 2166 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); | 2169 ui::WindowAndroidCompositor* compositor = window_android->GetCompositor(); |
| 2167 if (!compositor) | 2170 if (!compositor) |
| 2168 return; | 2171 return; |
| 2169 | 2172 |
| 2170 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( | 2173 overscroll_controller_ = base::MakeUnique<OverscrollControllerAndroid>( |
| 2171 overscroll_refresh_handler, compositor, view_.GetDipScale()); | 2174 overscroll_refresh_handler, compositor, view_.GetDipScale()); |
| 2172 } | 2175 } |
| 2173 | 2176 |
| 2174 } // namespace content | 2177 } // namespace content |
| OLD | NEW |