Chromium Code Reviews| 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/child_process_launcher_android.h" | 5 #include "content/browser/android/child_process_launcher_android.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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "content/browser/frame_host/render_frame_host_impl.h" | 11 #include "content/browser/frame_host/render_frame_host_impl.h" |
| 12 #include "content/browser/media/android/browser_media_player_manager.h" | |
| 13 #include "content/browser/media/media_web_contents_observer.h" | |
| 14 #include "content/browser/renderer_host/compositor_impl_android.h" | |
| 15 #include "content/browser/web_contents/web_contents_impl.h" | 12 #include "content/browser/web_contents/web_contents_impl.h" |
| 16 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/render_process_host.h" | 14 #include "content/public/browser/render_process_host.h" |
| 18 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
| 19 #include "jni/ChildProcessLauncher_jni.h" | 16 #include "jni/ChildProcessLauncher_jni.h" |
| 17 #include "ui/gl/android/surface_texture.h" | |
| 18 | |
|
no sievers
2015/10/22 20:55:40
revert changes to this file
mfomitchev
2015/11/02 21:51:15
Just left an ifdef in SetSurfacePeer.
| |
| 19 | |
| 20 #if !defined(USE_AURA) | |
| 21 #include "content/browser/media/android/browser_media_player_manager.h" | |
| 22 #include "content/browser/media/media_web_contents_observer.h" | |
| 23 #include "content/browser/renderer_host/compositor_impl_android.h" | |
| 20 #include "media/base/android/media_player_android.h" | 24 #include "media/base/android/media_player_android.h" |
| 21 #include "ui/gl/android/surface_texture.h" | 25 #endif |
| 22 | 26 |
| 23 using base::android::AttachCurrentThread; | 27 using base::android::AttachCurrentThread; |
| 24 using base::android::ToJavaArrayOfStrings; | 28 using base::android::ToJavaArrayOfStrings; |
| 25 using base::android::ScopedJavaGlobalRef; | 29 using base::android::ScopedJavaGlobalRef; |
| 26 using base::android::ScopedJavaLocalRef; | 30 using base::android::ScopedJavaLocalRef; |
| 27 using content::StartChildProcessCallback; | 31 using content::StartChildProcessCallback; |
| 28 | 32 |
| 29 namespace content { | 33 namespace content { |
| 30 | 34 |
| 31 namespace { | 35 namespace { |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 45 break; | 49 break; |
| 46 } | 50 } |
| 47 it.Advance(); | 51 it.Advance(); |
| 48 } | 52 } |
| 49 if (!render_process_id) { | 53 if (!render_process_id) { |
| 50 DVLOG(1) << "Cannot find render process for render_process_handle " | 54 DVLOG(1) << "Cannot find render process for render_process_handle " |
| 51 << render_process_handle; | 55 << render_process_handle; |
| 52 return; | 56 return; |
| 53 } | 57 } |
| 54 | 58 |
| 59 #if !defined(USE_AURA) | |
| 55 RenderFrameHostImpl* frame = | 60 RenderFrameHostImpl* frame = |
| 56 RenderFrameHostImpl::FromID(render_process_id, render_frame_id); | 61 RenderFrameHostImpl::FromID(render_process_id, render_frame_id); |
| 57 if (!frame) { | 62 if (!frame) { |
| 58 DVLOG(1) << "Cannot find frame for render_frame_id " << render_frame_id; | 63 DVLOG(1) << "Cannot find frame for render_frame_id " << render_frame_id; |
| 59 return; | 64 return; |
| 60 } | 65 } |
| 61 | 66 |
| 62 WebContentsImpl* web_contents = | 67 WebContentsImpl* web_contents = |
| 63 static_cast<WebContentsImpl*>(WebContents::FromRenderFrameHost(frame)); | 68 static_cast<WebContentsImpl*>(WebContents::FromRenderFrameHost(frame)); |
| 64 BrowserMediaPlayerManager* player_manager = | 69 BrowserMediaPlayerManager* player_manager = |
| 65 web_contents->media_web_contents_observer()->GetMediaPlayerManager(frame); | 70 web_contents->media_web_contents_observer()->GetMediaPlayerManager(frame); |
| 66 if (!player_manager) { | 71 if (!player_manager) { |
| 67 DVLOG(1) << "Cannot find the media player manager for frame " << frame; | 72 DVLOG(1) << "Cannot find the media player manager for frame " << frame; |
| 68 return; | 73 return; |
| 69 } | 74 } |
| 70 | 75 |
| 71 media::MediaPlayerAndroid* player = player_manager->GetPlayer(player_id); | 76 media::MediaPlayerAndroid* player = player_manager->GetPlayer(player_id); |
| 72 if (!player) { | 77 if (!player) { |
| 73 DVLOG(1) << "Cannot find media player for player_id " << player_id; | 78 DVLOG(1) << "Cannot find media player for player_id " << player_id; |
| 74 return; | 79 return; |
| 75 } | 80 } |
| 76 | 81 |
| 77 if (player != player_manager->GetFullscreenPlayer()) { | 82 if (player != player_manager->GetFullscreenPlayer()) { |
| 78 gfx::ScopedJavaSurface scoped_surface(surface); | 83 gfx::ScopedJavaSurface scoped_surface(surface); |
| 79 player->SetVideoSurface(scoped_surface.Pass()); | 84 player->SetVideoSurface(scoped_surface.Pass()); |
| 80 } | 85 } |
| 86 #endif | |
| 81 } | 87 } |
| 82 | 88 |
| 83 } // anonymous namespace | 89 } // anonymous namespace |
| 84 | 90 |
| 85 // Called from ChildProcessLauncher.java when the ChildProcess was | 91 // Called from ChildProcessLauncher.java when the ChildProcess was |
| 86 // started. | 92 // started. |
| 87 // |client_context| is the pointer to StartChildProcessCallback which was | 93 // |client_context| is the pointer to StartChildProcessCallback which was |
| 88 // passed in from StartChildProcess. | 94 // passed in from StartChildProcess. |
| 89 // |handle| is the processID of the child process as originated in Java, 0 if | 95 // |handle| is the processID of the child process as originated in Java, 0 if |
| 90 // the ChildProcess could not be created. | 96 // the ChildProcess could not be created. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { | 234 jboolean IsSingleProcess(JNIEnv* env, const JavaParamRef<jclass>& clazz) { |
| 229 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 235 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 230 switches::kSingleProcess); | 236 switches::kSingleProcess); |
| 231 } | 237 } |
| 232 | 238 |
| 233 bool RegisterChildProcessLauncher(JNIEnv* env) { | 239 bool RegisterChildProcessLauncher(JNIEnv* env) { |
| 234 return RegisterNativesImpl(env); | 240 return RegisterNativesImpl(env); |
| 235 } | 241 } |
| 236 | 242 |
| 237 } // namespace content | 243 } // namespace content |
| OLD | NEW |