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 "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "content/browser/android/content_view_core_impl.h" | |
12 #include "content/browser/media/android/browser_media_player_manager.h" | 11 #include "content/browser/media/android/browser_media_player_manager.h" |
13 #include "content/browser/power_save_blocker_impl.h" | 12 #include "content/browser/power_save_blocker_impl.h" |
14 #include "content/common/android/surface_texture_peer.h" | 13 #include "content/common/android/surface_texture_peer.h" |
15 #include "content/public/browser/user_metrics.h" | 14 #include "content/public/browser/user_metrics.h" |
16 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
17 #include "jni/ContentVideoView_jni.h" | 16 #include "jni/ContentVideoView_jni.h" |
18 | 17 |
| 18 #if !defined(USE_AURA) |
| 19 #include "content/browser/android/content_view_core_impl.h" |
| 20 #endif |
| 21 |
19 using base::android::AttachCurrentThread; | 22 using base::android::AttachCurrentThread; |
20 using base::android::CheckException; | 23 using base::android::CheckException; |
21 using base::android::ScopedJavaGlobalRef; | 24 using base::android::ScopedJavaGlobalRef; |
22 using base::UserMetricsAction; | 25 using base::UserMetricsAction; |
23 using content::RecordAction; | 26 using content::RecordAction; |
24 | 27 |
25 namespace content { | 28 namespace content { |
26 | 29 |
27 namespace { | 30 namespace { |
28 // There can only be one content video view at a time, this holds onto that | 31 // There can only be one content video view at a time, this holds onto that |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 FROM_HERE, | 194 FROM_HERE, |
192 base::Bind(&ContentVideoView::UpdateMediaMetadata, | 195 base::Bind(&ContentVideoView::UpdateMediaMetadata, |
193 weak_factory_.GetWeakPtr())); | 196 weak_factory_.GetWeakPtr())); |
194 } | 197 } |
195 | 198 |
196 ScopedJavaLocalRef<jobject> ContentVideoView::GetJavaObject(JNIEnv* env) { | 199 ScopedJavaLocalRef<jobject> ContentVideoView::GetJavaObject(JNIEnv* env) { |
197 return j_content_video_view_.get(env); | 200 return j_content_video_view_.get(env); |
198 } | 201 } |
199 | 202 |
200 JavaObjectWeakGlobalRef ContentVideoView::CreateJavaObject() { | 203 JavaObjectWeakGlobalRef ContentVideoView::CreateJavaObject() { |
| 204 |
| 205 JNIEnv* env = AttachCurrentThread(); |
| 206 base::android::ScopedJavaLocalRef<jobject> j_content_view_core; |
| 207 |
| 208 // TODO(mfomitchev): Support fullscreen video underlay on Android Aura. |
| 209 // crbug.com/548024 |
| 210 #if !defined(USE_AURA) |
201 ContentViewCore* content_view_core = manager_->GetContentViewCore(); | 211 ContentViewCore* content_view_core = manager_->GetContentViewCore(); |
202 JNIEnv* env = AttachCurrentThread(); | 212 j_content_view_core = content_view_core->GetJavaObject(); |
| 213 #endif |
203 | 214 |
204 base::android::ScopedJavaLocalRef<jobject> j_content_view_core = | |
205 content_view_core->GetJavaObject(); | |
206 if (j_content_view_core.is_null()) | 215 if (j_content_view_core.is_null()) |
207 return JavaObjectWeakGlobalRef(env, nullptr); | 216 return JavaObjectWeakGlobalRef(env, nullptr); |
208 | 217 |
209 return JavaObjectWeakGlobalRef( | 218 return JavaObjectWeakGlobalRef( |
210 env, | 219 env, |
211 Java_ContentVideoView_createContentVideoView( | 220 Java_ContentVideoView_createContentVideoView( |
212 env, | 221 env, |
213 j_content_view_core.obj(), | 222 j_content_view_core.obj(), |
214 reinterpret_cast<intptr_t>(this)).obj()); | 223 reinterpret_cast<intptr_t>(this)).obj()); |
215 } | 224 } |
216 } // namespace content | 225 } // namespace content |
OLD | NEW |