| 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 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 // All positions and sizes are in CSS pixels. | 372 // All positions and sizes are in CSS pixels. |
| 373 // Note that viewport_width/height is a best effort based. | 373 // Note that viewport_width/height is a best effort based. |
| 374 // ContentViewCore has the actual information about the physical viewport size. | 374 // ContentViewCore has the actual information about the physical viewport size. |
| 375 void ContentViewCoreImpl::UpdateFrameInfo( | 375 void ContentViewCoreImpl::UpdateFrameInfo( |
| 376 const gfx::Vector2dF& scroll_offset, | 376 const gfx::Vector2dF& scroll_offset, |
| 377 float page_scale_factor, | 377 float page_scale_factor, |
| 378 const gfx::Vector2dF& page_scale_factor_limits, | 378 const gfx::Vector2dF& page_scale_factor_limits, |
| 379 const gfx::SizeF& content_size, | 379 const gfx::SizeF& content_size, |
| 380 const gfx::SizeF& viewport_size, | 380 const gfx::SizeF& viewport_size, |
| 381 const gfx::Vector2dF& controls_offset, | 381 const gfx::Vector2dF& controls_offset, |
| 382 const gfx::Vector2dF& content_offset) { | 382 const gfx::Vector2dF& content_offset, |
| 383 bool has_insertion_marker, |
| 384 float insertion_marker_x, |
| 385 float insertion_marker_top, |
| 386 float insertion_marker_bottom) { |
| 383 JNIEnv* env = AttachCurrentThread(); | 387 JNIEnv* env = AttachCurrentThread(); |
| 384 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 388 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 385 if (obj.is_null()) | 389 if (obj.is_null()) |
| 386 return; | 390 return; |
| 387 | 391 |
| 388 window_android_->set_content_offset( | 392 window_android_->set_content_offset( |
| 389 gfx::ScaleVector2d(content_offset, dpi_scale_)); | 393 gfx::ScaleVector2d(content_offset, dpi_scale_)); |
| 390 | 394 |
| 391 Java_ContentViewCore_updateFrameInfo( | 395 Java_ContentViewCore_updateFrameInfo( |
| 392 env, obj.obj(), | 396 env, obj.obj(), |
| 393 scroll_offset.x(), | 397 scroll_offset.x(), |
| 394 scroll_offset.y(), | 398 scroll_offset.y(), |
| 395 page_scale_factor, | 399 page_scale_factor, |
| 396 page_scale_factor_limits.x(), | 400 page_scale_factor_limits.x(), |
| 397 page_scale_factor_limits.y(), | 401 page_scale_factor_limits.y(), |
| 398 content_size.width(), | 402 content_size.width(), |
| 399 content_size.height(), | 403 content_size.height(), |
| 400 viewport_size.width(), | 404 viewport_size.width(), |
| 401 viewport_size.height(), | 405 viewport_size.height(), |
| 402 controls_offset.y(), | 406 controls_offset.y(), |
| 403 content_offset.y()); | 407 content_offset.y(), |
| 408 has_insertion_marker, |
| 409 insertion_marker_x, |
| 410 insertion_marker_top, |
| 411 insertion_marker_bottom); |
| 404 } | 412 } |
| 405 | 413 |
| 406 void ContentViewCoreImpl::SetTitle(const base::string16& title) { | 414 void ContentViewCoreImpl::SetTitle(const base::string16& title) { |
| 407 JNIEnv* env = AttachCurrentThread(); | 415 JNIEnv* env = AttachCurrentThread(); |
| 408 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 416 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 409 if (obj.is_null()) | 417 if (obj.is_null()) |
| 410 return; | 418 return; |
| 411 ScopedJavaLocalRef<jstring> jtitle = | 419 ScopedJavaLocalRef<jstring> jtitle = |
| 412 ConvertUTF8ToJavaString(env, base::UTF16ToUTF8(title)); | 420 ConvertUTF8ToJavaString(env, base::UTF16ToUTF8(title)); |
| 413 Java_ContentViewCore_setTitle(env, obj.obj(), jtitle.obj()); | 421 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), | 1333 reinterpret_cast<ui::WindowAndroid*>(window_android), |
| 1326 retained_objects_set); | 1334 retained_objects_set); |
| 1327 return reinterpret_cast<intptr_t>(view); | 1335 return reinterpret_cast<intptr_t>(view); |
| 1328 } | 1336 } |
| 1329 | 1337 |
| 1330 bool RegisterContentViewCore(JNIEnv* env) { | 1338 bool RegisterContentViewCore(JNIEnv* env) { |
| 1331 return RegisterNativesImpl(env); | 1339 return RegisterNativesImpl(env); |
| 1332 } | 1340 } |
| 1333 | 1341 |
| 1334 } // namespace content | 1342 } // namespace content |
| OLD | NEW |