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 "android_webview/native/aw_contents.h" | 5 #include "android_webview/native/aw_contents.h" |
6 | 6 |
7 #include "android_webview/browser/aw_browser_context.h" | 7 #include "android_webview/browser/aw_browser_context.h" |
8 #include "android_webview/browser/aw_browser_main_parts.h" | 8 #include "android_webview/browser/aw_browser_main_parts.h" |
9 #include "android_webview/browser/gpu_memory_buffer_impl.h" | 9 #include "android_webview/browser/gpu_memory_buffer_impl.h" |
10 #include "android_webview/browser/in_process_view_renderer.h" | 10 #include "android_webview/browser/in_process_view_renderer.h" |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 jobject canvas, | 629 jobject canvas, |
630 jboolean is_hardware_accelerated, | 630 jboolean is_hardware_accelerated, |
631 jint scroll_x, | 631 jint scroll_x, |
632 jint scroll_y, | 632 jint scroll_y, |
633 jint clip_left, | 633 jint clip_left, |
634 jint clip_top, | 634 jint clip_top, |
635 jint clip_right, | 635 jint clip_right, |
636 jint clip_bottom) { | 636 jint clip_bottom) { |
637 return browser_view_renderer_->OnDraw(canvas, | 637 return browser_view_renderer_->OnDraw(canvas, |
638 is_hardware_accelerated, | 638 is_hardware_accelerated, |
639 gfx::Point(scroll_x, scroll_y), | 639 gfx::Vector2d(scroll_x, scroll_y), |
640 gfx::Rect(clip_left, | 640 gfx::Rect(clip_left, |
641 clip_top, | 641 clip_top, |
642 clip_right - clip_left, | 642 clip_right - clip_left, |
643 clip_bottom - clip_top)); | 643 clip_bottom - clip_top)); |
644 } | 644 } |
645 | 645 |
646 void AwContents::SetPendingWebContentsForPopup( | 646 void AwContents::SetPendingWebContentsForPopup( |
647 scoped_ptr<content::WebContents> pending) { | 647 scoped_ptr<content::WebContents> pending) { |
648 if (pending_contents_.get()) { | 648 if (pending_contents_.get()) { |
649 // TODO(benm): Support holding multiple pop up window requests. | 649 // TODO(benm): Support holding multiple pop up window requests. |
(...skipping 19 matching lines...) Expand all Loading... |
669 if (obj.is_null()) | 669 if (obj.is_null()) |
670 return gfx::Point(); | 670 return gfx::Point(); |
671 std::vector<int> location; | 671 std::vector<int> location; |
672 base::android::JavaIntArrayToIntVector( | 672 base::android::JavaIntArrayToIntVector( |
673 env, | 673 env, |
674 Java_AwContents_getLocationOnScreen(env, obj.obj()).obj(), | 674 Java_AwContents_getLocationOnScreen(env, obj.obj()).obj(), |
675 &location); | 675 &location); |
676 return gfx::Point(location[0], location[1]); | 676 return gfx::Point(location[0], location[1]); |
677 } | 677 } |
678 | 678 |
| 679 void AwContents::ScrollContainerViewTo(gfx::Vector2d new_value) { |
| 680 JNIEnv* env = AttachCurrentThread(); |
| 681 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 682 if (obj.is_null()) |
| 683 return; |
| 684 Java_AwContents_scrollContainerViewTo( |
| 685 env, obj.obj(), new_value.x(), new_value.y()); |
| 686 } |
| 687 |
| 688 |
| 689 void AwContents::SetDipScale(JNIEnv* env, jobject obj, jfloat dipScale) { |
| 690 browser_view_renderer_->SetDipScale(dipScale); |
| 691 } |
| 692 |
| 693 void AwContents::ScrollTo(JNIEnv* env, jobject obj, jint xPix, jint yPix) { |
| 694 browser_view_renderer_->ScrollTo(gfx::Vector2d(xPix, yPix)); |
| 695 } |
| 696 |
679 void AwContents::OnPageScaleFactorChanged(float page_scale_factor) { | 697 void AwContents::OnPageScaleFactorChanged(float page_scale_factor) { |
680 JNIEnv* env = AttachCurrentThread(); | 698 JNIEnv* env = AttachCurrentThread(); |
681 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 699 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
682 if (obj.is_null()) | 700 if (obj.is_null()) |
683 return; | 701 return; |
684 Java_AwContents_onPageScaleFactorChanged(env, obj.obj(), page_scale_factor); | 702 Java_AwContents_onPageScaleFactorChanged(env, obj.obj(), page_scale_factor); |
685 } | 703 } |
686 | 704 |
687 ScopedJavaLocalRef<jobject> AwContents::CapturePicture(JNIEnv* env, | 705 ScopedJavaLocalRef<jobject> AwContents::CapturePicture(JNIEnv* env, |
688 jobject obj) { | 706 jobject obj) { |
689 return browser_view_renderer_->CapturePicture(); | 707 return browser_view_renderer_->CapturePicture(); |
690 } | 708 } |
691 | 709 |
692 void AwContents::EnableOnNewPicture(JNIEnv* env, | 710 void AwContents::EnableOnNewPicture(JNIEnv* env, |
693 jobject obj, | 711 jobject obj, |
694 jboolean enabled) { | 712 jboolean enabled) { |
695 browser_view_renderer_->EnableOnNewPicture(enabled); | 713 browser_view_renderer_->EnableOnNewPicture(enabled); |
696 } | 714 } |
697 | 715 |
698 } // namespace android_webview | 716 } // namespace android_webview |
OLD | NEW |