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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 262543002: android: add ThumbnailCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@codec
Patch Set: separate into multiple files Created 6 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
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 "content/browser/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.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/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 623 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
624 if (obj.is_null()) 624 if (obj.is_null())
625 return; 625 return;
626 Java_ContentViewCore_showPastePopup(env, obj.obj(), 626 Java_ContentViewCore_showPastePopup(env, obj.obj(),
627 static_cast<jint>(x_dip), 627 static_cast<jint>(x_dip),
628 static_cast<jint>(y_dip)); 628 static_cast<jint>(y_dip));
629 } 629 }
630 630
631 void ContentViewCoreImpl::GetScaledContentBitmap( 631 void ContentViewCoreImpl::GetScaledContentBitmap(
632 float scale, 632 float scale,
633 jobject jbitmap_config, 633 SkBitmap::Config bitmap_config,
634 gfx::Rect src_subrect, 634 gfx::Rect src_subrect,
635 const base::Callback<void(bool, const SkBitmap&)>& result_callback) { 635 const base::Callback<void(bool, const SkBitmap&)>& result_callback) {
636 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); 636 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
637 if (!view) { 637 if (!view) {
638 result_callback.Run(false, SkBitmap()); 638 result_callback.Run(false, SkBitmap());
639 return; 639 return;
640 } 640 }
641 SkBitmap::Config skbitmap_format = gfx::ConvertToSkiaConfig(jbitmap_config); 641 view->GetScaledContentBitmap(scale, bitmap_config, src_subrect,
642 view->GetScaledContentBitmap(scale, skbitmap_format, src_subrect,
643 result_callback); 642 result_callback);
644 } 643 }
645 644
646 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { 645 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) {
647 JNIEnv* env = AttachCurrentThread(); 646 JNIEnv* env = AttachCurrentThread();
648 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 647 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
649 if (j_obj.is_null()) 648 if (j_obj.is_null())
650 return; 649 return;
651 ScopedJavaLocalRef<jstring> jcontent_url = 650 ScopedJavaLocalRef<jstring> jcontent_url =
652 ConvertUTF8ToJavaString(env, content_url.spec()); 651 ConvertUTF8ToJavaString(env, content_url.spec());
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
1632 reinterpret_cast<ui::WindowAndroid*>(window_android), 1631 reinterpret_cast<ui::WindowAndroid*>(window_android),
1633 retained_objects_set); 1632 retained_objects_set);
1634 return reinterpret_cast<intptr_t>(view); 1633 return reinterpret_cast<intptr_t>(view);
1635 } 1634 }
1636 1635
1637 bool RegisterContentViewCore(JNIEnv* env) { 1636 bool RegisterContentViewCore(JNIEnv* env) {
1638 return RegisterNativesImpl(env); 1637 return RegisterNativesImpl(env);
1639 } 1638 }
1640 1639
1641 } // namespace content 1640 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698