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

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

Issue 13669003: Refactoring ContentVideoViewContextDelegate.java (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: using weak reference in native side 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 | 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"
(...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 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContentVideoViewClient() {
606 JNIEnv* env = AttachCurrentThread();
607
608 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
609 if (obj.is_null())
610 return ScopedJavaLocalRef<jobject>();
611
612 return Java_ContentViewCore_getContentVideoViewClient(env, obj.obj());
613 }
614
615 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() {
616 JNIEnv* env = AttachCurrentThread();
617
618 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
619 if (obj.is_null())
620 return ScopedJavaLocalRef<jobject>();
621
622 return Java_ContentViewCore_getContext(env, obj.obj());
623 }
624
605 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { 625 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const {
606 JNIEnv* env = AttachCurrentThread(); 626 JNIEnv* env = AttachCurrentThread();
607 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); 627 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env);
608 if (j_obj.is_null()) 628 if (j_obj.is_null())
609 return gfx::Size(); 629 return gfx::Size();
610 return gfx::Size( 630 return gfx::Size(
611 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj.obj()), 631 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj.obj()),
612 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj.obj())); 632 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj.obj()));
613 } 633 }
614 634
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 reinterpret_cast<WebContents*>(native_web_contents), 1499 reinterpret_cast<WebContents*>(native_web_contents),
1480 reinterpret_cast<ui::WindowAndroid*>(native_window)); 1500 reinterpret_cast<ui::WindowAndroid*>(native_window));
1481 return reinterpret_cast<jint>(view); 1501 return reinterpret_cast<jint>(view);
1482 } 1502 }
1483 1503
1484 bool RegisterContentViewCore(JNIEnv* env) { 1504 bool RegisterContentViewCore(JNIEnv* env) {
1485 return RegisterNativesImpl(env); 1505 return RegisterNativesImpl(env);
1486 } 1506 }
1487 1507
1488 } // namespace content 1508 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698