| 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 } | 581 } |
| 582 | 582 |
| 583 float RenderWidgetHostViewAndroid::GetTopControlsHeight() const { | 583 float RenderWidgetHostViewAndroid::GetTopControlsHeight() const { |
| 584 if (!content_view_core_) | 584 if (!content_view_core_) |
| 585 return 0.f; | 585 return 0.f; |
| 586 | 586 |
| 587 // The height of the top controls. | 587 // The height of the top controls. |
| 588 return content_view_core_->GetTopControlsHeightDip(); | 588 return content_view_core_->GetTopControlsHeightDip(); |
| 589 } | 589 } |
| 590 | 590 |
| 591 float RenderWidgetHostViewAndroid::GetBottomControlsHeight() const { |
| 592 if (!content_view_core_) |
| 593 return 0.f; |
| 594 |
| 595 // The height of the top controls. |
| 596 return content_view_core_->GetBottomControlsHeightDip(); |
| 597 } |
| 598 |
| 591 void RenderWidgetHostViewAndroid::UpdateCursor(const WebCursor& cursor) { | 599 void RenderWidgetHostViewAndroid::UpdateCursor(const WebCursor& cursor) { |
| 592 // There are no cursors on Android. | 600 // There are no cursors on Android. |
| 593 } | 601 } |
| 594 | 602 |
| 595 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { | 603 void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { |
| 596 // Do nothing. The UI notification is handled through ContentViewClient which | 604 // Do nothing. The UI notification is handled through ContentViewClient which |
| 597 // is TabContentsDelegate. | 605 // is TabContentsDelegate. |
| 598 } | 606 } |
| 599 | 607 |
| 600 long RenderWidgetHostViewAndroid::GetNativeImeAdapter() { | 608 long RenderWidgetHostViewAndroid::GetNativeImeAdapter() { |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 selection_controller_->OnSelectionEditable( | 1148 selection_controller_->OnSelectionEditable( |
| 1141 frame_metadata.selection.is_editable); | 1149 frame_metadata.selection.is_editable); |
| 1142 selection_controller_->OnSelectionEmpty( | 1150 selection_controller_->OnSelectionEmpty( |
| 1143 frame_metadata.selection.is_empty_text_form_control); | 1151 frame_metadata.selection.is_empty_text_form_control); |
| 1144 selection_controller_->OnSelectionBoundsChanged( | 1152 selection_controller_->OnSelectionBoundsChanged( |
| 1145 frame_metadata.selection.start, frame_metadata.selection.end); | 1153 frame_metadata.selection.start, frame_metadata.selection.end); |
| 1146 | 1154 |
| 1147 // Set parameters for adaptive handle orientation. | 1155 // Set parameters for adaptive handle orientation. |
| 1148 gfx::SizeF viewport_size(frame_metadata.scrollable_viewport_size); | 1156 gfx::SizeF viewport_size(frame_metadata.scrollable_viewport_size); |
| 1149 viewport_size.Scale(frame_metadata.page_scale_factor); | 1157 viewport_size.Scale(frame_metadata.page_scale_factor); |
| 1150 gfx::RectF viewport_rect( | 1158 gfx::RectF viewport_rect(0.0f, frame_metadata.top_controls_height * |
| 1151 frame_metadata.location_bar_content_translation.x(), | 1159 frame_metadata.top_controls_shown_ratio, |
| 1152 frame_metadata.location_bar_content_translation.y(), | 1160 viewport_size.width(), viewport_size.height()); |
| 1153 viewport_size.width(), viewport_size.height()); | |
| 1154 selection_controller_->OnViewportChanged(viewport_rect); | 1161 selection_controller_->OnViewportChanged(viewport_rect); |
| 1155 } | 1162 } |
| 1156 | 1163 |
| 1157 UpdateBackgroundColor(frame_metadata.root_background_color); | 1164 UpdateBackgroundColor(frame_metadata.root_background_color); |
| 1158 | 1165 |
| 1159 // All offsets and sizes are in CSS pixels. | 1166 // All offsets and sizes are in CSS pixels. |
| 1160 content_view_core_->UpdateFrameInfo( | 1167 content_view_core_->UpdateFrameInfo( |
| 1161 frame_metadata.root_scroll_offset, | 1168 frame_metadata.root_scroll_offset, |
| 1162 frame_metadata.page_scale_factor, | 1169 frame_metadata.page_scale_factor, |
| 1163 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1170 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
| 1164 frame_metadata.max_page_scale_factor), | 1171 frame_metadata.max_page_scale_factor), |
| 1165 frame_metadata.root_layer_size, | 1172 frame_metadata.root_layer_size, |
| 1166 frame_metadata.scrollable_viewport_size, | 1173 frame_metadata.scrollable_viewport_size, |
| 1167 frame_metadata.location_bar_offset, | 1174 frame_metadata.top_controls_height, |
| 1168 frame_metadata.location_bar_content_translation, | 1175 frame_metadata.top_controls_shown_ratio, |
| 1176 frame_metadata.bottom_controls_height, |
| 1177 frame_metadata.bottom_controls_shown_ratio, |
| 1169 is_mobile_optimized, | 1178 is_mobile_optimized, |
| 1170 frame_metadata.selection.start); | 1179 frame_metadata.selection.start); |
| 1171 #if defined(VIDEO_HOLE) | 1180 #if defined(VIDEO_HOLE) |
| 1172 if (host_) { | 1181 if (host_) { |
| 1173 WebContents* web_contents = | 1182 WebContents* web_contents = |
| 1174 WebContents::FromRenderViewHost(RenderViewHostImpl::From(host_)); | 1183 WebContents::FromRenderViewHost(RenderViewHostImpl::From(host_)); |
| 1175 if (web_contents) { | 1184 if (web_contents) { |
| 1176 MediaWebContentsObserverAndroid::FromWebContents(web_contents) | 1185 MediaWebContentsObserverAndroid::FromWebContents(web_contents) |
| 1177 ->OnFrameInfoUpdated(); | 1186 ->OnFrameInfoUpdated(); |
| 1178 } | 1187 } |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1849 case ui::MotionEvent::ACTION_UP: | 1858 case ui::MotionEvent::ACTION_UP: |
| 1850 case ui::MotionEvent::ACTION_POINTER_UP: | 1859 case ui::MotionEvent::ACTION_POINTER_UP: |
| 1851 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", | 1860 UMA_HISTOGRAM_CUSTOM_COUNTS("Event.Latency.OS.TOUCH_RELEASED", |
| 1852 delta.InMicroseconds(), 1, 1000000, 50); | 1861 delta.InMicroseconds(), 1, 1000000, 50); |
| 1853 default: | 1862 default: |
| 1854 return; | 1863 return; |
| 1855 } | 1864 } |
| 1856 } | 1865 } |
| 1857 | 1866 |
| 1858 } // namespace content | 1867 } // namespace content |
| OLD | NEW |