Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 157783004: Partial revert of "Restart fullscreen video playback when switching back from background" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
20 #include "content/browser/android/interstitial_page_delegate_android.h" 19 #include "content/browser/android/interstitial_page_delegate_android.h"
21 #include "content/browser/android/load_url_params.h" 20 #include "content/browser/android/load_url_params.h"
22 #include "content/browser/frame_host/interstitial_page_impl.h" 21 #include "content/browser/frame_host/interstitial_page_impl.h"
23 #include "content/browser/frame_host/navigation_controller_impl.h" 22 #include "content/browser/frame_host/navigation_controller_impl.h"
24 #include "content/browser/frame_host/navigation_entry_impl.h" 23 #include "content/browser/frame_host/navigation_entry_impl.h"
25 #include "content/browser/media/android/browser_media_player_manager.h" 24 #include "content/browser/media/android/browser_media_player_manager.h"
26 #include "content/browser/renderer_host/compositor_impl_android.h" 25 #include "content/browser/renderer_host/compositor_impl_android.h"
27 #include "content/browser/renderer_host/input/web_input_event_builders_android.h " 26 #include "content/browser/renderer_host/input/web_input_event_builders_android.h "
28 #include "content/browser/renderer_host/java/java_bound_object.h" 27 #include "content/browser/renderer_host/java/java_bound_object.h"
29 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h" 28 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager .h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 void ContentViewCoreImpl::OnHide(JNIEnv* env, jobject obj) { 421 void ContentViewCoreImpl::OnHide(JNIEnv* env, jobject obj) {
423 Hide(); 422 Hide();
424 } 423 }
425 424
426 void ContentViewCoreImpl::OnShow(JNIEnv* env, jobject obj) { 425 void ContentViewCoreImpl::OnShow(JNIEnv* env, jobject obj) {
427 Show(); 426 Show();
428 } 427 }
429 428
430 void ContentViewCoreImpl::Show() { 429 void ContentViewCoreImpl::Show() {
431 GetWebContents()->WasShown(); 430 GetWebContents()->WasShown();
432 ResumeVideo();
433 } 431 }
434 432
435 void ContentViewCoreImpl::Hide() { 433 void ContentViewCoreImpl::Hide() {
436 GetWebContents()->WasHidden(); 434 GetWebContents()->WasHidden();
437 PauseVideo(); 435 PauseVideo();
438 } 436 }
439 437
440 void ContentViewCoreImpl::PauseVideo() { 438 void ContentViewCoreImpl::PauseVideo() {
441 RenderViewHost* host = web_contents_->GetRenderViewHost(); 439 RenderViewHost* host = web_contents_->GetRenderViewHost();
442 if (host) 440 if (host)
443 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID())); 441 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID()));
444 if (ContentVideoView::GetInstance())
445 ContentVideoView::GetInstance()->SuspendFullscreen();
446 }
447
448 void ContentViewCoreImpl::ResumeVideo() {
449 if (ContentVideoView::GetInstance())
450 ContentVideoView::GetInstance()->ResumeFullscreenIfSuspended();
451 } 442 }
452 443
453 void ContentViewCoreImpl::PauseOrResumeGeolocation(bool should_pause) { 444 void ContentViewCoreImpl::PauseOrResumeGeolocation(bool should_pause) {
454 geolocation_needs_pause_ = should_pause; 445 geolocation_needs_pause_ = should_pause;
455 RenderViewHostImpl* rvh = 446 RenderViewHostImpl* rvh =
456 static_cast<RenderViewHostImpl*>(web_contents_->GetRenderViewHost()); 447 static_cast<RenderViewHostImpl*>(web_contents_->GetRenderViewHost());
457 if (rvh) { 448 if (rvh) {
458 scoped_refptr<GeolocationDispatcherHost> geolocation_dispatcher = 449 scoped_refptr<GeolocationDispatcherHost> geolocation_dispatcher =
459 static_cast<RenderProcessHostImpl*>( 450 static_cast<RenderProcessHostImpl*>(
460 web_contents_->GetRenderProcessHost())-> 451 web_contents_->GetRenderProcessHost())->
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1869 reinterpret_cast<ui::ViewAndroid*>(view_android), 1860 reinterpret_cast<ui::ViewAndroid*>(view_android),
1870 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1861 reinterpret_cast<ui::WindowAndroid*>(window_android));
1871 return reinterpret_cast<intptr_t>(view); 1862 return reinterpret_cast<intptr_t>(view);
1872 } 1863 }
1873 1864
1874 bool RegisterContentViewCore(JNIEnv* env) { 1865 bool RegisterContentViewCore(JNIEnv* env) {
1875 return RegisterNativesImpl(env); 1866 return RegisterNativesImpl(env);
1876 } 1867 }
1877 1868
1878 } // namespace content 1869 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698