Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(521)

Side by Side Diff: android_webview/native/aw_contents.cc

Issue 16255010: Hookup android_webview scroll offset delegation to Java side. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 state_vector.size()); 642 state_vector.size());
643 PickleIterator iterator(pickle); 643 PickleIterator iterator(pickle);
644 644
645 return RestoreFromPickle(&iterator, web_contents_.get()); 645 return RestoreFromPickle(&iterator, web_contents_.get());
646 } 646 }
647 647
648 bool AwContents::OnDraw(JNIEnv* env, 648 bool AwContents::OnDraw(JNIEnv* env,
649 jobject obj, 649 jobject obj,
650 jobject canvas, 650 jobject canvas,
651 jboolean is_hardware_accelerated, 651 jboolean is_hardware_accelerated,
652 jint scroll_x, 652 jint scroll_x_pix,
653 jint scroll_y, 653 jint scroll_y_pix,
654 jint clip_left, 654 jint clip_left,
655 jint clip_top, 655 jint clip_top,
656 jint clip_right, 656 jint clip_right,
657 jint clip_bottom) { 657 jint clip_bottom) {
658 return browser_view_renderer_->OnDraw(canvas, 658 return browser_view_renderer_->OnDraw(
659 is_hardware_accelerated, 659 canvas,
660 gfx::Point(scroll_x, scroll_y), 660 is_hardware_accelerated,
661 gfx::Rect(clip_left, 661 gfx::Vector2d(scroll_x_pix, scroll_y_pix),
662 clip_top, 662 gfx::Rect(clip_left,
663 clip_right - clip_left, 663 clip_top,
664 clip_bottom - clip_top)); 664 clip_right - clip_left,
665 clip_bottom - clip_top));
665 } 666 }
666 667
667 void AwContents::SetPendingWebContentsForPopup( 668 void AwContents::SetPendingWebContentsForPopup(
668 scoped_ptr<content::WebContents> pending) { 669 scoped_ptr<content::WebContents> pending) {
669 if (pending_contents_.get()) { 670 if (pending_contents_.get()) {
670 // TODO(benm): Support holding multiple pop up window requests. 671 // TODO(benm): Support holding multiple pop up window requests.
671 LOG(WARNING) << "Blocking popup window creation as an outstanding " 672 LOG(WARNING) << "Blocking popup window creation as an outstanding "
672 << "popup window is still pending."; 673 << "popup window is still pending.";
673 base::MessageLoop::current()->DeleteSoon(FROM_HERE, pending.release()); 674 base::MessageLoop::current()->DeleteSoon(FROM_HERE, pending.release());
674 return; 675 return;
(...skipping 15 matching lines...) Expand all
690 if (obj.is_null()) 691 if (obj.is_null())
691 return gfx::Point(); 692 return gfx::Point();
692 std::vector<int> location; 693 std::vector<int> location;
693 base::android::JavaIntArrayToIntVector( 694 base::android::JavaIntArrayToIntVector(
694 env, 695 env,
695 Java_AwContents_getLocationOnScreen(env, obj.obj()).obj(), 696 Java_AwContents_getLocationOnScreen(env, obj.obj()).obj(),
696 &location); 697 &location);
697 return gfx::Point(location[0], location[1]); 698 return gfx::Point(location[0], location[1]);
698 } 699 }
699 700
701 void AwContents::ScrollContainerViewTo(gfx::Vector2dF new_value_css) {
702 JNIEnv* env = AttachCurrentThread();
703 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
704 if (obj.is_null())
705 return;
706 Java_AwContents_scrollContainerViewTo(
707 env, obj.obj(), new_value_css.x(), new_value_css.y());
708 }
709
710 void AwContents::ScrollTo(JNIEnv* env, jobject obj, jint x, jint y) {
711 browser_view_renderer_->ScrollTo(gfx::Vector2dF(x, y));
712 }
713
700 void AwContents::OnPageScaleFactorChanged(float page_scale_factor) { 714 void AwContents::OnPageScaleFactorChanged(float page_scale_factor) {
701 JNIEnv* env = AttachCurrentThread(); 715 JNIEnv* env = AttachCurrentThread();
702 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 716 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
703 if (obj.is_null()) 717 if (obj.is_null())
704 return; 718 return;
705 Java_AwContents_onPageScaleFactorChanged(env, obj.obj(), page_scale_factor); 719 Java_AwContents_onPageScaleFactorChanged(env, obj.obj(), page_scale_factor);
706 } 720 }
707 721
708 ScopedJavaLocalRef<jobject> AwContents::CapturePicture(JNIEnv* env, 722 ScopedJavaLocalRef<jobject> AwContents::CapturePicture(JNIEnv* env,
709 jobject obj) { 723 jobject obj) {
710 return browser_view_renderer_->CapturePicture(); 724 return browser_view_renderer_->CapturePicture();
711 } 725 }
712 726
713 void AwContents::EnableOnNewPicture(JNIEnv* env, 727 void AwContents::EnableOnNewPicture(JNIEnv* env,
714 jobject obj, 728 jobject obj,
715 jboolean enabled) { 729 jboolean enabled) {
716 browser_view_renderer_->EnableOnNewPicture(enabled); 730 browser_view_renderer_->EnableOnNewPicture(enabled);
717 } 731 }
718 732
719 } // namespace android_webview 733 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698