OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "cc/layers/layer.h" | 17 #include "cc/layers/layer.h" |
18 #include "cc/output/begin_frame_args.h" | 18 #include "cc/output/begin_frame_args.h" |
| 19 #include "content/browser/android/content_video_view.h" |
19 #include "content/browser/android/interstitial_page_delegate_android.h" | 20 #include "content/browser/android/interstitial_page_delegate_android.h" |
20 #include "content/browser/android/load_url_params.h" | 21 #include "content/browser/android/load_url_params.h" |
21 #include "content/browser/android/touch_point.h" | 22 #include "content/browser/android/touch_point.h" |
22 #include "content/browser/frame_host/interstitial_page_impl.h" | 23 #include "content/browser/frame_host/interstitial_page_impl.h" |
23 #include "content/browser/frame_host/navigation_controller_impl.h" | 24 #include "content/browser/frame_host/navigation_controller_impl.h" |
24 #include "content/browser/frame_host/navigation_entry_impl.h" | 25 #include "content/browser/frame_host/navigation_entry_impl.h" |
25 #include "content/browser/media/android/browser_media_player_manager.h" | 26 #include "content/browser/media/android/browser_media_player_manager.h" |
26 #include "content/browser/renderer_host/compositor_impl_android.h" | 27 #include "content/browser/renderer_host/compositor_impl_android.h" |
27 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" | 28 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" |
28 #include "content/browser/renderer_host/java/java_bound_object.h" | 29 #include "content/browser/renderer_host/java/java_bound_object.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 void ContentViewCoreImpl::OnHide(JNIEnv* env, jobject obj) { | 324 void ContentViewCoreImpl::OnHide(JNIEnv* env, jobject obj) { |
324 Hide(); | 325 Hide(); |
325 } | 326 } |
326 | 327 |
327 void ContentViewCoreImpl::OnShow(JNIEnv* env, jobject obj) { | 328 void ContentViewCoreImpl::OnShow(JNIEnv* env, jobject obj) { |
328 Show(); | 329 Show(); |
329 } | 330 } |
330 | 331 |
331 void ContentViewCoreImpl::Show() { | 332 void ContentViewCoreImpl::Show() { |
332 GetWebContents()->WasShown(); | 333 GetWebContents()->WasShown(); |
| 334 ResumeVideo(); |
333 } | 335 } |
334 | 336 |
335 void ContentViewCoreImpl::Hide() { | 337 void ContentViewCoreImpl::Hide() { |
336 GetWebContents()->WasHidden(); | 338 GetWebContents()->WasHidden(); |
337 PauseVideo(); | 339 PauseVideo(); |
338 } | 340 } |
339 | 341 |
340 void ContentViewCoreImpl::PauseVideo() { | 342 void ContentViewCoreImpl::PauseVideo() { |
341 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 343 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
342 if (host) | 344 if (host) |
343 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID())); | 345 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID())); |
| 346 if (ContentVideoView::GetInstance()) |
| 347 ContentVideoView::GetInstance()->SuspendFullscreen(); |
| 348 } |
| 349 |
| 350 void ContentViewCoreImpl::ResumeVideo() { |
| 351 if (ContentVideoView::GetInstance()) |
| 352 ContentVideoView::GetInstance()->ResumeFullscreenIfSuspended(); |
344 } | 353 } |
345 | 354 |
346 void ContentViewCoreImpl::OnTabCrashed() { | 355 void ContentViewCoreImpl::OnTabCrashed() { |
347 JNIEnv* env = AttachCurrentThread(); | 356 JNIEnv* env = AttachCurrentThread(); |
348 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 357 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
349 if (obj.is_null()) | 358 if (obj.is_null()) |
350 return; | 359 return; |
351 Java_ContentViewCore_resetVSyncNotification(env, obj.obj()); | 360 Java_ContentViewCore_resetVSyncNotification(env, obj.obj()); |
352 } | 361 } |
353 | 362 |
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1648 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1640 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1649 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1641 return reinterpret_cast<intptr_t>(view); | 1650 return reinterpret_cast<intptr_t>(view); |
1642 } | 1651 } |
1643 | 1652 |
1644 bool RegisterContentViewCore(JNIEnv* env) { | 1653 bool RegisterContentViewCore(JNIEnv* env) { |
1645 return RegisterNativesImpl(env); | 1654 return RegisterNativesImpl(env); |
1646 } | 1655 } |
1647 | 1656 |
1648 } // namespace content | 1657 } // namespace content |
OLD | NEW |