OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/android/content_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_array.h" | 10 #include "base/android/jni_array.h" |
11 #include "base/android/jni_string.h" | 11 #include "base/android/jni_string.h" |
12 #include "base/android/scoped_java_ref.h" | 12 #include "base/android/scoped_java_ref.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/values.h" | 18 #include "base/values.h" |
19 #include "cc/layers/layer.h" | 19 #include "cc/layers/layer.h" |
20 #include "cc/layers/solid_color_layer.h" | 20 #include "cc/layers/solid_color_layer.h" |
21 #include "cc/output/begin_frame_args.h" | 21 #include "cc/output/begin_frame_args.h" |
22 #include "cc/output/viewport_selection_bound.h" | |
23 #include "content/browser/accessibility/browser_accessibility_manager_android.h" | 22 #include "content/browser/accessibility/browser_accessibility_manager_android.h" |
24 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 23 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
25 #include "content/browser/android/gesture_event_type.h" | 24 #include "content/browser/android/gesture_event_type.h" |
26 #include "content/browser/android/interstitial_page_delegate_android.h" | 25 #include "content/browser/android/interstitial_page_delegate_android.h" |
27 #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h" | 26 #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h" |
28 #include "content/browser/android/load_url_params.h" | 27 #include "content/browser/android/load_url_params.h" |
29 #include "content/browser/frame_host/interstitial_page_impl.h" | 28 #include "content/browser/frame_host/interstitial_page_impl.h" |
30 #include "content/browser/geolocation/geolocation_service_context.h" | 29 #include "content/browser/geolocation/geolocation_service_context.h" |
31 #include "content/browser/media/media_web_contents_observer.h" | 30 #include "content/browser/media/media_web_contents_observer.h" |
32 #include "content/browser/renderer_host/compositor_impl_android.h" | 31 #include "content/browser/renderer_host/compositor_impl_android.h" |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 // ContentViewCore has the actual information about the physical viewport size. | 416 // ContentViewCore has the actual information about the physical viewport size. |
418 void ContentViewCoreImpl::UpdateFrameInfo( | 417 void ContentViewCoreImpl::UpdateFrameInfo( |
419 const gfx::Vector2dF& scroll_offset, | 418 const gfx::Vector2dF& scroll_offset, |
420 float page_scale_factor, | 419 float page_scale_factor, |
421 const gfx::Vector2dF& page_scale_factor_limits, | 420 const gfx::Vector2dF& page_scale_factor_limits, |
422 const gfx::SizeF& content_size, | 421 const gfx::SizeF& content_size, |
423 const gfx::SizeF& viewport_size, | 422 const gfx::SizeF& viewport_size, |
424 const gfx::Vector2dF& controls_offset, | 423 const gfx::Vector2dF& controls_offset, |
425 const gfx::Vector2dF& content_offset, | 424 const gfx::Vector2dF& content_offset, |
426 bool is_mobile_optimized_hint, | 425 bool is_mobile_optimized_hint, |
427 const cc::ViewportSelectionBound& selection_start) { | 426 const gfx::SelectionBound& selection_start) { |
428 JNIEnv* env = AttachCurrentThread(); | 427 JNIEnv* env = AttachCurrentThread(); |
429 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 428 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
430 if (obj.is_null() || !window_android_) | 429 if (obj.is_null() || !window_android_) |
431 return; | 430 return; |
432 | 431 |
433 window_android_->set_content_offset( | 432 window_android_->set_content_offset( |
434 gfx::ScaleVector2d(content_offset, dpi_scale_)); | 433 gfx::ScaleVector2d(content_offset, dpi_scale_)); |
435 | 434 |
436 page_scale_ = page_scale_factor; | 435 page_scale_ = page_scale_factor; |
437 | 436 |
438 // The CursorAnchorInfo API in Android only supports zero width selection | 437 // The CursorAnchorInfo API in Android only supports zero width selection |
439 // bounds. | 438 // bounds. |
440 const jboolean has_insertion_marker = | 439 const jboolean has_insertion_marker = |
441 selection_start.type == cc::SELECTION_BOUND_CENTER; | 440 selection_start.type() == gfx::SelectionBound::CENTER; |
442 const jboolean is_insertion_marker_visible = selection_start.visible; | 441 const jboolean is_insertion_marker_visible = selection_start.visible(); |
443 const jfloat insertion_marker_horizontal = | 442 const jfloat insertion_marker_horizontal = |
444 has_insertion_marker ? selection_start.edge_top.x() : 0.0f; | 443 has_insertion_marker ? selection_start.edge_top().x() : 0.0f; |
445 const jfloat insertion_marker_top = | 444 const jfloat insertion_marker_top = |
446 has_insertion_marker ? selection_start.edge_top.y() : 0.0f; | 445 has_insertion_marker ? selection_start.edge_top().y() : 0.0f; |
447 const jfloat insertion_marker_bottom = | 446 const jfloat insertion_marker_bottom = |
448 has_insertion_marker ? selection_start.edge_bottom.y() : 0.0f; | 447 has_insertion_marker ? selection_start.edge_bottom().y() : 0.0f; |
449 | 448 |
450 Java_ContentViewCore_updateFrameInfo( | 449 Java_ContentViewCore_updateFrameInfo( |
451 env, obj.obj(), | 450 env, obj.obj(), |
452 scroll_offset.x(), | 451 scroll_offset.x(), |
453 scroll_offset.y(), | 452 scroll_offset.y(), |
454 page_scale_factor, | 453 page_scale_factor, |
455 page_scale_factor_limits.x(), | 454 page_scale_factor_limits.x(), |
456 page_scale_factor_limits.y(), | 455 page_scale_factor_limits.y(), |
457 content_size.width(), | 456 content_size.width(), |
458 content_size.height(), | 457 content_size.height(), |
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1581 return ScopedJavaLocalRef<jobject>(); | 1580 return ScopedJavaLocalRef<jobject>(); |
1582 | 1581 |
1583 return view->GetJavaObject(); | 1582 return view->GetJavaObject(); |
1584 } | 1583 } |
1585 | 1584 |
1586 bool RegisterContentViewCore(JNIEnv* env) { | 1585 bool RegisterContentViewCore(JNIEnv* env) { |
1587 return RegisterNativesImpl(env); | 1586 return RegisterNativesImpl(env); |
1588 } | 1587 } |
1589 | 1588 |
1590 } // namespace content | 1589 } // namespace content |
OLD | NEW |