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" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 return java_ref_.get(env); | 391 return java_ref_.get(env); |
392 } | 392 } |
393 | 393 |
394 jint ContentViewCoreImpl::GetBackgroundColor(JNIEnv* env, jobject obj) { | 394 jint ContentViewCoreImpl::GetBackgroundColor(JNIEnv* env, jobject obj) { |
395 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid(); | 395 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid(); |
396 if (!rwhva) | 396 if (!rwhva) |
397 return SK_ColorWHITE; | 397 return SK_ColorWHITE; |
398 return rwhva->GetCachedBackgroundColor(); | 398 return rwhva->GetCachedBackgroundColor(); |
399 } | 399 } |
400 | 400 |
401 // All positions and sizes are in CSS pixels. | 401 // All positions and sizes (except |top_shown_pix|) are in CSS pixels. |
402 // Note that viewport_width/height is a best effort based. | 402 // Note that viewport_width/height is a best effort based. |
403 // ContentViewCore has the actual information about the physical viewport size. | 403 // ContentViewCore has the actual information about the physical viewport size. |
404 void ContentViewCoreImpl::UpdateFrameInfo( | 404 void ContentViewCoreImpl::UpdateFrameInfo( |
405 const gfx::Vector2dF& scroll_offset, | 405 const gfx::Vector2dF& scroll_offset, |
406 float page_scale_factor, | 406 float page_scale_factor, |
407 const gfx::Vector2dF& page_scale_factor_limits, | 407 const gfx::Vector2dF& page_scale_factor_limits, |
408 const gfx::SizeF& content_size, | 408 const gfx::SizeF& content_size, |
409 const gfx::SizeF& viewport_size, | 409 const gfx::SizeF& viewport_size, |
410 const float top_controls_height, | 410 const float content_offset, |
411 const float top_controls_shown_ratio, | 411 const float top_shown_pix, |
| 412 bool top_changed, |
412 bool is_mobile_optimized_hint) { | 413 bool is_mobile_optimized_hint) { |
413 JNIEnv* env = AttachCurrentThread(); | 414 JNIEnv* env = AttachCurrentThread(); |
414 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 415 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
415 if (obj.is_null() || !GetWindowAndroid()) | 416 if (obj.is_null() || !GetWindowAndroid()) |
416 return; | 417 return; |
417 | 418 |
418 GetViewAndroid()->set_content_offset( | 419 GetViewAndroid()->set_content_offset(gfx::Vector2dF(0.0f, content_offset)); |
419 gfx::Vector2dF(0.0f, top_controls_height * top_controls_shown_ratio)); | |
420 | 420 |
421 page_scale_ = page_scale_factor; | 421 page_scale_ = page_scale_factor; |
422 | 422 |
423 Java_ContentViewCore_updateFrameInfo( | 423 Java_ContentViewCore_updateFrameInfo( |
424 env, obj, scroll_offset.x(), scroll_offset.y(), page_scale_factor, | 424 env, obj, scroll_offset.x(), scroll_offset.y(), page_scale_factor, |
425 page_scale_factor_limits.x(), page_scale_factor_limits.y(), | 425 page_scale_factor_limits.x(), page_scale_factor_limits.y(), |
426 content_size.width(), content_size.height(), viewport_size.width(), | 426 content_size.width(), content_size.height(), viewport_size.width(), |
427 viewport_size.height(), top_controls_height, top_controls_shown_ratio, | 427 viewport_size.height(), top_shown_pix, top_changed, |
428 is_mobile_optimized_hint); | 428 is_mobile_optimized_hint); |
429 } | 429 } |
430 | 430 |
431 void ContentViewCoreImpl::ShowSelectPopupMenu( | 431 void ContentViewCoreImpl::ShowSelectPopupMenu( |
432 RenderFrameHost* frame, | 432 RenderFrameHost* frame, |
433 const gfx::Rect& bounds, | 433 const gfx::Rect& bounds, |
434 const std::vector<MenuItem>& items, | 434 const std::vector<MenuItem>& items, |
435 int selected_item, | 435 int selected_item, |
436 bool multiple, | 436 bool multiple, |
437 bool right_aligned) { | 437 bool right_aligned) { |
(...skipping 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 return ScopedJavaLocalRef<jobject>(); | 1275 return ScopedJavaLocalRef<jobject>(); |
1276 | 1276 |
1277 return view->GetJavaObject(); | 1277 return view->GetJavaObject(); |
1278 } | 1278 } |
1279 | 1279 |
1280 bool RegisterContentViewCore(JNIEnv* env) { | 1280 bool RegisterContentViewCore(JNIEnv* env) { |
1281 return RegisterNativesImpl(env); | 1281 return RegisterNativesImpl(env); |
1282 } | 1282 } |
1283 | 1283 |
1284 } // namespace content | 1284 } // namespace content |
OLD | NEW |