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

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

Issue 157033007: API to Convert Java Bitmap Config to SkBitmap::Config (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Auto generation of Bitmap Format enum in Java and C++. Created 6 years, 10 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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 if (obj.is_null()) 681 if (obj.is_null())
682 return; 682 return;
683 Java_ContentViewCore_showPastePopup(env, obj.obj(), 683 Java_ContentViewCore_showPastePopup(env, obj.obj(),
684 static_cast<jint>(x_dip), 684 static_cast<jint>(x_dip),
685 static_cast<jint>(y_dip)); 685 static_cast<jint>(y_dip));
686 } 686 }
687 687
688 void ContentViewCoreImpl::GetScaledContentBitmap( 688 void ContentViewCoreImpl::GetScaledContentBitmap(
689 float scale, 689 float scale,
690 gfx::Size* out_size, 690 gfx::Size* out_size,
691 jobject jbitmap_config,
691 const base::Callback<void(bool, const SkBitmap&)>& result_callback) { 692 const base::Callback<void(bool, const SkBitmap&)>& result_callback) {
692 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); 693 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
693 if (!view) { 694 if (!view) {
694 result_callback.Run(false, SkBitmap()); 695 result_callback.Run(false, SkBitmap());
695 return; 696 return;
696 } 697 }
697 698 SkBitmap::Config skbitmap_format = gfx::ConvertToSkiaConfig(jbitmap_config);
698 view->GetScaledContentBitmap(scale, out_size, result_callback); 699 view->GetScaledContentBitmap(scale, out_size, skbitmap_format,
700 result_callback);
699 } 701 }
700 702
701 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { 703 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) {
702 JNIEnv* env = AttachCurrentThread(); 704 JNIEnv* env = AttachCurrentThread();
703 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 705 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
704 if (j_obj.is_null()) 706 if (j_obj.is_null())
705 return; 707 return;
706 ScopedJavaLocalRef<jstring> jcontent_url = 708 ScopedJavaLocalRef<jstring> jcontent_url =
707 ConvertUTF8ToJavaString(env, content_url.spec()); 709 ConvertUTF8ToJavaString(env, content_url.spec());
708 Java_ContentViewCore_startContentIntent(env, 710 Java_ContentViewCore_startContentIntent(env,
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 reinterpret_cast<ui::ViewAndroid*>(view_android), 1865 reinterpret_cast<ui::ViewAndroid*>(view_android),
1864 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1866 reinterpret_cast<ui::WindowAndroid*>(window_android));
1865 return reinterpret_cast<intptr_t>(view); 1867 return reinterpret_cast<intptr_t>(view);
1866 } 1868 }
1867 1869
1868 bool RegisterContentViewCore(JNIEnv* env) { 1870 bool RegisterContentViewCore(JNIEnv* env) {
1869 return RegisterNativesImpl(env); 1871 return RegisterNativesImpl(env);
1870 } 1872 }
1871 1873
1872 } // namespace content 1874 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698