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

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

Issue 173023005: Adds support for capturing a sub rect of the compositing surface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 684 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
685 if (obj.is_null()) 685 if (obj.is_null())
686 return; 686 return;
687 Java_ContentViewCore_showPastePopup(env, obj.obj(), 687 Java_ContentViewCore_showPastePopup(env, obj.obj(),
688 static_cast<jint>(x_dip), 688 static_cast<jint>(x_dip),
689 static_cast<jint>(y_dip)); 689 static_cast<jint>(y_dip));
690 } 690 }
691 691
692 void ContentViewCoreImpl::GetScaledContentBitmap( 692 void ContentViewCoreImpl::GetScaledContentBitmap(
693 float scale, 693 float scale,
694 gfx::Rect src_subrect,
694 gfx::Size* out_size, 695 gfx::Size* out_size,
695 const base::Callback<void(bool, const SkBitmap&)>& result_callback) { 696 const base::Callback<void(bool, const SkBitmap&)>& result_callback) {
696 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); 697 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
697 if (!view) { 698 if (!view) {
698 result_callback.Run(false, SkBitmap()); 699 result_callback.Run(false, SkBitmap());
699 return; 700 return;
700 } 701 }
701 702
702 view->GetScaledContentBitmap(scale, out_size, result_callback); 703 view->GetScaledContentBitmap(scale, src_subrect, out_size, result_callback);
703 } 704 }
704 705
705 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { 706 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) {
706 JNIEnv* env = AttachCurrentThread(); 707 JNIEnv* env = AttachCurrentThread();
707 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 708 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
708 if (j_obj.is_null()) 709 if (j_obj.is_null())
709 return; 710 return;
710 ScopedJavaLocalRef<jstring> jcontent_url = 711 ScopedJavaLocalRef<jstring> jcontent_url =
711 ConvertUTF8ToJavaString(env, content_url.spec()); 712 ConvertUTF8ToJavaString(env, content_url.spec());
712 Java_ContentViewCore_startContentIntent(env, 713 Java_ContentViewCore_startContentIntent(env,
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 reinterpret_cast<ui::ViewAndroid*>(view_android), 1870 reinterpret_cast<ui::ViewAndroid*>(view_android),
1870 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1871 reinterpret_cast<ui::WindowAndroid*>(window_android));
1871 return reinterpret_cast<intptr_t>(view); 1872 return reinterpret_cast<intptr_t>(view);
1872 } 1873 }
1873 1874
1874 bool RegisterContentViewCore(JNIEnv* env) { 1875 bool RegisterContentViewCore(JNIEnv* env) {
1875 return RegisterNativesImpl(env); 1876 return RegisterNativesImpl(env);
1876 } 1877 }
1877 1878
1878 } // namespace content 1879 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698