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 "base/android/build_info.h" | 9 #include "base/android/build_info.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 | 281 |
282 ui::GestureProvider::Config CreateGestureProviderConfig() { | 282 ui::GestureProvider::Config CreateGestureProviderConfig() { |
283 ui::GestureProvider::Config config = ui::GetGestureProviderConfig( | 283 ui::GestureProvider::Config config = ui::GetGestureProviderConfig( |
284 ui::GestureProviderConfigType::CURRENT_PLATFORM); | 284 ui::GestureProviderConfigType::CURRENT_PLATFORM); |
285 config.disable_click_delay = | 285 config.disable_click_delay = |
286 base::CommandLine::ForCurrentProcess()->HasSwitch( | 286 base::CommandLine::ForCurrentProcess()->HasSwitch( |
287 switches::kDisableClickDelay); | 287 switches::kDisableClickDelay); |
288 return config; | 288 return config; |
289 } | 289 } |
290 | 290 |
| 291 ui::SelectionBound::Type ConvertSelectionBoundType( |
| 292 cc::SelectionBoundType type) { |
| 293 switch (type) { |
| 294 case cc::SELECTION_BOUND_LEFT: |
| 295 return ui::SelectionBound::LEFT; |
| 296 case cc::SELECTION_BOUND_RIGHT: |
| 297 return ui::SelectionBound::RIGHT; |
| 298 case cc::SELECTION_BOUND_CENTER: |
| 299 return ui::SelectionBound::CENTER; |
| 300 case cc::SELECTION_BOUND_EMPTY: |
| 301 return ui::SelectionBound::EMPTY; |
| 302 } |
| 303 NOTREACHED() << "Unknown selection bound type"; |
| 304 return ui::SelectionBound::EMPTY; |
| 305 } |
| 306 |
| 307 ui::SelectionBound ConvertSelectionBound( |
| 308 const cc::ViewportSelectionBound& bound) { |
| 309 ui::SelectionBound ui_bound; |
| 310 ui_bound.set_type(ConvertSelectionBoundType(bound.type)); |
| 311 ui_bound.set_visible(bound.visible); |
| 312 if (ui_bound.type() != ui::SelectionBound::EMPTY) |
| 313 ui_bound.SetEdge(bound.edge_top, bound.edge_bottom); |
| 314 return ui_bound; |
| 315 } |
| 316 |
291 } // anonymous namespace | 317 } // anonymous namespace |
292 | 318 |
293 ReadbackRequest::ReadbackRequest(float scale, | 319 ReadbackRequest::ReadbackRequest(float scale, |
294 SkColorType color_type, | 320 SkColorType color_type, |
295 gfx::Rect src_subrect, | 321 gfx::Rect src_subrect, |
296 ReadbackRequestCallback& result_callback) | 322 ReadbackRequestCallback& result_callback) |
297 : scale_(scale), | 323 : scale_(scale), |
298 color_type_(color_type), | 324 color_type_(color_type), |
299 src_subrect_(src_subrect), | 325 src_subrect_(src_subrect), |
300 result_callback_(result_callback) { | 326 result_callback_(result_callback) { |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 !IsMobileOptimizedFrame(frame_metadata)); | 1340 !IsMobileOptimizedFrame(frame_metadata)); |
1315 | 1341 |
1316 if (!content_view_core_) | 1342 if (!content_view_core_) |
1317 return; | 1343 return; |
1318 | 1344 |
1319 if (overscroll_controller_) | 1345 if (overscroll_controller_) |
1320 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); | 1346 overscroll_controller_->OnFrameMetadataUpdated(frame_metadata); |
1321 | 1347 |
1322 if (selection_controller_) { | 1348 if (selection_controller_) { |
1323 selection_controller_->OnSelectionBoundsChanged( | 1349 selection_controller_->OnSelectionBoundsChanged( |
1324 ui::SelectionBound(frame_metadata.selection_start), | 1350 ConvertSelectionBound(frame_metadata.selection_start), |
1325 ui::SelectionBound(frame_metadata.selection_end)); | 1351 ConvertSelectionBound(frame_metadata.selection_end)); |
1326 } | 1352 } |
1327 | 1353 |
1328 // All offsets and sizes are in CSS pixels. | 1354 // All offsets and sizes are in CSS pixels. |
1329 content_view_core_->UpdateFrameInfo( | 1355 content_view_core_->UpdateFrameInfo( |
1330 frame_metadata.root_scroll_offset, | 1356 frame_metadata.root_scroll_offset, |
1331 frame_metadata.page_scale_factor, | 1357 frame_metadata.page_scale_factor, |
1332 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1358 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
1333 frame_metadata.max_page_scale_factor), | 1359 frame_metadata.max_page_scale_factor), |
1334 frame_metadata.root_layer_size, | 1360 frame_metadata.root_layer_size, |
1335 frame_metadata.scrollable_viewport_size, | 1361 frame_metadata.scrollable_viewport_size, |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1911 results->orientationAngle = display.RotationAsDegree(); | 1937 results->orientationAngle = display.RotationAsDegree(); |
1912 results->orientationType = | 1938 results->orientationType = |
1913 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); | 1939 RenderWidgetHostViewBase::GetOrientationTypeForMobile(display); |
1914 gfx::DeviceDisplayInfo info; | 1940 gfx::DeviceDisplayInfo info; |
1915 results->depth = info.GetBitsPerPixel(); | 1941 results->depth = info.GetBitsPerPixel(); |
1916 results->depthPerComponent = info.GetBitsPerComponent(); | 1942 results->depthPerComponent = info.GetBitsPerComponent(); |
1917 results->isMonochrome = (results->depthPerComponent == 0); | 1943 results->isMonochrome = (results->depthPerComponent == 0); |
1918 } | 1944 } |
1919 | 1945 |
1920 } // namespace content | 1946 } // namespace content |
OLD | NEW |