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

Side by Side Diff: content/browser/web_contents/web_contents_android.cc

Issue 2417263002: Pass JavaRef to Java methods in ui. (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 jfloat x, 631 jfloat x,
632 jfloat y, 632 jfloat y,
633 jfloat width, 633 jfloat width,
634 jfloat height) { 634 jfloat height) {
635 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); 635 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
636 const ReadbackRequestCallback result_callback = 636 const ReadbackRequestCallback result_callback =
637 base::Bind(&WebContentsAndroid::OnFinishGetContentBitmap, 637 base::Bind(&WebContentsAndroid::OnFinishGetContentBitmap,
638 weak_factory_.GetWeakPtr(), 638 weak_factory_.GetWeakPtr(),
639 base::Owned(new ScopedJavaGlobalRef<jobject>(env, obj)), 639 base::Owned(new ScopedJavaGlobalRef<jobject>(env, obj)),
640 base::Owned(new ScopedJavaGlobalRef<jobject>(env, jcallback))); 640 base::Owned(new ScopedJavaGlobalRef<jobject>(env, jcallback)));
641 SkColorType pref_color_type = gfx::ConvertToSkiaColorType(color_type.obj()); 641 SkColorType pref_color_type = gfx::ConvertToSkiaColorType(color_type);
642 if (!view || pref_color_type == kUnknown_SkColorType) { 642 if (!view || pref_color_type == kUnknown_SkColorType) {
643 result_callback.Run(SkBitmap(), READBACK_FAILED); 643 result_callback.Run(SkBitmap(), READBACK_FAILED);
644 return; 644 return;
645 } 645 }
646 if (!view->IsSurfaceAvailableForCopy()) { 646 if (!view->IsSurfaceAvailableForCopy()) {
647 result_callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE); 647 result_callback.Run(SkBitmap(), READBACK_SURFACE_UNAVAILABLE);
648 return; 648 return;
649 } 649 }
650 view->GetScaledContentBitmap(scale, 650 view->GetScaledContentBitmap(scale,
651 pref_color_type, 651 pref_color_type,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 Java_WebContentsImpl_addToBitmapList(env, jbitmaps, jbitmap); 714 Java_WebContentsImpl_addToBitmapList(env, jbitmaps, jbitmap);
715 } 715 }
716 for (const gfx::Size& size : sizes) { 716 for (const gfx::Size& size : sizes) {
717 Java_WebContentsImpl_createSizeAndAddToList(env, jsizes, size.width(), 717 Java_WebContentsImpl_createSizeAndAddToList(env, jsizes, size.width(),
718 size.height()); 718 size.height());
719 } 719 }
720 Java_WebContentsImpl_onDownloadImageFinished( 720 Java_WebContentsImpl_onDownloadImageFinished(
721 env, *obj, *callback, id, http_status_code, jurl, jbitmaps, jsizes); 721 env, *obj, *callback, id, http_status_code, jurl, jbitmaps, jsizes);
722 } 722 }
723 } // namespace content 723 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698