| 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 "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "cc/layers/layer.h" | 16 #include "cc/layers/layer.h" |
| 17 #include "cc/layers/solid_color_layer.h" | 17 #include "cc/layers/solid_color_layer.h" |
| 18 #include "cc/output/begin_frame_args.h" | 18 #include "cc/output/begin_frame_args.h" |
| 19 #include "cc/output/viewport_selection_bound.h" |
| 19 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 20 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| 20 #include "content/browser/android/gesture_event_type.h" | 21 #include "content/browser/android/gesture_event_type.h" |
| 21 #include "content/browser/android/interstitial_page_delegate_android.h" | 22 #include "content/browser/android/interstitial_page_delegate_android.h" |
| 22 #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h" | 23 #include "content/browser/android/java/gin_java_bridge_dispatcher_host.h" |
| 23 #include "content/browser/android/load_url_params.h" | 24 #include "content/browser/android/load_url_params.h" |
| 24 #include "content/browser/android/popup_touch_handle_drawable.h" | 25 #include "content/browser/android/popup_touch_handle_drawable.h" |
| 25 #include "content/browser/frame_host/interstitial_page_impl.h" | 26 #include "content/browser/frame_host/interstitial_page_impl.h" |
| 26 #include "content/browser/geolocation/geolocation_service_context.h" | 27 #include "content/browser/geolocation/geolocation_service_context.h" |
| 27 #include "content/browser/media/media_web_contents_observer.h" | 28 #include "content/browser/media/media_web_contents_observer.h" |
| 28 #include "content/browser/renderer_host/compositor_impl_android.h" | 29 #include "content/browser/renderer_host/compositor_impl_android.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 // All positions and sizes are in CSS pixels. | 373 // All positions and sizes are in CSS pixels. |
| 373 // Note that viewport_width/height is a best effort based. | 374 // Note that viewport_width/height is a best effort based. |
| 374 // ContentViewCore has the actual information about the physical viewport size. | 375 // ContentViewCore has the actual information about the physical viewport size. |
| 375 void ContentViewCoreImpl::UpdateFrameInfo( | 376 void ContentViewCoreImpl::UpdateFrameInfo( |
| 376 const gfx::Vector2dF& scroll_offset, | 377 const gfx::Vector2dF& scroll_offset, |
| 377 float page_scale_factor, | 378 float page_scale_factor, |
| 378 const gfx::Vector2dF& page_scale_factor_limits, | 379 const gfx::Vector2dF& page_scale_factor_limits, |
| 379 const gfx::SizeF& content_size, | 380 const gfx::SizeF& content_size, |
| 380 const gfx::SizeF& viewport_size, | 381 const gfx::SizeF& viewport_size, |
| 381 const gfx::Vector2dF& controls_offset, | 382 const gfx::Vector2dF& controls_offset, |
| 382 const gfx::Vector2dF& content_offset) { | 383 const gfx::Vector2dF& content_offset, |
| 384 const cc::ViewportSelectionBound& selection_start) { |
| 383 JNIEnv* env = AttachCurrentThread(); | 385 JNIEnv* env = AttachCurrentThread(); |
| 384 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 386 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 385 if (obj.is_null()) | 387 if (obj.is_null()) |
| 386 return; | 388 return; |
| 387 | 389 |
| 388 window_android_->set_content_offset( | 390 window_android_->set_content_offset( |
| 389 gfx::ScaleVector2d(content_offset, dpi_scale_)); | 391 gfx::ScaleVector2d(content_offset, dpi_scale_)); |
| 390 | 392 |
| 391 Java_ContentViewCore_updateFrameInfo( | 393 Java_ContentViewCore_updateFrameInfo( |
| 392 env, obj.obj(), | 394 env, obj.obj(), |
| 393 scroll_offset.x(), | 395 scroll_offset.x(), |
| 394 scroll_offset.y(), | 396 scroll_offset.y(), |
| 395 page_scale_factor, | 397 page_scale_factor, |
| 396 page_scale_factor_limits.x(), | 398 page_scale_factor_limits.x(), |
| 397 page_scale_factor_limits.y(), | 399 page_scale_factor_limits.y(), |
| 398 content_size.width(), | 400 content_size.width(), |
| 399 content_size.height(), | 401 content_size.height(), |
| 400 viewport_size.width(), | 402 viewport_size.width(), |
| 401 viewport_size.height(), | 403 viewport_size.height(), |
| 402 controls_offset.y(), | 404 controls_offset.y(), |
| 403 content_offset.y()); | 405 content_offset.y(), |
| 406 selection_start.type, |
| 407 selection_start.edge_top.x(), |
| 408 selection_start.edge_top.y(), |
| 409 selection_start.edge_bottom.y()); |
| 404 } | 410 } |
| 405 | 411 |
| 406 void ContentViewCoreImpl::SetTitle(const base::string16& title) { | 412 void ContentViewCoreImpl::SetTitle(const base::string16& title) { |
| 407 JNIEnv* env = AttachCurrentThread(); | 413 JNIEnv* env = AttachCurrentThread(); |
| 408 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 414 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 409 if (obj.is_null()) | 415 if (obj.is_null()) |
| 410 return; | 416 return; |
| 411 ScopedJavaLocalRef<jstring> jtitle = | 417 ScopedJavaLocalRef<jstring> jtitle = |
| 412 ConvertUTF8ToJavaString(env, base::UTF16ToUTF8(title)); | 418 ConvertUTF8ToJavaString(env, base::UTF16ToUTF8(title)); |
| 413 Java_ContentViewCore_setTitle(env, obj.obj(), jtitle.obj()); | 419 Java_ContentViewCore_setTitle(env, obj.obj(), jtitle.obj()); |
| (...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1331 reinterpret_cast<ui::WindowAndroid*>(window_android), |
| 1326 retained_objects_set); | 1332 retained_objects_set); |
| 1327 return reinterpret_cast<intptr_t>(view); | 1333 return reinterpret_cast<intptr_t>(view); |
| 1328 } | 1334 } |
| 1329 | 1335 |
| 1330 bool RegisterContentViewCore(JNIEnv* env) { | 1336 bool RegisterContentViewCore(JNIEnv* env) { |
| 1331 return RegisterNativesImpl(env); | 1337 return RegisterNativesImpl(env); |
| 1332 } | 1338 } |
| 1333 | 1339 |
| 1334 } // namespace content | 1340 } // namespace content |
| OLD | NEW |