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" |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 386 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
387 if (obj.is_null()) | 387 if (obj.is_null()) |
388 return; | 388 return; |
389 Java_ContentViewCore_resetVSyncNotification(env, obj.obj()); | 389 Java_ContentViewCore_resetVSyncNotification(env, obj.obj()); |
390 } | 390 } |
391 | 391 |
392 // All positions and sizes are in CSS pixels. | 392 // All positions and sizes are in CSS pixels. |
393 // Note that viewport_width/height is a best effort based. | 393 // Note that viewport_width/height is a best effort based. |
394 // ContentViewCore has the actual information about the physical viewport size. | 394 // ContentViewCore has the actual information about the physical viewport size. |
395 void ContentViewCoreImpl::UpdateFrameInfo( | 395 void ContentViewCoreImpl::UpdateFrameInfo( |
396 const gfx::Vector2dF& scroll_offset, | 396 const cc::CompositorFrameMetadata& frame_metadata) { |
397 float page_scale_factor, | |
398 const gfx::Vector2dF& page_scale_factor_limits, | |
399 const gfx::SizeF& content_size, | |
400 const gfx::SizeF& viewport_size, | |
401 const gfx::Vector2dF& controls_offset, | |
402 const gfx::Vector2dF& content_offset, | |
403 float overdraw_bottom_height) { | |
404 JNIEnv* env = AttachCurrentThread(); | 397 JNIEnv* env = AttachCurrentThread(); |
405 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 398 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
406 if (obj.is_null()) | 399 if (obj.is_null()) |
407 return; | 400 return; |
408 | 401 |
409 if (window_android_) { | 402 if (window_android_) { |
410 gfx::Vector2dF window_offset( | 403 gfx::Vector2dF window_offset( |
411 Java_ContentViewCore_getLocationInWindowX(env, obj.obj()), | 404 Java_ContentViewCore_getLocationInWindowX(env, obj.obj()), |
412 Java_ContentViewCore_getLocationInWindowY(env, obj.obj())); | 405 Java_ContentViewCore_getLocationInWindowY(env, obj.obj())); |
413 window_android_->set_content_offset( | 406 window_android_->set_content_offset( |
414 gfx::ScaleVector2d(content_offset, dpi_scale_) + window_offset); | 407 gfx::ScaleVector2d(frame_metadata.location_bar_content_translation, |
| 408 dpi_scale_) + |
| 409 window_offset); |
415 } | 410 } |
416 | 411 |
417 Java_ContentViewCore_updateFrameInfo( | 412 Java_ContentViewCore_updateFrameInfo( |
418 env, obj.obj(), | 413 env, obj.obj(), |
419 scroll_offset.x(), | 414 frame_metadata.root_scroll_offset.x(), |
420 scroll_offset.y(), | 415 frame_metadata.root_scroll_offset.y(), |
421 page_scale_factor, | 416 frame_metadata.page_scale_factor, |
422 page_scale_factor_limits.x(), | 417 frame_metadata.min_page_scale_factor, |
423 page_scale_factor_limits.y(), | 418 frame_metadata.max_page_scale_factor, |
424 content_size.width(), | 419 frame_metadata.root_layer_size.width(), |
425 content_size.height(), | 420 frame_metadata.root_layer_size.height(), |
426 viewport_size.width(), | 421 frame_metadata.viewport_size.width(), |
427 viewport_size.height(), | 422 frame_metadata.viewport_size.height(), |
428 controls_offset.y(), | 423 frame_metadata.location_bar_offset.y(), |
429 content_offset.y(), | 424 frame_metadata.location_bar_content_translation.y(), |
430 overdraw_bottom_height); | 425 frame_metadata.overdraw_bottom_height, |
| 426 frame_metadata.allow_delayed_resize); |
431 } | 427 } |
432 | 428 |
433 void ContentViewCoreImpl::SetTitle(const base::string16& title) { | 429 void ContentViewCoreImpl::SetTitle(const base::string16& title) { |
434 JNIEnv* env = AttachCurrentThread(); | 430 JNIEnv* env = AttachCurrentThread(); |
435 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 431 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
436 if (obj.is_null()) | 432 if (obj.is_null()) |
437 return; | 433 return; |
438 ScopedJavaLocalRef<jstring> jtitle = | 434 ScopedJavaLocalRef<jstring> jtitle = |
439 ConvertUTF8ToJavaString(env, base::UTF16ToUTF8(title)); | 435 ConvertUTF8ToJavaString(env, base::UTF16ToUTF8(title)); |
440 Java_ContentViewCore_setTitle(env, obj.obj(), jtitle.obj()); | 436 Java_ContentViewCore_setTitle(env, obj.obj(), jtitle.obj()); |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1691 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1687 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1692 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1688 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1693 return reinterpret_cast<intptr_t>(view); | 1689 return reinterpret_cast<intptr_t>(view); |
1694 } | 1690 } |
1695 | 1691 |
1696 bool RegisterContentViewCore(JNIEnv* env) { | 1692 bool RegisterContentViewCore(JNIEnv* env) { |
1697 return RegisterNativesImpl(env); | 1693 return RegisterNativesImpl(env); |
1698 } | 1694 } |
1699 | 1695 |
1700 } // namespace content | 1696 } // namespace content |
OLD | NEW |