OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/web_contents/web_contents_android.h" | 5 #include "content/browser/web_contents/web_contents_android.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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 if (!view->IsSurfaceAvailableForCopy()) { | 638 if (!view->IsSurfaceAvailableForCopy()) { |
639 result_callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE); | 639 result_callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE); |
640 return; | 640 return; |
641 } | 641 } |
642 view->GetScaledContentBitmap(scale, | 642 view->GetScaledContentBitmap(scale, |
643 pref_color_type, | 643 pref_color_type, |
644 gfx::Rect(x, y, width, height), | 644 gfx::Rect(x, y, width, height), |
645 result_callback); | 645 result_callback); |
646 } | 646 } |
647 | 647 |
| 648 void WebContentsAndroid::OnContextMenuClosed(JNIEnv* env, jobject obj) { |
| 649 static_cast<WebContentsImpl*>(web_contents_) |
| 650 ->NotifyContextMenuClosed(CustomContextMenuContext()); |
| 651 } |
| 652 |
648 void WebContentsAndroid::OnFinishGetContentBitmap( | 653 void WebContentsAndroid::OnFinishGetContentBitmap( |
649 ScopedJavaGlobalRef<jobject>* obj, | 654 ScopedJavaGlobalRef<jobject>* obj, |
650 ScopedJavaGlobalRef<jobject>* callback, | 655 ScopedJavaGlobalRef<jobject>* callback, |
651 const SkBitmap& bitmap, | 656 const SkBitmap& bitmap, |
652 ReadbackResponse response) { | 657 ReadbackResponse response) { |
653 JNIEnv* env = base::android::AttachCurrentThread(); | 658 JNIEnv* env = base::android::AttachCurrentThread(); |
654 ScopedJavaLocalRef<jobject> java_bitmap; | 659 ScopedJavaLocalRef<jobject> java_bitmap; |
655 if (response == READBACK_SUCCESS) | 660 if (response == READBACK_SUCCESS) |
656 java_bitmap = gfx::ConvertToJavaBitmap(&bitmap); | 661 java_bitmap = gfx::ConvertToJavaBitmap(&bitmap); |
657 Java_WebContentsImpl_onGetContentBitmapFinished(env, | 662 Java_WebContentsImpl_onGetContentBitmapFinished(env, |
658 obj->obj(), | 663 obj->obj(), |
659 callback->obj(), | 664 callback->obj(), |
660 java_bitmap.obj(), | 665 java_bitmap.obj(), |
661 response); | 666 response); |
662 } | 667 } |
| 668 |
663 } // namespace content | 669 } // namespace content |
OLD | NEW |