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

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

Issue 13688004: Location/size change notification when external rendering is enabled (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Yuncheol's comments. Created 7 years, 8 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 (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"
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 JNIEnv* env = AttachCurrentThread(); 595 JNIEnv* env = AttachCurrentThread();
596 596
597 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 597 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
598 if (obj.is_null()) 598 if (obj.is_null())
599 return; 599 return;
600 600
601 Java_ContentViewCore_requestExternalVideoSurface( 601 Java_ContentViewCore_requestExternalVideoSurface(
602 env, obj.obj(), static_cast<jint>(player_id)); 602 env, obj.obj(), static_cast<jint>(player_id));
603 } 603 }
604 604
605 void ContentViewCoreImpl::NotifyGeometryChange(int player_id,
palmer 2013/04/12 18:51:21 Should this be guarded with OS_ANDROID, too?
wonsik 2013/04/15 02:44:16 This whole file is only included in Android build,
606 const gfx::RectF& rect) {
607 JNIEnv* env = AttachCurrentThread();
608
609 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
610 if (obj.is_null())
611 return;
612
613 Java_ContentViewCore_notifyGeometryChange(env,
614 obj.obj(),
615 static_cast<jint>(player_id),
616 static_cast<jfloat>(rect.x()),
617 static_cast<jfloat>(rect.y()),
618 static_cast<jfloat>(rect.width()),
619 static_cast<jfloat>(rect.height()));
620 }
621
605 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { 622 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const {
606 JNIEnv* env = AttachCurrentThread(); 623 JNIEnv* env = AttachCurrentThread();
607 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 624 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
608 if (j_obj.is_null()) 625 if (j_obj.is_null())
609 return gfx::Size(); 626 return gfx::Size();
610 return gfx::Size( 627 return gfx::Size(
611 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj.obj()), 628 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj.obj()),
612 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj.obj())); 629 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj.obj()));
613 } 630 }
614 631
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 jobject obj) { 1233 jobject obj) {
1217 bool had_pending_frame = renderer_frame_pending_; 1234 bool had_pending_frame = renderer_frame_pending_;
1218 renderer_frame_pending_ = false; 1235 renderer_frame_pending_ = false;
1219 return had_pending_frame; 1236 return had_pending_frame;
1220 } 1237 }
1221 1238
1222 void ContentViewCoreImpl::AttachExternalVideoSurface(JNIEnv* env, 1239 void ContentViewCoreImpl::AttachExternalVideoSurface(JNIEnv* env,
1223 jobject obj, 1240 jobject obj,
1224 jint player_id, 1241 jint player_id,
1225 jobject jsurface) { 1242 jobject jsurface) {
1243 #if defined(GOOGLE_TV)
1226 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( 1244 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
1227 web_contents_->GetRenderViewHost()); 1245 web_contents_->GetRenderViewHost());
1228 if (rvhi && rvhi->media_player_manager()) { 1246 if (rvhi && rvhi->media_player_manager()) {
1229 rvhi->media_player_manager()->AttachExternalVideoSurface( 1247 rvhi->media_player_manager()->AttachExternalVideoSurface(
1230 static_cast<int>(player_id), jsurface); 1248 static_cast<int>(player_id), jsurface);
1231 } 1249 }
1250 #endif
1232 } 1251 }
1233 1252
1234 void ContentViewCoreImpl::DetachExternalVideoSurface(JNIEnv* env, 1253 void ContentViewCoreImpl::DetachExternalVideoSurface(JNIEnv* env,
1235 jobject obj, 1254 jobject obj,
1236 jint player_id) { 1255 jint player_id) {
1256 #if defined(GOOGLE_TV)
1237 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( 1257 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
1238 web_contents_->GetRenderViewHost()); 1258 web_contents_->GetRenderViewHost());
1239 if (rvhi && rvhi->media_player_manager()) { 1259 if (rvhi && rvhi->media_player_manager()) {
1240 rvhi->media_player_manager()->DetachExternalVideoSurface( 1260 rvhi->media_player_manager()->DetachExternalVideoSurface(
1241 static_cast<int>(player_id)); 1261 static_cast<int>(player_id));
1242 } 1262 }
1263 #endif
1243 } 1264 }
1244 1265
1245 jboolean ContentViewCoreImpl::IsRenderWidgetHostViewReady(JNIEnv* env, 1266 jboolean ContentViewCoreImpl::IsRenderWidgetHostViewReady(JNIEnv* env,
1246 jobject obj) { 1267 jobject obj) {
1247 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid(); 1268 RenderWidgetHostViewAndroid* view = GetRenderWidgetHostViewAndroid();
1248 return view && view->HasValidFrame(); 1269 return view && view->HasValidFrame();
1249 } 1270 }
1250 1271
1251 void ContentViewCoreImpl::ExitFullscreen(JNIEnv* env, jobject obj) { 1272 void ContentViewCoreImpl::ExitFullscreen(JNIEnv* env, jobject obj) {
1252 RenderViewHost* host = web_contents_->GetRenderViewHost(); 1273 RenderViewHost* host = web_contents_->GetRenderViewHost();
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 reinterpret_cast<WebContents*>(native_web_contents), 1500 reinterpret_cast<WebContents*>(native_web_contents),
1480 reinterpret_cast<ui::WindowAndroid*>(native_window)); 1501 reinterpret_cast<ui::WindowAndroid*>(native_window));
1481 return reinterpret_cast<jint>(view); 1502 return reinterpret_cast<jint>(view);
1482 } 1503 }
1483 1504
1484 bool RegisterContentViewCore(JNIEnv* env) { 1505 bool RegisterContentViewCore(JNIEnv* env) {
1485 return RegisterNativesImpl(env); 1506 return RegisterNativesImpl(env);
1486 } 1507 }
1487 1508
1488 } // namespace content 1509 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698