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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 void ContentViewCoreImpl::OnHide(JNIEnv* env, jobject obj) { | 333 void ContentViewCoreImpl::OnHide(JNIEnv* env, jobject obj) { |
333 Hide(); | 334 Hide(); |
334 } | 335 } |
335 | 336 |
336 void ContentViewCoreImpl::OnShow(JNIEnv* env, jobject obj) { | 337 void ContentViewCoreImpl::OnShow(JNIEnv* env, jobject obj) { |
337 Show(); | 338 Show(); |
338 } | 339 } |
339 | 340 |
340 void ContentViewCoreImpl::Show() { | 341 void ContentViewCoreImpl::Show() { |
341 GetWebContents()->WasShown(); | 342 GetWebContents()->WasShown(); |
| 343 ResumeVideo(); |
342 } | 344 } |
343 | 345 |
344 void ContentViewCoreImpl::Hide() { | 346 void ContentViewCoreImpl::Hide() { |
345 GetWebContents()->WasHidden(); | 347 GetWebContents()->WasHidden(); |
346 PauseVideo(); | 348 PauseVideo(); |
347 } | 349 } |
348 | 350 |
349 void ContentViewCoreImpl::PauseVideo() { | 351 void ContentViewCoreImpl::PauseVideo() { |
350 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 352 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
351 if (host) | 353 if (host) |
352 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID())); | 354 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID())); |
| 355 if (ContentVideoView::GetInstance()) |
| 356 ContentVideoView::GetInstance()->SuspendFullscreen(); |
| 357 } |
| 358 |
| 359 void ContentViewCoreImpl::ResumeVideo() { |
| 360 if (ContentVideoView::GetInstance()) |
| 361 ContentVideoView::GetInstance()->ResumeFullscreenIfSuspended(); |
353 } | 362 } |
354 | 363 |
355 void ContentViewCoreImpl::PauseOrResumeGeolocation(bool should_pause) { | 364 void ContentViewCoreImpl::PauseOrResumeGeolocation(bool should_pause) { |
356 geolocation_needs_pause_ = should_pause; | 365 geolocation_needs_pause_ = should_pause; |
357 RenderViewHostImpl* rvh = | 366 RenderViewHostImpl* rvh = |
358 static_cast<RenderViewHostImpl*>(web_contents_->GetRenderViewHost()); | 367 static_cast<RenderViewHostImpl*>(web_contents_->GetRenderViewHost()); |
359 if (rvh) { | 368 if (rvh) { |
360 scoped_refptr<GeolocationDispatcherHost> geolocation_dispatcher = | 369 scoped_refptr<GeolocationDispatcherHost> geolocation_dispatcher = |
361 static_cast<RenderProcessHostImpl*>( | 370 static_cast<RenderProcessHostImpl*>( |
362 web_contents_->GetRenderProcessHost())-> | 371 web_contents_->GetRenderProcessHost())-> |
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1646 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1638 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1647 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1639 return reinterpret_cast<intptr_t>(view); | 1648 return reinterpret_cast<intptr_t>(view); |
1640 } | 1649 } |
1641 | 1650 |
1642 bool RegisterContentViewCore(JNIEnv* env) { | 1651 bool RegisterContentViewCore(JNIEnv* env) { |
1643 return RegisterNativesImpl(env); | 1652 return RegisterNativesImpl(env); |
1644 } | 1653 } |
1645 | 1654 |
1646 } // namespace content | 1655 } // namespace content |
OLD | NEW |