| 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 28 matching lines...) Expand all Loading... |
| 39 return g_content_video_view; | 39 return g_content_video_view; |
| 40 } | 40 } |
| 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 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 50 Java_ContentVideoView_createContentVideoView(env, context.obj(), | 50 switches::kEnableOverlayFullscreenVideoSubtitle)) { |
| 51 reinterpret_cast<intptr_t>(this), client.obj()).obj()); | 51 j_content_video_view_ = JavaObjectWeakGlobalRef(env, |
| 52 Java_ContentVideoView_createContentVideoView(env, context.obj(), |
| 53 reinterpret_cast<intptr_t>(this), client.obj()).obj()); |
| 54 } else { |
| 55 j_content_video_view_ = JavaObjectWeakGlobalRef(env, |
| 56 Java_ContentVideoView_createContentVideoViewLegacy(env, context.obj(), |
| 57 reinterpret_cast<intptr_t>(this), client.obj()).obj()); |
| 58 } |
| 52 g_content_video_view = this; | 59 g_content_video_view = this; |
| 53 } | 60 } |
| 54 | 61 |
| 55 ContentVideoView::~ContentVideoView() { | 62 ContentVideoView::~ContentVideoView() { |
| 56 DCHECK(g_content_video_view); | 63 DCHECK(g_content_video_view); |
| 57 DestroyContentVideoView(true); | 64 DestroyContentVideoView(true); |
| 58 g_content_video_view = NULL; | 65 g_content_video_view = NULL; |
| 59 } | 66 } |
| 60 | 67 |
| 61 void ContentVideoView::OpenVideo() { | 68 void ContentVideoView::OpenVideo() { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 void ContentVideoView::DestroyContentVideoView(bool native_view_destroyed) { | 182 void ContentVideoView::DestroyContentVideoView(bool native_view_destroyed) { |
| 176 JNIEnv *env = AttachCurrentThread(); | 183 JNIEnv *env = AttachCurrentThread(); |
| 177 ScopedJavaLocalRef<jobject> content_video_view = GetJavaObject(env); | 184 ScopedJavaLocalRef<jobject> content_video_view = GetJavaObject(env); |
| 178 if (!content_video_view.is_null()) { | 185 if (!content_video_view.is_null()) { |
| 179 Java_ContentVideoView_destroyContentVideoView(env, | 186 Java_ContentVideoView_destroyContentVideoView(env, |
| 180 content_video_view.obj(), native_view_destroyed); | 187 content_video_view.obj(), native_view_destroyed); |
| 181 j_content_video_view_.reset(); | 188 j_content_video_view_.reset(); |
| 182 } | 189 } |
| 183 } | 190 } |
| 184 } // namespace content | 191 } // namespace content |
| OLD | NEW |