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

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

Issue 11234008: Enable texture readback support for Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "content/browser/android/load_url_params.h" 14 #include "content/browser/android/load_url_params.h"
15 #include "content/browser/android/touch_point.h" 15 #include "content/browser/android/touch_point.h"
16 #include "content/browser/renderer_host/java/java_bound_object.h" 16 #include "content/browser/renderer_host/java/java_bound_object.h"
17 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h" 17 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h"
18 #include "content/browser/renderer_host/compositor_impl_android.h"
18 #include "content/browser/renderer_host/render_view_host_impl.h" 19 #include "content/browser/renderer_host/render_view_host_impl.h"
19 #include "content/browser/renderer_host/render_widget_host_impl.h" 20 #include "content/browser/renderer_host/render_widget_host_impl.h"
20 #include "content/browser/renderer_host/render_widget_host_view_android.h" 21 #include "content/browser/renderer_host/render_widget_host_view_android.h"
21 #include "content/browser/ssl/ssl_host_state.h" 22 #include "content/browser/ssl/ssl_host_state.h"
22 #include "content/browser/web_contents/navigation_controller_impl.h" 23 #include "content/browser/web_contents/navigation_controller_impl.h"
23 #include "content/browser/web_contents/navigation_entry_impl.h" 24 #include "content/browser/web_contents/navigation_entry_impl.h"
24 #include "content/browser/web_contents/web_contents_view_android.h" 25 #include "content/browser/web_contents/web_contents_view_android.h"
25 #include "content/common/android/device_info.h" 26 #include "content/common/android/device_info.h"
26 #include "content/common/view_messages.h" 27 #include "content/common/view_messages.h"
27 #include "content/public/browser/browser_context.h" 28 #include "content/public/browser/browser_context.h"
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 437
437 void ContentViewCoreImpl::ShowPastePopup(int x, int y) { 438 void ContentViewCoreImpl::ShowPastePopup(int x, int y) {
438 JNIEnv* env = AttachCurrentThread(); 439 JNIEnv* env = AttachCurrentThread();
439 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 440 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
440 if (obj.is_null()) 441 if (obj.is_null())
441 return; 442 return;
442 Java_ContentViewCore_showPastePopup(env, obj.obj(), static_cast<jint>(x), 443 Java_ContentViewCore_showPastePopup(env, obj.obj(), static_cast<jint>(x),
443 static_cast<jint>(y)); 444 static_cast<jint>(y));
444 } 445 }
445 446
447 unsigned int ContentViewCoreImpl::GetScaledContentTexture(
448 const gfx::Size& size) {
449 if (!CompositorImpl::IsInitialized())
no sievers 2012/10/20 00:42:36 Can you move this check to RWHVA? Same below.
David Trainor- moved to gerrit 2012/10/22 17:56:16 Done.
450 return 0;
451
452 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
453 if (!view)
454 return 0;
455
456 return view->GetScaledContentTexture(size);
457 }
458
446 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) { 459 void ContentViewCoreImpl::StartContentIntent(const GURL& content_url) {
447 JNIEnv* env = AttachCurrentThread(); 460 JNIEnv* env = AttachCurrentThread();
448 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 461 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
449 if (j_obj.is_null()) 462 if (j_obj.is_null())
450 return; 463 return;
451 ScopedJavaLocalRef<jstring> jcontent_url = 464 ScopedJavaLocalRef<jstring> jcontent_url =
452 ConvertUTF8ToJavaString(env, content_url.spec()); 465 ConvertUTF8ToJavaString(env, content_url.spec());
453 Java_ContentViewCore_startContentIntent(env, 466 Java_ContentViewCore_startContentIntent(env,
454 j_obj.obj(), 467 j_obj.obj(),
455 jcontent_url.obj()); 468 jcontent_url.obj());
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 return; 883 return;
871 884
872 RenderWidgetHostImpl* host = RenderWidgetHostImpl::From( 885 RenderWidgetHostImpl* host = RenderWidgetHostImpl::From(
873 view->GetRenderWidgetHost()); 886 view->GetRenderWidgetHost());
874 887
875 host->UpdateVSyncParameters( 888 host->UpdateVSyncParameters(
876 base::TimeTicks::FromInternalValue(timebase_micros), 889 base::TimeTicks::FromInternalValue(timebase_micros),
877 base::TimeDelta::FromMicroseconds(interval_micros)); 890 base::TimeDelta::FromMicroseconds(interval_micros));
878 } 891 }
879 892
893 jboolean ContentViewCoreImpl::PopulateBitmapFromCompositor(JNIEnv* env,
894 jobject obj,
895 jobject jbitmap) {
896 if (!CompositorImpl::IsInitialized())
897 return false;
898
899 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
900 if (!view)
901 return false;
902
903 return view->PopulateBitmapWithContents(jbitmap);
904 }
905
880 void ContentViewCoreImpl::ScrollFocusedEditableNodeIntoView(JNIEnv* env, 906 void ContentViewCoreImpl::ScrollFocusedEditableNodeIntoView(JNIEnv* env,
881 jobject obj) { 907 jobject obj) {
882 RenderViewHost* host = web_contents_->GetRenderViewHost(); 908 RenderViewHost* host = web_contents_->GetRenderViewHost();
883 host->Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(host->GetRoutingID(), 909 host->Send(new ViewMsg_ScrollFocusedEditableNodeIntoRect(host->GetRoutingID(),
884 gfx::Rect())); 910 gfx::Rect()));
885 } 911 }
886 912
887 int ContentViewCoreImpl::GetNavigationHistory(JNIEnv* env, 913 int ContentViewCoreImpl::GetNavigationHistory(JNIEnv* env,
888 jobject obj, 914 jobject obj,
889 jobject context) { 915 jobject context) {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { 1062 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) {
1037 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; 1063 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!";
1038 return false; 1064 return false;
1039 } 1065 }
1040 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); 1066 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I");
1041 1067
1042 return RegisterNativesImpl(env) >= 0; 1068 return RegisterNativesImpl(env) >= 0;
1043 } 1069 }
1044 1070
1045 } // namespace content 1071 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698