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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "content/browser/android/content_view_core_impl.h" |
10 #include "content/browser/media/android/browser_media_player_manager.h" | 11 #include "content/browser/media/android/browser_media_player_manager.h" |
11 #include "content/public/browser/user_metrics.h" | 12 #include "content/public/browser/user_metrics.h" |
12 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
13 #include "jni/ContentVideoView_jni.h" | 14 #include "jni/ContentVideoView_jni.h" |
14 | 15 |
15 #if !defined(USE_AURA) | |
16 #include "content/browser/android/content_view_core_impl.h" | |
17 #endif | |
18 | |
19 using base::android::AttachCurrentThread; | 16 using base::android::AttachCurrentThread; |
20 using base::android::CheckException; | 17 using base::android::CheckException; |
21 using base::android::ScopedJavaGlobalRef; | 18 using base::android::ScopedJavaGlobalRef; |
22 using base::UserMetricsAction; | 19 using base::UserMetricsAction; |
23 using content::RecordAction; | 20 using content::RecordAction; |
24 | 21 |
25 namespace content { | 22 namespace content { |
26 | 23 |
27 namespace { | 24 namespace { |
28 // There can only be one content video view at a time, this holds onto that | 25 // There can only be one content video view at a time, this holds onto that |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 "MobileFullscreenVideo.LandscapeDuration", | 152 "MobileFullscreenVideo.LandscapeDuration", |
156 playback_duration_in_milliseconds_before_orientation_change); | 153 playback_duration_in_milliseconds_before_orientation_change); |
157 UMA_HISTOGRAM_COUNTS( | 154 UMA_HISTOGRAM_COUNTS( |
158 "MobileFullscreenVideo.LandscapeRotation", orientation_changed); | 155 "MobileFullscreenVideo.LandscapeRotation", orientation_changed); |
159 } | 156 } |
160 } | 157 } |
161 | 158 |
162 JavaObjectWeakGlobalRef ContentVideoView::CreateJavaObject( | 159 JavaObjectWeakGlobalRef ContentVideoView::CreateJavaObject( |
163 ContentViewCore* content_view_core) { | 160 ContentViewCore* content_view_core) { |
164 JNIEnv* env = AttachCurrentThread(); | 161 JNIEnv* env = AttachCurrentThread(); |
165 base::android::ScopedJavaLocalRef<jobject> j_content_view_core; | 162 base::android::ScopedJavaLocalRef<jobject> j_content_view_core = |
166 | 163 content_view_core->GetJavaObject(); |
167 #if !defined(USE_AURA) | |
168 j_content_view_core = content_view_core->GetJavaObject(); | |
169 #endif | |
170 | |
171 if (j_content_view_core.is_null()) | 164 if (j_content_view_core.is_null()) |
172 return JavaObjectWeakGlobalRef(env, nullptr); | 165 return JavaObjectWeakGlobalRef(env, nullptr); |
173 | 166 |
174 return JavaObjectWeakGlobalRef( | 167 return JavaObjectWeakGlobalRef( |
175 env, | 168 env, |
176 Java_ContentVideoView_createContentVideoView( | 169 Java_ContentVideoView_createContentVideoView( |
177 env, | 170 env, |
178 j_content_view_core.obj(), | 171 j_content_view_core.obj(), |
179 reinterpret_cast<intptr_t>(this)).obj()); | 172 reinterpret_cast<intptr_t>(this)).obj()); |
180 } | 173 } |
181 } // namespace content | 174 } // namespace content |
OLD | NEW |