| OLD | NEW |
| 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_video_view.h" | 5 #include "content/browser/android/content_video_view.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "content/browser/media/android/browser_media_player_manager.h" | 9 #include "content/browser/media/android/browser_media_player_manager.h" |
| 10 #include "content/common/android/surface_texture_peer.h" | 10 #include "content/common/android/surface_texture_peer.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 ContentVideoView::ContentVideoView( | 42 ContentVideoView::ContentVideoView( |
| 43 const ScopedJavaLocalRef<jobject>& context, | 43 const ScopedJavaLocalRef<jobject>& context, |
| 44 const ScopedJavaLocalRef<jobject>& client, | 44 const ScopedJavaLocalRef<jobject>& client, |
| 45 BrowserMediaPlayerManager* manager) | 45 BrowserMediaPlayerManager* manager) |
| 46 : manager_(manager) { | 46 : manager_(manager) { |
| 47 DCHECK(!g_content_video_view); | 47 DCHECK(!g_content_video_view); |
| 48 JNIEnv *env = AttachCurrentThread(); | 48 JNIEnv *env = AttachCurrentThread(); |
| 49 j_content_video_view_ = JavaObjectWeakGlobalRef(env, | 49 j_content_video_view_ = JavaObjectWeakGlobalRef(env, |
| 50 Java_ContentVideoView_createContentVideoView(env, context.obj(), | 50 Java_ContentVideoView_createContentVideoView(env, context.obj(), |
| 51 reinterpret_cast<int>(this), client.obj()).obj()); | 51 reinterpret_cast<intptr_t>(this), client.obj()).obj()); |
| 52 g_content_video_view = this; | 52 g_content_video_view = this; |
| 53 } | 53 } |
| 54 | 54 |
| 55 ContentVideoView::~ContentVideoView() { | 55 ContentVideoView::~ContentVideoView() { |
| 56 DCHECK(g_content_video_view); | 56 DCHECK(g_content_video_view); |
| 57 DestroyContentVideoView(true); | 57 DestroyContentVideoView(true); |
| 58 g_content_video_view = NULL; | 58 g_content_video_view = NULL; |
| 59 } | 59 } |
| 60 | 60 |
| 61 void ContentVideoView::OpenVideo() { | 61 void ContentVideoView::OpenVideo() { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 void ContentVideoView::DestroyContentVideoView(bool native_view_destroyed) { | 175 void ContentVideoView::DestroyContentVideoView(bool native_view_destroyed) { |
| 176 JNIEnv *env = AttachCurrentThread(); | 176 JNIEnv *env = AttachCurrentThread(); |
| 177 ScopedJavaLocalRef<jobject> content_video_view = GetJavaObject(env); | 177 ScopedJavaLocalRef<jobject> content_video_view = GetJavaObject(env); |
| 178 if (!content_video_view.is_null()) { | 178 if (!content_video_view.is_null()) { |
| 179 Java_ContentVideoView_destroyContentVideoView(env, | 179 Java_ContentVideoView_destroyContentVideoView(env, |
| 180 content_video_view.obj(), native_view_destroyed); | 180 content_video_view.obj(), native_view_destroyed); |
| 181 j_content_video_view_.reset(); | 181 j_content_video_view_.reset(); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 } // namespace content | 184 } // namespace content |
| OLD | NEW |