| 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/browser_view_renderer_impl.h" | 9 #include "android_webview/browser/browser_view_renderer_impl.h" |
| 10 #include "android_webview/browser/gpu_memory_buffer_impl.h" | 10 #include "android_webview/browser/gpu_memory_buffer_impl.h" |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 web_contents_->FocusThroughTabTraversal(false); | 621 web_contents_->FocusThroughTabTraversal(false); |
| 622 } | 622 } |
| 623 | 623 |
| 624 jint AwContents::ReleasePopupWebContents(JNIEnv* env, jobject obj) { | 624 jint AwContents::ReleasePopupWebContents(JNIEnv* env, jobject obj) { |
| 625 return reinterpret_cast<jint>(pending_contents_.release()); | 625 return reinterpret_cast<jint>(pending_contents_.release()); |
| 626 } | 626 } |
| 627 | 627 |
| 628 gfx::Point AwContents::GetLocationOnScreen() { | 628 gfx::Point AwContents::GetLocationOnScreen() { |
| 629 JNIEnv* env = AttachCurrentThread(); | 629 JNIEnv* env = AttachCurrentThread(); |
| 630 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 630 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 631 if (obj.is_null()) return gfx::Point(); | 631 if (obj.is_null()) |
| 632 return gfx::Point(); |
| 632 std::vector<int> location; | 633 std::vector<int> location; |
| 633 base::android::JavaIntArrayToIntVector( | 634 base::android::JavaIntArrayToIntVector( |
| 634 env, | 635 env, |
| 635 Java_AwContents_getLocationOnScreen(env, obj.obj()).obj(), | 636 Java_AwContents_getLocationOnScreen(env, obj.obj()).obj(), |
| 636 &location); | 637 &location); |
| 637 return gfx::Point(location[0], location[1]); | 638 return gfx::Point(location[0], location[1]); |
| 638 } | 639 } |
| 639 | 640 |
| 641 void AwContents::OnPageScaleFactorChanged(float page_scale_factor) { |
| 642 JNIEnv* env = AttachCurrentThread(); |
| 643 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 644 if (obj.is_null()) |
| 645 return; |
| 646 Java_AwContents_onPageScaleFactorChanged(env, obj.obj(), page_scale_factor); |
| 647 } |
| 648 |
| 640 ScopedJavaLocalRef<jobject> AwContents::CapturePicture(JNIEnv* env, | 649 ScopedJavaLocalRef<jobject> AwContents::CapturePicture(JNIEnv* env, |
| 641 jobject obj) { | 650 jobject obj) { |
| 642 return browser_view_renderer_->CapturePicture(); | 651 return browser_view_renderer_->CapturePicture(); |
| 643 } | 652 } |
| 644 | 653 |
| 645 void AwContents::EnableOnNewPicture(JNIEnv* env, | 654 void AwContents::EnableOnNewPicture(JNIEnv* env, |
| 646 jobject obj, | 655 jobject obj, |
| 647 jboolean enabled, | 656 jboolean enabled, |
| 648 jboolean invalidation_only) { | 657 jboolean invalidation_only) { |
| 649 BrowserViewRenderer::OnNewPictureMode mode = | 658 BrowserViewRenderer::OnNewPictureMode mode = |
| 650 BrowserViewRenderer::kOnNewPictureDisabled; | 659 BrowserViewRenderer::kOnNewPictureDisabled; |
| 651 if (enabled) { | 660 if (enabled) { |
| 652 mode = invalidation_only ? | 661 mode = invalidation_only ? |
| 653 BrowserViewRenderer::kOnNewPictureInvalidationOnly : | 662 BrowserViewRenderer::kOnNewPictureInvalidationOnly : |
| 654 BrowserViewRenderer::kOnNewPictureEnabled; | 663 BrowserViewRenderer::kOnNewPictureEnabled; |
| 655 } | 664 } |
| 656 | 665 |
| 657 browser_view_renderer_->EnableOnNewPicture(mode); | 666 browser_view_renderer_->EnableOnNewPicture(mode); |
| 658 } | 667 } |
| 659 | 668 |
| 660 } // namespace android_webview | 669 } // namespace android_webview |
| OLD | NEW |