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

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: rebased 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/gesture_event_type.h" 19 #include "content/browser/android/gesture_event_type.h"
21 #include "content/browser/android/interstitial_page_delegate_android.h" 20 #include "content/browser/android/interstitial_page_delegate_android.h"
22 #include "content/browser/android/load_url_params.h" 21 #include "content/browser/android/load_url_params.h"
23 #include "content/browser/frame_host/interstitial_page_impl.h" 22 #include "content/browser/frame_host/interstitial_page_impl.h"
24 #include "content/browser/frame_host/navigation_controller_impl.h" 23 #include "content/browser/frame_host/navigation_controller_impl.h"
25 #include "content/browser/frame_host/navigation_entry_impl.h" 24 #include "content/browser/frame_host/navigation_entry_impl.h"
26 #include "content/browser/media/android/browser_media_player_manager.h" 25 #include "content/browser/media/android/browser_media_player_manager.h"
27 #include "content/browser/renderer_host/compositor_impl_android.h" 26 #include "content/browser/renderer_host/compositor_impl_android.h"
28 #include "content/browser/renderer_host/input/web_input_event_builders_android.h " 27 #include "content/browser/renderer_host/input/web_input_event_builders_android.h "
29 #include "content/browser/renderer_host/java/java_bound_object.h" 28 #include "content/browser/renderer_host/java/java_bound_object.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 void ContentViewCoreImpl::OnHide(JNIEnv* env, jobject obj) { 408 void ContentViewCoreImpl::OnHide(JNIEnv* env, jobject obj) {
410 Hide(); 409 Hide();
411 } 410 }
412 411
413 void ContentViewCoreImpl::OnShow(JNIEnv* env, jobject obj) { 412 void ContentViewCoreImpl::OnShow(JNIEnv* env, jobject obj) {
414 Show(); 413 Show();
415 } 414 }
416 415
417 void ContentViewCoreImpl::Show() { 416 void ContentViewCoreImpl::Show() {
418 GetWebContents()->WasShown(); 417 GetWebContents()->WasShown();
419 ResumeVideo();
420 } 418 }
421 419
422 void ContentViewCoreImpl::Hide() { 420 void ContentViewCoreImpl::Hide() {
423 GetWebContents()->WasHidden(); 421 GetWebContents()->WasHidden();
424 PauseVideo(); 422 PauseVideo();
425 } 423 }
426 424
427 void ContentViewCoreImpl::PauseVideo() { 425 void ContentViewCoreImpl::PauseVideo() {
428 RenderViewHost* host = web_contents_->GetRenderViewHost(); 426 RenderViewHost* host = web_contents_->GetRenderViewHost();
429 if (host) 427 if (host)
430 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID())); 428 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID()));
431 if (ContentVideoView::GetInstance())
432 ContentVideoView::GetInstance()->SuspendFullscreen();
433 }
434
435 void ContentViewCoreImpl::ResumeVideo() {
436 if (ContentVideoView::GetInstance())
437 ContentVideoView::GetInstance()->ResumeFullscreenIfSuspended();
438 } 429 }
439 430
440 void ContentViewCoreImpl::PauseOrResumeGeolocation(bool should_pause) { 431 void ContentViewCoreImpl::PauseOrResumeGeolocation(bool should_pause) {
441 geolocation_needs_pause_ = should_pause; 432 geolocation_needs_pause_ = should_pause;
442 RenderViewHostImpl* rvh = 433 RenderViewHostImpl* rvh =
443 static_cast<RenderViewHostImpl*>(web_contents_->GetRenderViewHost()); 434 static_cast<RenderViewHostImpl*>(web_contents_->GetRenderViewHost());
444 if (rvh) { 435 if (rvh) {
445 scoped_refptr<GeolocationDispatcherHost> geolocation_dispatcher = 436 scoped_refptr<GeolocationDispatcherHost> geolocation_dispatcher =
446 static_cast<RenderProcessHostImpl*>( 437 static_cast<RenderProcessHostImpl*>(
447 web_contents_->GetRenderProcessHost())-> 438 web_contents_->GetRenderProcessHost())->
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 reinterpret_cast<ui::ViewAndroid*>(view_android), 1857 reinterpret_cast<ui::ViewAndroid*>(view_android),
1867 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1858 reinterpret_cast<ui::WindowAndroid*>(window_android));
1868 return reinterpret_cast<intptr_t>(view); 1859 return reinterpret_cast<intptr_t>(view);
1869 } 1860 }
1870 1861
1871 bool RegisterContentViewCore(JNIEnv* env) { 1862 bool RegisterContentViewCore(JNIEnv* env) {
1872 return RegisterNativesImpl(env); 1863 return RegisterNativesImpl(env);
1873 } 1864 }
1874 1865
1875 } // namespace content 1866 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/media/android/browser_media_player_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698